2021-12-13 02:09 AM
2021-12-13 02:32 AM
"7N1" usually means 1 start bit, and I haven't seen any UART / RS232 like interface without a start bit in the last 20 years - but I haven't seen all! ;)
Anyway, I can't check the F429, but I just see that only the newer STMs have the 7N1 options (checked: STM32G4, STM32F7 ref manuals).
So that might get tricky, if you cannot switch the STM, on the other hand surely possible, as Modbus is rather slow (9k6?).
2021-12-13 02:46 AM
"7N1" means: 7 data, no parity and 1 stop bit. All uart communication uses 1 start bit - this has allways been so. But that is not the question.
How do I setup the STM32F429 to read the incomming modus with the framing 7N1, without getting framing errors, etc.
2021-12-13 03:58 AM
bit 7 will act as your stop bit when sending and receiving single bytes. When sending and receiving multi-bytes, you will need to think of all the data as one big bit string and use it in 7-bit chunks. the extra stop bits shouldn't be a big problem.
You can also switch to one of the STM32's MCUs that support 7-bit UART (eg STM32F7,H7,L4)
2021-12-13 05:42 AM
Ok, thanks for the reply. But.... the incomming data stream is 7N1 - which means (if the STM is programmed to 8 data, No parity) the incomming stop bit databit will be treated as the 8th - and the STM uart will be missing a stopbit - which will be a framing error doc according to Reference manual RM0090, page 977: "The stop bit is not recognized on reception at the expected time". A quick test gives USART_SR_FE - framing errors.
2021-12-13 06:09 AM
The UART in the STM32F4 can have either 8 or 9 data bits (including parity). 7-N-1 is not a supported configuration.
See the USART_CR1 register for details.
2021-12-13 06:31 AM
This should work if you set up the STM's UART without a stop bit, as @Muhammed G�ler proposed.
Just mask the last bit (MSB) of each received byte.
2021-12-13 06:37 AM
It is not possible to set up a UART on the STM32F4 without a stop bit.
2021-12-13 06:37 AM
Usart can't be setup without stopbits. I was looking for confirmation of my setup and the errors I see, so thanks to TDK for Your answer.
2021-12-13 06:51 AM
Oops, my bad. I'd better shut up about controllers I don't know...