Page 1 of 1

UART speed

Posted: Fri Sep 11, 2020 1:35 pm
by jenspogo
Hey guys,

I would like to speed up my UART communication.
actually it looks like this:
K800_UART_Timing_02.JPG
K800_UART_Timing_02.JPG (65.78 KiB) Viewed 3154 times
I would like to increase the time between the bits where nothing happens.
I'm using a Bluepill Board with the offical core.
My Code looks like this:

Code: Select all

#define SAMPLERATE 2000000

HardwareSerial  mySerial(PA3, PA2); // RX, TX
int i = 64;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
 
  // set the data rate for the HardwareSerial port
  mySerial.begin(SAMPLERATE);
  
}

void loop() { // run over and over

  mySerial.write("<");
  mySerial.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
//  while (i <(94))
//  {
//  mySerial.write(i);
//  i++;
//  }
  mySerial.write(">");
  delay(10);                       // wait for a second
  digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));

i = 64;  

}
Im using "<" and ">" as start and stop on the receiver.

Is there any possibility?

Greetings,
Jens

Re: UART speed

Posted: Fri Sep 11, 2020 1:39 pm
by mrburnette
Speed up? Like compressing but not really increasing the BAUD? Ummmm ... Serial is governed by Standards:
https://www.sealevel.com/support/overvi ... standards/

Re: https://www.electronicdesign.com/techno ... -baud-rate

Staying in the Arduino framework, we could just choose to not utilize the default serial and use SPI instead:
https://www.sciencedirect.com/topics/co ... /baud-rate

Of course, the above would require SPI ---> Serial conversion on the target end!

You can also just change the protocol:
https://forum.arduino.cc/index.php?topi ... msg2527550

If you really want to go structured, you can send/receive C structs. Reference Struct_send and Struct_receive libs:
https://github.com/LowPowerLab/RFM69/tr ... r/Examples

Re: UART speed

Posted: Sat Sep 12, 2020 11:16 am
by stevestrong
remove delay(10)...