Lpuart transmit size issue

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

Lpuart transmit size issue

857 Views
Amruta
Contributor I

Hello Team,

I'm using MBT toolbox for serial implementation using LPUART. I have configured the data size of LPUART_Receive block as 16 bytes and i want to transmit only 12 bytes. But as the size of the LPUART_Receive block is 16, size for transmit buffer also gets configured to 16.

Need support on configuring data size for transmit block. 

Regards,

Amruta

0 Kudos
3 Replies

703 Views
Amruta
Contributor I

Hello Marius,

I have created a logic for transmitting 16 or 12 bytes of data depending on the received message using LPUART blocks. After flashing this code, following scenarios are checked on the board:

1.S32k144 receives a message from terminal and requires to transmit response message of 12 bytes to the terminal. Board is able to transmit 12 bytes.

2.In next iteration, for next received message from terminal, board should transmit response of 16 bytes length. In this iteration, The message received on my terminal is always 12bytes length even when 16 bytes are expected.

3. After pressing reset button of the board, if i send message from terminal which requires 16 bytes as response, then i can see 16 bytes message on terminal.

It's like every time i need to press reset button to receive data from for the new set of transmitted message from terminal. Please find the screenshot attached as a sample of the issue. I want to disable transmit once data is transmitted and again enable the buffer if new data is received. 

Please suggest how I can implement this using MBT toolbox.

Thanks,

Amruta 

0 Kudos

812 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @Amruta,

Can you please tell me which toolbox are you using, the version, and the platform?

Generally, the UART receive blocks require a number of characters to wait for. If you specify 16 characters, then the block will wait until it received all those 16 characters, and then triggers a Simulink subsystem, handled by our interrupts block. For a variable number of characters to be received, you can specify the least common multiple of the received message length and inside the interrupt to use again the receive blocks to trigger the next number of the characters if the message was not complete. You can do this process also character by character.

Hope this helps,

Marius

0 Kudos

732 Views
Amruta
Contributor I

Hello Marius,

Thank you for your response. 

If I'm taking multiple of size 4, how I can check with the block set if my next set of 4 bytes is received or not? Is there any other block which could be used for checking the status of new set of bytes? 

Waiting for your response.

Thanks,

Amruta

0 Kudos