Skip to main content
BMoha.3
Associate
January 10, 2022
Solved

STM32f4 and RS232 protocol

  • January 10, 2022
  • 3 replies
  • 4200 views

hello everyone, i am using stm32f407 discovery board and i would receive data from a device (load cell amplifier) which communicates via RS232. So my question is : can i use a simple USART in my stm32f4 to receive data ? or i need to use ( RS232 --> UART) converter between the device and my stm32f4 ?

This topic has been closed for replies.
Best answer by mƎALLEm

Dear @BMoha.3​ 

You need an RS232 transceiver to add to STM32F4 if your device (load cell amplifier) has levels of RS232 :

Signal Voltage levels State

-3 to -25v --> 1

+3 to +25v --> 0

And you can use UARTx or USARTx peripheral.

3 replies

mƎALLEm
mƎALLEmBest answer
Technical Moderator
January 10, 2022

Dear @BMoha.3​ 

You need an RS232 transceiver to add to STM32F4 if your device (load cell amplifier) has levels of RS232 :

Signal Voltage levels State

-3 to -25v --> 1

+3 to +25v --> 0

And you can use UARTx or USARTx peripheral.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
BMoha.3
BMoha.3Author
Associate
January 10, 2022

Thank you @Community member​ for your response,

so what i clearly understand that i have to use a ( RS232 --> UART) converter like MAX3232 between my device and the stm32, am i right ?

Peter BENSCH
Technical Moderator
January 10, 2022

Yes, you can also find equivalent devices on the RS-232 selector website, where you can select a suitable device for your needs (number of RX, TX, Speed, Supply).

Regards

/Peter

mƎALLEm
Technical Moderator
January 10, 2022

Yes, you need a transceiver like MAX3232 for STM32F4 if your device from the other side follow RS232 levels.

For example, if you need to connect STM32F4 to a PC via RS232, you have to add RS232 transceiver to adapt voltage levels.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
BMoha.3
BMoha.3Author
Associate
January 10, 2022

Thank you so much for the help @Community member​, so i will use a RS232 transceiver (MAX3232) to read data from my device. After connection of :

RX_stm32 --> TX_MAX3232

TX_stm32 --> RX_MAX3232

now should i use a normal UASRT configuration to read the data or configure the USART of the stm32 used with the Hardware flow control RS232 option ?

this a picture of the RS232 pins of my device :0693W00000Hr7diQAB.jpg

mƎALLEm
Technical Moderator
January 10, 2022

@BMoha.3​ ,

As I already said, you can use UART or USART for RS232 communication.

USART can be used also for synchrounus communication but you don't need this feature as per the picture you shared.

You can refer to any of the examples provided in STM32CubeF4 under the path:

\Projects\STM324xG_EVAL\Examples\UART

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
S.Ma
Principal
January 10, 2022

Don't bother, use HC-05 uart to bluetooth serial 4 pin dongle for few dollars. For mobile phone, you can have fun with android Bluetooth Electronics which use your phone as a remote touch screen!