I'm working with an Arduino Mega 2560 and I have run into a strange problem.
I am using the UART to communicate with a radar sensor. The data I receive use a CRC check to validate the data. In the beginning, I used Serial1, and everything worked perfectly. Never a single CRC mismatch.
Next, I tried switching to Serial (to make it Arduino Uno ++ compatible). Now I get lots of CRC errors (maybe 50% of all the packets received have CRC error).
I've tried switching back and forth several times. And always the same results. On Serial1, no problem. On Serial, lots of CRC mismatch.
I also tried Serial3, and this one also works perfectly. (I didn't try Serial2 yet)
I am using 115200 as baud rate, and according to the datasheet of the microcontroller, that should give about 3% error on that baud rate as far as I can remember. But shouldn't I see this behavior on all the Serial ports instead of just 1?
Is there any known issue with Serial that is not an issue with Serial1?
oyvdahl:
Next, I tried switching to Serial (to make it Arduino Uno ++ compatible). Now I get lots of CRC errors (maybe 50% of all the packets received have CRC error).
As you have not posted your program it is a bit difficult to see what the problem might be.
Also post diagrams showing how you have everything connected in the working and non-working situation.
My guess is that you need to use SoftwareSerial on the Uno - but it won't work at 115200 baud. 9600 works well and 38400 should work. And if that is not an option then maybe an Uno is unsuitable.
Robin2:
As you have not posted your program it is a bit difficult to see what the problem might be.
Also post diagrams showing how you have everything connected in the working and non-working situation.
My guess is that you need to use SoftwareSerial on the Uno - but it won't work at 115200 baud. 9600 works well and 38400 should work. And if that is not an option then maybe an Uno is unsuitable.
...R
Thanks. Good to know that SoftwareSerial does not work well at 115200 baud.
Didn't want to post code as I'm more interested in general if there are any differences between the two (independently of my code and connections).
Maybe the fact that the Serial is connected to USB is enough to introduce some errors in one that I don't see in the other.
If anyone has had similar experiences, please chime in!
this query is just a complete waste of everyone's time - including yours.
...R
I understand that it's impossible for you to find the problem without this. But I didn't want to waste your time debugging my code. I was more fishing for someone to say "Oh yes! That's a typical issue of the Serial vs Serial1".
But alright, then we'll leave it at the conclusion that it shouldn't be a problem.