LPUART 9 bits data mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPUART 9 bits data mode

Jump to solution
1,007 Views
Ming
Contributor III

Under Component Inspector window, I had lpuart1 configured with 9 bits data, and parity mode disabled. The 9th bit is utilized as address wake up. I was unable to  set the 9th bit to high for the first byte in my data packet. The API LPUART_DRV_SendData() only allows me to send 8-bits data byte. I was trying to use LPUART_BWR_CTRL_R9T8() to set T8 bit to "1" but it didn't work, the 9th bit is still read as "0". How do I set the initial byte's 9th bit to "1" and clear it to "0" for the subsequent bytes? The following is the start of my transmission and obviously it doesn't work.

 

                LPUART_BWR_CTRL_R9T8(base, 1); // set 9th bit to 1, that's my intention

 

                LPUART_DRV_SendData(FSL_LPUARTCOM1, &txBuff1, 1U);  // Send first byte

                lpuartState->isTxBusy = true;

 

               // Tx interrupt enabled

                LPUART_HAL_SetIntMode(base, kLpuartIntTxDataRegEmpty, true);

                LPUART_HAL_SetIntMode(base, kLpuartTxComplete, true);

Labels (1)
0 Kudos
1 Solution
753 Views
Ming
Contributor III

It doesn't help. I was never able to set the R9T8 bit in the CTRL register. However, there is another way to transmit 9 bits or 10 bits data byte (for anyone who actually use 10 bits data mode, this ticket can be helpful too) which I found out after several days of debugging. The Data register is 16 bits addressable. So you can simply load your 10 bits uint16_t variable into the DATA register without bothering R9T8 or R8T9 bits at all.

View solution in original post

0 Kudos
3 Replies
753 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

In the LPUART config data, if it select to use 9-bit data characters:

.bitCountPerChar = kLpuart9BitsPerChar,

Wish it helps.
Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
754 Views
Ming
Contributor III

It doesn't help. I was never able to set the R9T8 bit in the CTRL register. However, there is another way to transmit 9 bits or 10 bits data byte (for anyone who actually use 10 bits data mode, this ticket can be helpful too) which I found out after several days of debugging. The Data register is 16 bits addressable. So you can simply load your 10 bits uint16_t variable into the DATA register without bothering R9T8 or R8T9 bits at all.

0 Kudos
753 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Yes, you are right.

The KL27 LPUART chapter with below description about <8-bit, 9-bit,10-bit data mode>:

For coherent 8-bit writes to the transmit data buffer, write to LPUART_CTRL[T8] and LPUART_CTRL[T9] before writing to LPUART_DATA[7:0]. For 16-bit and 32-bit

writes to the LPUART_DATA register all 10 transmit bits are written to the transmit data buffer at the same time.

The LPUART_DATA register with 16-bit write will make the same result.

Thank you for the attention.


Have a great day,
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos