cancel
Showing results for 
Search instead for 
Did you mean: 

stm32, 485 bus

Posted on April 03, 2018 at 08:25

Hi. I'm testing a new board with a STM32F091rctx micro, where the 485 bus is bring up using these pinouts:

PB5 (Enable)

PD2 (Rx)

PC12 (Tx)

Is the Enable signal moved by the Hal libraries or have I to move it?

Using an oscilloscope I see something coming out when I send something but I never receive nothing.

Have I to have a differt approach whit 485 bus than the serial ports?
1 REPLY 1
Jack Peacock
Associate II
Posted on April 03, 2018 at 09:40

Not sure what the HAL does for RS-485, don't use it.  You don't mention if it's half or full duplex but since most RS-485 is two wire I'll assume half.  If your connection isn't working make sure you are using twisted pair, there's a terminator at each end (120 ohm typical), and only one side has the transmitter enabled.  Unless you tie the RE and DE pins together on the RS-485 transceiver you'll have to make sure the receiver is enabled too.

With half duplex you have to manage access to the bus, since only one node can send at a time.  You have to turn around the node transceiver at the end of a message out, and be sure to use TC (transmission complete) to end a transmission because the USART buffers the last byte, continuing to send after TXE is asserted.  Otherwise the last byte is cut off.

You'll need some kind of protocol to coordinate nodes.  You might look at Modbus, a very simple network stack designed for RS-485.

  Jack Peacock