I want to know, how we identify the RS485 pins are inverted. I am using at91 microcontroller?

This sam9260 board has four rs485 in which two of them are inverted. How to know which ports are inverted, I didn't find such information in the datasheet also?

This is the simple code:

rs485ctrl.inverted = 1;
rs485ctrl.pin = -1;

EDIT: other serial device configuration:

rs485ctrl.inverted = 1;
rs485ctrl.pin = 0x40 + 2;

I didn't understand where this 0x40 +2 magic number came from? I interpreted if the pin is inverted it set as -1, perhaps what I understood is wrong?

I used the multimeter to verify the positive wire is greater than negative wire during idle but don't know if there any other way to find the polarity of RS485?

Don't know, is this the right forum to ask such a question.

  • 1
    \$\begingroup\$ What do you mean "inverted", the differential signals? Your microcontroller should only need to concern itself with the UART part, or are you also using handshaking signals over RS485? Why is there 4 signals? Is this actually RS422 (full duplex)? Please post (a link to) the schematic. As for data sheets, you need to check the data sheet of the RS485 transceiver and nothing else. The lines are usually called A and B, where I believe B is the inverted one. \$\endgroup\$ – Lundin Aug 15 '18 at 8:00
  • \$\begingroup\$ @Lundin, I will check the schematic that will give information about line A and B polarity. \$\endgroup\$ – danglingpointer Aug 15 '18 at 8:09
  • \$\begingroup\$ I still don't get why your program needs to know this? This is handled by the RS485 transceiver, not by software. Or are you "bit-banging" an UART (why on earth would you do that)? \$\endgroup\$ – Lundin Aug 15 '18 at 8:13
  • \$\begingroup\$ I just reread the wiki page of rs485, know I learned A is non-inverting pin and B is the inverting pin. It's hardware that takes control of it. I am not doing the bit banging, I was unaware of the A and B polarity. Thanks for the information. \$\endgroup\$ – danglingpointer Aug 15 '18 at 9:17

RS485 uses the same wires to send and receive, you need to set a microcontroller output to the apropriate mode to command the RS485 transceiver to work in the aprorpriate direction.

I'm not seeing a hardware solution to this in the datasheet so I guess that means you'll need to use the end of transmission interrupt to toggle the pin.


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.