Hi All,
Have attached both devices in a stackable config and tried running the example sketch from the SparkFun library but keep getting prompted with “Module failed to respond. Please check wiring.” in the serial monitor.
No amendments were made to the code except configuring the TX RX pins for softserial, tried 2 & 3 and 0 & 1 but still does not work.
Any assistance will be greatly appreciated, thanks!
Do you have another MCU you can test with? Or send a generic test message with just the R4 (to itself, make an TX<->RX loop) using software serial to ensure it’s working properly?
I had tested before :
When selecting for “Serial1” as the NanoSerial communication port and connecting the M6E with the switch “UART HW”. It will work without modifications. It will use pin 0 as RX and pin 1 as TX.
Two challenges come when selecting SoftwareSerial as the NanoSerial communication port. Make sure to set the switch to “UART-SW”. The following modifications are needed :
Challenge-1:
This is within the sketch within the function “setupNano(long baudRate)” . The SoftwareSerial library of the UNO R4 does have a boolean function: while (!NanoSerial). WorkAround: Replace the “while (!NanoSerial);” with a “delay(1000);”
Challenge-2:
A problem with UNO-R4 the SoftwareSerial in the library (version 1.0.4) prevents a change a baudrate after an initial baudrate has been set. In the function setupNano() it first tries to connect with the wanted baudrate. If that fails it will assume the M6E is still at the default 115200. It will set the NanoSerial to 115200, send an instruction to the M6E to set the wanted baudrate, and reset NanoSerial to the wanted baudrate. Now it will attempt again. As changing the baudrate does not work it will fail to connect. WorkAround: In setup() call as setupNano(115200).
Update: A solution to this problem in SoftwareSerial has been posted on ArduinoForum (https://forum.arduino.cc/t/softwareseri … le/1179988)