Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18548

Re: What are the allowed UART speeds on Edison (using breakout and Arduino IDE)

$
0
0

Dear all,

 

I did some more testing and it seems that the gaps only apply to the Edison sending data as in Serial.write and Serial.print. When the Edison receives data from the serial bus it is super fast it seems. I connected a teensy board to the Edison sending 8 bytes of data in a Serial.write operation at a baudrate of 3500000, which would take 18 microseconds and is in practice 23 microseconds (oscilloscope). The teensy does not have the 'gap problem' of 50 microseconds between bytes that the Edison seems to have. The Edison had no problems keeping up following though (I lowered the logic level from the teensy simply with voltage dividing resistors). The read operation from the bus takes even less time at on average 8 microseconds for a bus read of 8 bytes.

 

I guess there is some routine somewhere in the Arduino/Edison IDE that deliberately waits for about 50 microseconds between byte sends. I looked through the Edison Arduino cores and could not find where the problem hides. It is remarkable that two Serial.print(byte) operations in succession seem to have exactly the same delay. Hopefully somebody else can find the problem here?

 

Luckily my test showed that the Edison is very suitable to connect to peripheral micro controllers. In my case two teensy's collecting data from a sensor array and a position / gestural device respectively and thus I will now be able to send a large bulk of sensor data with very low latency over WIFI to my computer. This is very promising for more complex wireless electronic musical instruments that require low latency operation.

 

I used this small sketch to test and the oscilloscope to verify the signal.

 

char receiveArray[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

long timeBefore = 0;

long timeAfter = 0;

int readTime = 0;

 

void setup() {

  Serial1.begin(3500000); // 460800, 921600

  Serial.begin(115200);

}

 

void loop() {

  while (Serial1.available() == 8) {

  timeBefore = micros();

  Serial1.readBytes(receiveArray,8);

  timeAfter = micros();

  readTime = timeAfter - timeBefore;

    Serial.println(readTime);

  }

  delayMicroseconds(1);

}

 

And on the teensy

 

byte EdisonUartTest [8] = { 1, 2, 3, 4, 5, 6, 7, 8 };

 

void setup() {

  // initialize serial communications at 9600 bps:

  Serial1.begin(3500000);

}

 

void loop() {

  for (byte i = 0; i < 256; i++) {

    EdisonUartTest [7] = i;

    Serial1.write(EdisonUartTest, 8);

    delay(1000);

  }                   

}


Viewing all articles
Browse latest Browse all 18548

Trending Articles