RS485 Module adding extra characters

Hello all.
A few weeks ago I started a project involving several arduinos talking over RS485. I took some example I found online and started to build from that.

The wiring I found online (https://arduino-info.wikispaces.com/SoftwareSerialRS485Example) is as follows (there's a picture on the page):

pin 10 -> RD
pin 11 -> DI
pin 3 -> DE
DE -> RE

This on both sides.

Initially everything went OK until I started to get some extra characters over the RS485 link.

After a lot of work, I found out that each time Pin3 (DE & RE) goes from HIGH to LOW I get a NULL character (character zero) on the other end.

romanr9999:
Hello all.
A few weeks ago I started a project involving several arduinos talking over RS485. I took some example I found online and started to build from that.

The wiring I found online (https://arduino-info.wikispaces.com/SoftwareSerialRS485Example) is as follows (there's a picture on the page):

pin 10 -> RD
pin 11 -> DI
pin 3 -> DE
DE -> RE

This on both sides.

Initially everything went OK until I started to get some extra characters over the RS485 link.

After a lot of work, I found out that each time Pin3 (DE & RE) goes from HIGH to LOW I get a NULL character (character zero) on the other end.

When you de-activate RE, the MAX485 or SN75176.. Tristates the RD pin, the UART(RX) pin falls from Idle (VCC )to GND. The UART interprets this as a START bit and creates a NULL character.

To fix this problem place a pullup resistor on the RX pin I use 4.7k.

Chuck.

Chuck,

I did a quick test and what you suggested seems to work!!
Thanks a lot!!!!

I'll try it next in the real thing but it does look promising.
Thanks again for your help.

romanr9999:
Chuck,

I did a quick test and what you suggested seems to work!!
Thanks a lot!!!!

I'll try it next in the real thing but it does look promising.
Thanks again for your help.

Good Luck!

Chuck.

This is really weird.
It happened before. Sometimes it works and sometimes it just doesn't.
I know it doesn't make sense but it is what it is.
A few weeks ago when I started this project I tried a simple sketch and it just worked fine, no problems at all.
At some point to program started to fail communicating and I couldn't find the problem. I went back to the simple sketch I tested originally and it wasn't working either.
Yesterday I tested using pulling up resistors on the Rx pin and it worked perfectly.
I went to test my own code and it didn't work. Again I now went back to the sketch I used initially that's the same one I used yesterday. It's not working either.
Now I get a constant stream of zeros.
I've built this prototype on a protoboard and the only explanation I have now is that there may be a problem with the board and probably there's one or more of the wires not making proper contact.
Is the only cause I can think of.

I tested it a little more.
My simple test sketch connects two arduinos one as a master and the other as a slave. The problem is since each time TxEnable goes from high to low, this sends a zero character to the other end (either with or without a pullup resistor in Rx), this character makes the master to go into receive mode (TxEnable goes from high to low) and this sends a zero character to the slave. At this point, the slave does what it is supposed to do, send the character back to the master and this goes on and on and on.

I changed the connections in the protoboard and I still get the same result.
I don't understand why sometimes it does work. The pull up resistor made no difference, sometimes it works (with or without the pull up resistor) and most of the time it doesn't work (with or without the pull up resistor) .

I just checked and the module already has built in 10k pull-up resistors, so that's why it does not make any difference if I add an external one.

It uses a Max485 chip.
The attached PDF has the schematics of the module.

485.pdf (84 KB)

romanr9999:
I tested it a little more.
My simple test sketch connects two arduinos one as a master and the other as a slave. The problem is since each time TxEnable goes from high to low, this sends a zero character to the other end (either with or without a pullup resistor in Rx), this character makes the master to go into receive mode (TxEnable goes from high to low) and this sends a zero character to the slave. At this point, the slave does what it is supposed to do, send the character back to the master and this goes on and on and on.

I changed the connections in the protoboard and I still get the same result.
I don't understand why sometimes it does work. The pull up resistor made no difference, sometimes it works (with or without the pull up resistor) and most of the time it doesn't work (with or without the pull up resistor) .

I just checked and the module already has built in 10k pull-up resistors, so that's why it does not make any difference if I add an external one.

It uses a Max485 chip.
The attached PDF has the schematics of the module.

The module looks good. Maybe you are switching out of the TX mode before the UART has sent all the bits out. Are you using Serial.flush() in your code before you digitalWrite(DE,HIGH)?

Post a copy of your code.

I have used RS485 between multiple UNO's, Mega's successfully. I am currently working on a network stack using RS232->RS485->nRF24L01->RS485.

The RS485 is not giving me any problems, I have having issues with routing, discovery, and end to end packet recovery.

I would be surprised if your problem is not software related.

Chuck.