bertmelis / esp32ModbusRTU

modbus RTU client for ESP32
MIT License
70 stars 44 forks source link

polarity of A and B wires #6

Open jandegr opened 5 years ago

jandegr commented 5 years ago

Hi,

I am far from an expert on the matter but I found 2 versions of terminating A and B. 2fdda3cc7cd98d10b83f8feb2a3fb80e7aec9005

The sample hardware in the readme does as in the top diagram, pull B to VCC and A to GND and then in the sdm630 sample ino, the serial port is initialized with the invert parameter true.

All cheapish prefabricated ttl-rs485 converters I found use the bottom diagram with A pulled to VCC and B to GND, with an 120ohm resistor between A and B, but then the invert parameter must be set to false.

I think it would be good if you spend a few words on the invert parameter in readme.MD to avoid confusion (and a failing setup) for new users.

nogmaals bedankt.

bertmelis commented 5 years ago

You're right. I forgot about this after testing my initial setup (which didn't work because of counterfeit max3485 chips that couldn't handle the 3V3). It's mixed up right now. thanks for the pointer.

Offcourse, confusion comes from the rs485 standard itself where -as I understand- A should be negative to B whereas the real world implements the opposite.