2017-07-31 04:36 AM
Hi, I am working on my project which requires to send some data over UART.
I have F429ZI Nucleo board with a UART2 configured (see uart2_config image). The UART2 has Interrupts enabled so I can use the HAL_UART_Transmit_IT function.
I am passing an array of uint8_t values. Only 4 bytes. The bytes are getting transmitted via the TX pin as expected, but only 7 bits per byte are transmitted. (see tx_8_bits_no_parity image).
So I got into the F429xx datasheet (
) and on page 994 the Table 146 clearly states that when the bits M (length = 8bits) and PCE (parity = None) are reset, the UART frame will be: Start Bit, 8 data bits, Stop Bit.Why is MCU sending only 7 bits when no parity is enabled? So I decided to enable parity in CubeMX and set it to Even.
However, the parity bit just takes up one of the 8 bits, making the data only 6 bits! (see tx_8_bits_even_parity image).
The same table 146, clearly states that the MCU should be sending 7 Data bits and not 6.
How can this be? Am I missing something? I am only trying to send 8 bits of data (0x00 - 0xFF) without parity.
Any advise would be appreciated.
Thanks.
#uart #bug #f4 #cube-mx #halSolved! Go to Solution.
2017-08-01 06:34 AM
That decoder was written by somebody who does not quite understand how UART works.
The stopbit is transmitted as a whole bit, but it is received by sampling it in its middle (usually with the 3x oversampling). Start bit falling edge detection commences immediately after that. The consequence is, that even if the transmitter's actual bit time is slightly above the receiver's (here: your 'detector''s) expected bit time, the receiver still works flawlessly.
JW
2017-08-01 07:51 AM
Hi,
Having checked and double-checked the decoder (who's Pico name I will not mention), it seems that it's decoder does not correctly understand the Stop Bit.
Thank you for all your help/info.
Much appreciated.
2017-08-01 07:52 AM
Decoder it was. Thank you for you wisdom.
Kind regards