Electronic – RS485 without flow control

modbusrs485stm32f4

Is it possible to send/recieve on RS485 without flow control. I am working on stm32f4 platform with a MAX3160 multiprotocol transceiver(supports RS232 and RS485). The UART lines form STM32F4 are connected to the MAX3160. When the MAX3160 is configured to RS232 it works fine. But when configured to RS485(only 1 pin toggle on MAX3160, input/output lines are same) i am not able to send/receive data. The devices connected to RS485 are using modbus protocol. I am not using RTS/CTS and have configured NO_FLOWCONTROL on UART. My modbus devices also has just 2 wires A+ and B-.

Could the RS485 data enable or not configuring CTS/RTS causing this issue.

I am not very experienced in hardware. So any pointers will help.

EDIT:
Yes. I am not too sure about the basics as this is the first time I am working on any hardware boards. I have a board with stm32f427. The USART1 lines are connected to a MAX3160 transreciever which supports both Rs232 and Rs 485, although not simultaneously. It can be configured with one pin. The input and output lines for both rs232 and Rs 485 are same. I connect the rx tx from these to the modbus device. I configure the uart with no flow control, 9600 baud rate, stopbit 1, no parity and enable Rs 232 pin on MAX3160. I use a rs232 to Rs 485 converter connector and connect the modbus device. It works fine. So i am sure the pi configuration is fine. Now I just enable pull the rs232/rs485 pin high to enable Rs 485. I remove the rs232 to Rs 485 converter and connect the modbus device directly. I am guessing it should work without any changes. But I hooked up a oasicalltor and I cannot detect anything. MAX3160 data sheet has some pin called DE485(data enable). Should this be set. Or some other change specific to Rs 485. Currently I have not set this data enable pin. If it needs to be set, when should it be set. My modbus device has only 2 wires A+ and B- which I have connected to Rx and Tx respectively.

Best Answer

RS485 is a multidrop bus, which means that a number of nodes are connected to the same bus and, in this case, they all have the potential to "talk" at the same time. For a device to take control of the bus and be able to talk, the RS485 transceiver (in your case the MAX3160) has to have its transmit enable pin be enabled. All the other devices on the bus need to have them disabled. If more than one device is enabled to transmit, data can become garbled because one device might be trying to drive the bus in one state and another device trying to drive the bus in a different state.

You enable the device to take control of the bus by setting the DE pin high. Once it is high, anything on the DI pin is transmitted on to the bus. It is important to note that all other devices on the bus should have their DE pins low.

The other enable pin on the transceiver is usually called the ~RE pin. Note that this is low for anything on the bus to be reflected on the RO pin. That looks like it's the R1OUT on your Max device.

A lot of the time, you see the ~RE and DE pins connected together and to a GPIO on the micro. This GPIO determines whether you are listening to what other nodes on the bus are saying or talking on the bus yourself.

All this is not to be confused with flow control which is often used on devices such as modems that are relatively dumb and have relatively small data buffers. This is a method of each device saying it is ready to send more data out or ready to receive data in. This can be done in hardware with RTS/CTS pins and can also be done in software with XON/OFF messages. There are lots of good resources on line that explain this very well and I still dip in and out of these every now and again because it can get confusing!

It's probably worth noting that there are various methods of deciding who is allowed to talk on the bus at any one time. There always needs to be a method of knowing who is the one master at any one moment in time.

So, to listen on the bus, ensure ~RE (R1OUT) and DE are low. To transmit on to the bus, DE should be high. If ~RE is high at the same time, you will not get what is being transmitted, send back to the Rx pin of the UART on your micro.