Skip to main content
A Bravos
Associate III
June 28, 2019
Solved

It will be possible communicates with 7 bits + 2 stop bits, in Stm32f103c8t6?

  • June 28, 2019
  • 3 replies
  • 1124 views

I need to make a device that communicates (modbus) with a product that uses the rs232 protocol, with 7 bits and 2 stop bits. I use CubeMx and HAL libs. There is some process to do this. As is known in STM32, only have 8 and 9 bits in length.

This topic has been closed for replies.
Best answer by Tesla DeLorean

Yes 8N1 would work

Sending as

USART1->DR = data | 0x80;

Receiving as

data = USART1->DR & 0x7F;

3 replies

Tesla DeLorean
Guru
June 28, 2019

The stop bit is just a high bit, the UART shifts least significant bit first. Worst case you should be able to mask DR on reads, and OR on high bits on writes to DR

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
A Bravos
A BravosAuthor
Associate III
June 28, 2019

Thank you Clive Two.Zero for your response.

I think DR (reading / writing) means date? But what's the setup on CubeMx? 8bits N 1 or other option.

Thanks for the information

Bravos

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
June 28, 2019

Yes 8N1 would work

Sending as

USART1->DR = data | 0x80;

Receiving as

data = USART1->DR & 0x7F;

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
A Bravos
A BravosAuthor
Associate III
June 30, 2019

Thank you again Clive Two.Zero for your response.

It's working