0

I made a couple of arduino mini pro and esp8266 pcbs with an rs485 transceiver just to find out that I forgot to think about in-system-programming:

Assuming that I don't need to disable the transceiver i tied *RE/DE to gnd/vcc. It turned out that id do need disable the transceiver (at least the receiving part) in order to be able to program the mcu because otherwise the transceiver disrupts the serial data.

But I don't want to lose one pin for this (which in case of an esp8266 are rare) and I don't want to use jumpers because I really like the workflow without.

Is this even possible?

EDIT: The transceiver is an SP3485. Currently it is connected like:

Mini Pro     SP3485
A-rx ------  RO
GND  --1k-- *RE   A  ---- somwhere else
Vcc  --1k--  DE   B  ----        "
A-tx ------  DI

Which blocks serial programming because of a) the "echo" and b) holding A-rx line high.

If I connect *RE --1k-- Vcc and DE --1k-- GND I can ISP the Arduino, but now I obviously can't use the transceiver anymore.

2 Answers 2

1

I'm not sure why you used an RS-485 transceiver if you were only going to permanently enable the two halves? You've basically turned the RS-485 multi-drop into an RS-422 balanced pair-of-pairs. Ah well!

So you wired the transceiver to TX and RX on the ESP8266? And you want to still use those pins to reprogram it, by going "behind" the transceiver and temporarily connect them to your FTDI/whatever? Yeah, sorry: that's not going to work.

The *RE pin and DE pin only affect the balanced side of the transceiver. The RX and TX pins on the logic side are still an output and input respectively, regardless of the state of the two Enable pins.

That means that to reprogram, you're going to have to connect your development machine to the balanced side of the transceiver, and you won't have to worry about the Enable pins. Look for RS-422 USB cable adapters - they're out there!

1
  • Hi John, thanks for your answer. Perhaps my question is not worded so well. I've got one transceiver like the sp3485. So on the balanced side I don't have rx/tx anymore. Only A/B. Connecting on that side will definitely not work. If I disable the transceiver the hard way (connect DE/*RE to gnd/vcc via 1k) I'm able to programm the mini. What I'm looking for is some magic (which I can't think of) which does this for me while programming.
    – Scheintod
    Commented Jul 2, 2016 at 11:14
1

I can't understand the purpose of connecting *RE/DE to GND/Vcc. With this setup, the driver inside the transceiver is always enabled, and it's always driving the A/B pair. Meaning the device at the other end of the link cannot drive the pair itself without making a collision. Basically you have a simplex link, where the Pro Mini is always the sender.

The normal way to connect an RS-485 transceiver is to have DE driven by a GPIO pin of the MCU. You pull this pin HIGH when you want to talk, and leave it LOW the rest of the time so you can hear other devices talking. The *RE pin is connected either to GND (if you want to hear the echo of what you say) or to DE (if you don't).

That being said, you are correct in that the transceiver may cause problems when uploading the firmware on the Pro Mini. One possible solution is to put a resistor between RO and A-RX. The TX of the FTDI cable should have a low output impedance and be able to overpower that resistor. Another option is to use ICSP (in-circuit serial programming) instead of going through the bootloader. It would be easier if you can put an ICSP header on your board.

1
  • Hi Edgar. Thanks for your answer. Above all for pointing out the working of the transceiver. Now I understand what John was trying to tell me :) I think I misunderstood it because I have been working with can transceivers which have dominant / recessive state and I somehow implied that this is so for rs485, too, and re/de only have the purpose of enable. Interestingly enough I have alredy built some usb/rs485 transceivers which I did wire in this way and they did work ...
    – Scheintod
    Commented Jul 3, 2016 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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