9 bit LPUART messages for S32k144

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

9 bit LPUART messages for S32k144

1,113件の閲覧回数
Math412
Contributor I

Hello,

I'm new to S32 and the S32k144 board. 

I want to transmit a message with a length of 9 bits and not 8 bits, except parity bit in UART (via LPUART) on a S32k144 board. I made the change in the configuration of LPUART (from 8 to 9 bits). However the functions SendData and ReceiveData take only a buffer and a message of type uint_8t. I tried to change in the LPUART drivers all the definitions of the buffer of reception and transmission by types uint16_t in vain.

Is there any other method? Is there any other way to use LPUART with a 9 bits message without changing all the drivers?

 

Thank you

 

Math

タグ(2)
0 件の賞賛
返信
3 返答(返信)

1,103件の閲覧回数
Math412
Contributor I

Hello Daniel,

First of all, thank you for your response. Your indications helped me. However, I still can't transmit a 9-bit char.

As indicated in the LPUART documentation, I have set the number of transmitted bits to 9 and parity disabled in the configuration. I also used the Polling communication functions as indicated in the documentation.

However, I don't understand one element: the buffer which must be even. So I wrote below some examples of what I wrote in my project, to know where I'm wrong and misunderstand the documentation, if you can have a look.

int main(void)
{
uint16_t RED = 0x103;
uint16_t txBuffer[2] = {0x03,0x03};
uint16_t rxBuffer;
}
while(1)
{
LPUART_DRV_SendDataPolling(INST_LPUART2, &RED, 1);
LPUART_DRV_SendDataPolling(INST_LPUART2, &txBuffer, 2);
LPUART_DRV_ReceiveDataPolling(INST_LPUART2,&rxBuffer,1);
}

I obtain with this code an error during the debug in devassert.h.

 

Best regards

Math

0 件の賞賛
返信

1,098件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Math412,

We can use the same code for both 8bit and 9bit transfers.

uint8_t txBuff[2] = {0x55, 0x55};
uint32_t length = 2;
uint32_t bytes = 0;

LPUART_DRV_SendData(INST_LPUART1, txBuff, length);
while(LPUART_DRV_GetTransmitStatus(INST_LPUART1, &bytes) == STATUS_BUSY);

8bit transfer

danielmartynek_0-1647431120492.png

danielmartynek_4-1647431643755.png

9bit trasnfer

danielmartynek_2-1647431290629.png

danielmartynek_3-1647431531842.png

 

Regards,

Daniel

 

 

 

0 件の賞賛
返信

1,110件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Math,

There is no need to modify the LPUART driver, it should work with 8bit pointers.

Please refer to the documentation of the driver:

danielmartynek_0-1647358181563.png

danielmartynek_1-1647358251488.png

 

Regards,

Daniel

 

0 件の賞賛
返信