Hi,
I am using the LPSCI of KL36.I use the example ...\examples\frdmkl46z\driver_examples\lpsci\lpsci_blocking.
1) The SCI is OK when configuring SCI as fellow shown.The data that is sent to the software in my computer is correct.
lpsci_user_config_t lpsciConfig = {
#if defined(KL02Z4_SERIES)
.clockSource = kClockLpsciSrcFll,
#else
.clockSource = kClockLpsciSrcPllFllSel,
#endif
.bitCountPerChar = kLpsci8BitsPerChar,
.parityMode = kLpsciParityDisabled,
.stopBitCount = kLpsciOneStopBit,
.baudRate = BOARD_DEBUG_UART_BAUD
};
2) But it is not OK when I change ".parityMode = kLpsciParityDisabled," to ".parityMode =kLpsciParityEven".
The data that is sent to the software in my computer is not correct. The software in my computer is also configured as "ParityEven".
Hi Robin,
Please bitCountPerChar to kLpsci9BitsPerChar, the configuration code should like this:
// Fill in lpsci config data
lpsci_user_config_t lpsciConfig = {
#if defined(KL02Z4_SERIES)
.clockSource = kClockLpsciSrcFll,
#else
.clockSource = kClockLpsciSrcPllFllSel,
#endif
.bitCountPerChar = kLpsci9BitsPerChar,//kLpsci8BitsPerChar,
.parityMode = kLpsciParityEven,//kLpsciParityDisabled,
.stopBitCount = kLpsciOneStopBit,
.baudRate = BOARD_DEBUG_UART_BAUD
};
Then test it again, your PC will receive the correct data.
Reason: if you enable the parity mode, and still select 8-bit Mode, because the parity still one bit, then the data in the uart wave will be 7 bit data+1 bit parity.
Anyway, when you want to use the parity mode, please select 9 bits mode.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------