This is probably an Arduino issue rather than a DCC++ issue, but I hope some one will know what is happening! I am convinced I am doing something wrong, but I cant figure out the causes of the failure I am trying to send commands to an unmodified DCC++ base on a UNO from a simple command generator running on a Mega. In this test the UNO is not connected to a USB port, and I have wired a connection from its HW Serial pins (0,1) to software serial pins on the Mega. I want to: Send commands sent to mega to the UNO from the PC connected to the mega I want to see the Base (UNO) command response on the PC Serial Monitor connected to the Mega USB I want to send commands created on the Mega and see the response from the Uno This is the code I am using to send messages between the UNO Base and the PC void loop() { // serial data exchange if(Serial.available()) { // command from PC softSerial.write(Serial.read()); // write to Base } else { if(softSerial.available()) { // response from base station to PC command Serial.write(mySerial.read()); // write to PC } } plus softSerial.write(command); When I send a command from the Mega to the Base using softSerial - I get a mixed up response with invalid characters for example: <0> 0�p�� <1> L���� Followed by turnout commands <T 1 0> and <T 2 0> T 1 0a 200 0 0<H1 0>T 2 0a 201 0 0<H2 0> If I send <T 1 0> from the PC I get T 1 0a�&�� 0<H1 � Is it simply that I cant connect the H/W serial pins on the Uno to a pair of softSerial pins on the Mega? If so is there any solution which would enable to see the Base station response on a serial monitor, via the mega. Thanks in advance David
I have never played around with a Mega, but do you have anything connected to pins 0 or 1 of the Mega - which would cause a conflict with its USB port? Jim
I have no connections to pins 0 or 1 on the mega - my problem is that I have to use pins 0 and 1 for softserial input to the Uno, and the evidence is that this is the problem With Pololu motor board the Uno has no spare pins which support level change interrupts. David
I think the issue is SoftwareSerial just isn't supper reliable at 115200 baud. I think if you cut back the baud rate between the Mega and the Uno, you wouldn't have these issues. The Mega also has additional hardware serial ports, Serial1, Serial2, and Serial3. I would suggest using one of them instead of SoftwareSerial and you shouldn't have any issues at 115200 baud.
I was very reluctant to use one of the Mega hardware serial ports - I need them for interrupts from track sensors - but I think you are correct in suggesting softserial does not really cope at 112500 - so have switched to using Serial2 and everything is fine - and if I really need an additional interrupt then I know what do Thank-you.