Skip to main content
RWedu.1
Associate II
October 20, 2020
Question

Modbus over RS485 with STM32F303K8

  • October 20, 2020
  • 1 reply
  • 9408 views

I'm looking to make a loop of MCUs as slaves to a PC master so that I can send commands to them. The idea is to use the https://www.maximintegrated.com/en/products/interface/transceivers/MAX22025.html and https://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_USB_RS485_CABLES.pdf to be able to communicate over RS485. Note that the transceiver eliminates the need for DE and \RE. The question is however, how do I set up the MCUs for the Modbus protocol? I'm aware of the protocol implementations found online, but I'm unsure of the STM specific setup. In CubeMX I get this, with no RX pin and no options: 0693W000004KPkyQAG.pngThis is what the reference manual RM0316 says:

0693W000004KPrGQAW.png 

I'm a little confused as to how the UART should be set up for Modbus communication, so I appreciate any help!

Thanks

This topic has been closed for replies.

1 reply

TDK
October 20, 2020

It's half duplex, so there is no RX pin. The TX pin pulls double duty.

I found quite a lot of hits when searching "modbus stm32". As is the nature of free software, I'm sure they are of varying quality and probably require you to do some of the work getting them to start.

"If you feel a post has answered your question, please click ""Accept as Solution""."
RWedu.1
RWedu.1Author
Associate II
October 21, 2020

That makes sense, thank you! Does this mean that the TX pin of the MCU should be connected to both the RXD and TXD pin of the transceiver? I see that it requires the TXD pin to be high to be able to receive data:

0693W000004KUCJQA4.png

SScha.3
Visitor II
July 21, 2021

It would be interesting what your solution was, I'm facing the same problem. Can you provide a schematic? Did you also used external pull-ups on the uart side?

Best regards