2018-04-02 11:25 PM
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?2018-04-03 12:40 AM
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