2019-06-28 09:04 AM
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.
Solved! Go to Solution.
2019-06-28 12:08 PM
Yes 8N1 would work
Sending as
USART1->DR = data | 0x80;
Receiving as
data = USART1->DR & 0x7F;
2019-06-28 09:14 AM
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
2019-06-28 10:04 AM
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
2019-06-28 12:08 PM
Yes 8N1 would work
Sending as
USART1->DR = data | 0x80;
Receiving as
data = USART1->DR & 0x7F;
2019-06-30 12:09 AM
Thank you again Clive Two.Zero for your response.
It's working