6
\$\begingroup\$

I'm trying to build a RS-485 project using MAX485's. However, I'm having trouble finding out how to correctly use the RE and DE pins. Some PDF's and websites say that RE and DE should be tied together and then connected to a pin on a microcontroller (for example). Other places seem to have various combinations of connecting DE to ground and RE to positive, and other such things.

Additionally, the places that say RE and DE should be tied together and then connected to a microcontroller, also have conflicting information about how these should then be controlled through the software.

So my questions are:

  • What am I actually supposed to do with RE and DE? Do I need any pull up or pull down resistors also?
  • How do I control RE and DE assuming they are controlled by my microcontroller? Do I set them high/low then send data then set them low/high again? Do I do the same for receiving data?

Any help on this would be appreciated, and also if there are any links to sites with this specific information about DE/RE would be good.

\$\endgroup\$
9
\$\begingroup\$

You don't need any pull-up or pull-down resistors if you're driving those pins with normal output pins on your micro.

DE is the 'Driver Enable' pin and must be pulled high while you're transmitting data. Depending on your micro and how you're using its interrupts you may need to be careful about when you pull it back low - check that all of the bits are completely finished first or you risk truncating the end of your message. You must pull it back low before you'll be able to receive anything.

RE is the 'Receiver Enable' pin and must be pulled low whenever you want to be able to receive data.

You'll notice that the DE and RE pins have opposite polarity. DE is active-high and RE is active-low.
So you can tie them together and control them from one pin if you want to - high means you want to transmit (DE active, RE inactive), and low means you want to receive (RE active, DE inactive).

Another possibility is to tie RE to ground and only control DE.
You would use this configuration is you want to be able to listen to yourself talk. This would be useful in cases where there could be multiple masters talking on your RS-485 bus and you need to check that what you think you're sending is not being corrupted by another transmission occurring at the same time.

If you're only ever going to be either transmitting or receiving then you could tie both DE and RE high (permanent transmit) or both low (permanent receive).

|improve this answer|||||
\$\endgroup\$
  • 2
    \$\begingroup\$ For normal use of RS-485, I don't believe it is supposed to be reliable to detect collisions by monitoring your own transmission as neither 1 nor 0 is dominant; however J1708 Half Duplex Collision Detection apparently makes one bit dominant by tying the TxD signal (possibly inverted) to the DE input instead of the normal Tx input. \$\endgroup\$ – Tut Feb 10 '15 at 14:48
1
\$\begingroup\$

No pull up or pull down resistors are required for the enables. Depending on what you're wanting to do and what the chip allows for, you can tie them together and drive them together (high is TX, low is RX), or drive them both separately. The latter allows for a low power state on the transceiver.

edit: The 485 actually doesn't allow shutdown, the 481/3/7 do though, see pg. 5 of the datasheet. So in that case, I'd tie them together and drive them together.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ "The 485 actually doesn't allow shutdown, the 481/3/7 do though, see pg. 5 of the datasheet. So, I'd tie them together and drive them together." Ok thanks. So, it is just a matter of: Set RE/DE high -> Send Data -> Receive Data -> Set RE/DE low? \$\endgroup\$ – user9993 Feb 10 '15 at 13:45
1
\$\begingroup\$

This depends on what you're trying to accomplish. For example, if you never need to receive, then RE-NOT (There is no RE!!) can be tied high and left there. If you need to enable the driver, DE needs to be high. If you never need to disable it, you can tie it there.

You don't need pullups.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.