I am communicating with a PLC with modbus on a 485 line powered by a uart. I have implemented only of subset of the modbus protocol, only functions 0x03 and 0x10. When sending 0x03, request read of holding register, i do not get a Uart_DataReceived event. I have scoped the 485 line and see the response from the PLC. If I poll with:

        var bytesReceived = aUart.Read(buf, 0, aUart.BytesToRead);

I do indeed read the modbus packet. Even though I dont get the received data event, I do receive the data.

If I connect another device on the 485 line, and it sends data, I do get the event.

Any thoughts ??

Does the transceiver have a receive enable pin?

How are you controlling the RS485 transceiver? Are you doing this with a GPIO pin or using an automatic transmit enabled driver IC? You have to make sure the turnaround delay is short or you can miss the start of the received packet.
Modbus message termination is based on timing so you know the end of a packet based on the timeout from the last received byte.

Yes, there were some timing issues where the write enable interfered with the receive. That issue is resolved.

The PLC responds within 350 microseconds

If you design your own hardware, the MAX13487 is a great little RS485 driver that takes care of the TX/RX for you. GHI used to use this on their Gadgeteer module. The downside is that it is 5V only so I have to use a level translator but as the bus is isolated anyway, that is taken care of by the ADUM device I use and a DC-DC converter for the supply. Works great on noisy VSD’s.


Our contract EE selected SN65HVD72, which has the DE/*RE lines to enable transmit. I have been able to time the enable effectively to disable transmit before the PLC responds. We will probably need to have rev 2 of the board and may consider the MAX chip

That would be a good idea. C# is not good on timing granularity to be able to guarantee the time to switch if back to RX and you would also need access to the registers to know when the last byte has actually been transmitted. Checking the TX buffer is no guarantee that the last character has actually been sent out the serial port. This was why I changed my designs to the MAX chip. No issue since doing so.

1 Like

Hi! I’m designing a board that is using a 485 transceiver with a driver enable and a \Receive enable (THVD1450DGKR). I’ve connected the DE to a UART RTS, but the tutorial doesn’t mention the \RE so I’ve just grounded it. Is this okay or is there a better way to do this? Would I connect it to the UART CTS?

Yes. Whatever you send will be looped back but you can discard in your software.