cancel
Showing results for 
Search instead for 
Did you mean: 

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

A Bravos
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Yes 8N1 would work

Sending as

USART1->DR = data | 0x80;

Receiving as

data = USART1->DR & 0x7F;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
A Bravos
Associate III

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

Yes 8N1 would work

Sending as

USART1->DR = data | 0x80;

Receiving as

data = USART1->DR & 0x7F;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
A Bravos
Associate III

Thank you again Clive Two.Zero for your response.

It's working