Skip to main content
SPren
Associate II
April 18, 2019
Solved

RS485 on STM32

  • April 18, 2019
  • 1 reply
  • 2165 views

Question regarding an implementation of RS485 on an STM32.

The application note (reference guide) refers to 4 bits stored in the USART_CR2 register which can be used as an address comparison to aid with waking only when required.

“Address mark detection (WAKE=1)

In this mode, bytes are recognized as addresses if their MSB is a ‘1 else they are considered as data. In an address byte, the address of the targeted receiver is put on the 4 LSB. This 4-bit word is compared by the receiver with its own address which is programmed in the ADD bits in the USART_CR2 register.�?

But this limits the number of devices to 15 (plus a master) and the RS485 standard can handle 32 connections and the address is sent as a full byte (so theoretically 255 connected devices)

So; is this a handy device they’ve provided if you only want a few connected devices or am I missing something more?

This topic has been closed for replies.
Best answer by After Forever

Which part are you using? In STM32L0x1 USART_CR2 has 8 address bits - ADD[7:4] and ADD[3:0], and 4-bit or 7-bit address mark detection are supported.

1 reply

After Forever
After ForeverBest answer
Senior III
April 18, 2019

Which part are you using? In STM32L0x1 USART_CR2 has 8 address bits - ADD[7:4] and ADD[3:0], and 4-bit or 7-bit address mark detection are supported.

SPren
SPrenAuthor
Associate II
April 18, 2019

STM32F091 (Nucleo-64)

Looking again I had the F4 Reference Manual.

Thanks for confiming it is fine in the F0.