seeking for help related to data communication with a uart module.
Hi, I am seeking for help related to data communication with a uart module. The module was connected via RX0 and TX1 pins in arduino Nano , however when I am trying to send data with Serial.write(...), the program just cannot upload to the board at all. Was it because of code uploading also need to use Serial via USB? Or something else?
This is the code:
void setup() {
// put your setup code here, to run once:
Serial.begin(9600, SERIAL_5E1);
delay(1000);
Serial.write(0xFE);
Serial.write(0xFD);
Serial.write(0x01);
Serial.write(0x01);
}
Solution:Jump to solution
I would think not, as if the Arduino is still trying to write it would interfere with the communication either way. You could always try it, as I could be wrong but even if it did work perhaps it would be simpler to use software serial.
4 Replies
I don't believe you can use UART at the same time you're trying to upload something. One solution would be to use software serial on different pins for your serial communication duties. https://docs.arduino.cc/learn/built-in-libraries/software-serial/
Also, I'm not sure how the pin with an onboard LED affects things, so you may want to avoid that. I had some problems with that before, though it could be how I had it programmed.
If I added 2 of these switches to break the connection between the module and the Arduino while uploading the code then turn them ON again after uploading it, will it work?
Solution
I would think not, as if the Arduino is still trying to write it would interfere with the communication either way. You could always try it, as I could be wrong but even if it did work perhaps it would be simpler to use software serial.
Ok I'll try it and tell you what happens, thank you sir