Jump to content
43oh

Recommended Posts

Hi,

i need to use systick and serial comunication, but i cant serial communication works. I am using TM4C1294XL board.

 

I've tested diferents values for   Serial.setTimeout(10) (2, 10,50, 100) but no results

Any idea?

 

Thanks

#include <stdint.h>
#include "Energia.h"
#include "driverlib/systick.h"
#include "driverlib/systick.c"
#include "driverlib/sysctl.h"
#include "driverlib/adc.h"
#include "wiring_private.h"

#define pin 2  //PE4
#define SamplingFreq 60000    //Sampling frequency in HZ
#define TickerPeriod (120000000/SamplingFreq)

String inData = ""; // a string to hold incoming data
bool onoff = LOW; // Ticker frequency pin test

void setup() {
  SysTickDisable(); //Disable SysTick during configuration
  Serial.begin(115200);
  delay(500);                   // Waiting to seriaal monitor
  Serial.setTimeout(2);//Sets the maximum milliseconds to wait for serial data initialize serial:
  // reserve 200 bytes for the inputString:
  inData.reserve(200);

  SysTickPeriodSet(TickerPeriod);     //Define counter period. When 0, calls interrupt
  SysTickIntRegister(&Ticker);    //Asociate interrupt to ISR SysTick
  SysTickIntEnable();   //Enable systick interrupt
  SysTickEnable();    //Ebable configurated SysTick
  IntMasterEnable();    //Habilitadas todas las interrupciones
}

void loop() {
  // print the string when a newline arrives:

}

/*
  SerialEvent occurs whenever a new data comes in the
  hardware serial RX. This routine is run between each
  time loop() runs, so using delay inside loop can delay
  response. Multiple bytes of data may be available.
*/
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    inData = Serial.readString();
    Serial.println(inData);

  }
}

void Ticker()
{
  //Frequency test
  onoff = !onoff;
  digitalWrite(pin, onoff);
}

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...