Go Down

Topic: serial not transmitting all data over RF (Read 87 times) previous topic - next topic

cfcorp

Hi Guys,
Ive got two UNOs which are connected using the HC 11 UART RF device based on a Silicon labs chip. I'm using the standard SD card library to print everything in a csv file to the serial port connected to the RF module where it can be read by the terminal on the second arduino.
Im using the example DumpFile sketch that basically opens a file and prints every line in it.
If I do this over the RF module it prints most of the data but then stops, meaning that not all the data made it across the RF link to the second arduino.
If I print over the local serial port on the arduino with the SD card, all the data is displayed but just not over the RF and on the other arduino.
Im using the HW serial on the transmitting device and software serial on the receiving device, both including the RF modules are at 9600 BAUD.
Any help would be greatly appreciated.
Thanks guys

mauried

The HC11 doesnt have any kind of flow control nor does it have end to end error correction so sending large files can cause the usart buffers in the radio to overflow.
Try inserting a short delay after each line so that the radio has time to empty its buffers.
These radios are really half duplex, so they only emulate a hard wired serial connection which works most of the time but large files will cause problems.

cfcorp

The HC11 doesnt have any kind of flow control nor does it have end to end error correction so sending large files can cause the usart buffers in the radio to overflow.
Try inserting a short delay after each line so that the radio has time to empty its buffers.
These radios are really half duplex, so they only emulate a hard wired serial connection which works most of the time but large files will cause problems.

Hi mauried, thanks for the reply. Yes that makes sense all right. I will insert a delay (1) or so and try that, thank you

cfcorp

I have both arduinos connected directly now using a wire from TX to RX and a common ground.
I have the arduino with the SD card constantly printing to the hardware serial in a loop on one PC and I can see the data on the serial monitor constantly being transmitted, however on the other PC I just have the arduino set up to read the serial data and I am monitoring it on the serial monitor. It seems to transmit for a few seconds and then it stops on the receiver while the transmitter constantly loops through the data on the SD card. I thought at first it was my UNO running out of RAM but it doesn't appear to be.

It may be my code on the receiver, I kept it as simple as possible while I am diagnosing the problem. Any one see anything.

 String g;
void setup() {
 
  Serial.begin(9600);
}

void loop() {
 

while(Serial.available())
{
 g=Serial.readString();

 Serial.println(g);
}
}

cfcorp

Oh yeah, just figured it out. My head was wrecked and forgot what I was doing it,
Anyway this does the job

void loop() {
  if (Serial.available()) {      // If anything comes in Serial (USB),
    Serial.write(Serial.read());   // read it and send it out Serial1 (pins 0 & 1)
  }

PaulS

Code: [Select]
    Serial.write(Serial.read());   // read it and send it out Serial1 (pins 0 & 1)
It would be nice if the code actually did what the comment says.
The art of getting good answers lies in asking good questions.

cfcorp

Oh yes, I actually just used the serial passthrough example code and modified it for the UNO instead of devices such as the Mega that actually have more than 1 hardware serial port.
 :smiley-red: 

Go Up