LPUART transmit and receive data inside an interrupt

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

LPUART transmit and receive data inside an interrupt

2,673 Views
kasundinesh
Contributor II

Hi,

I m designing an event driven packet handler using LPUART and processor expert. I have two packet ques for transmission and reception. I have configured DMA to transfer packets. for example

void on_tx_complete(void *driverState, uart_event_t event, void *userData)

{

   GetPacketFromQue(&txbuff);

   LPUART_DRV_SendData(INST_LPUART1, (uint8_t *)txbuff, strlen(welcomeMsg));

}

But this is not working. But when i do it in the main loop, it works.

I have the same problem for reception. I have called LPUART_DRV_ReceiveData(INST_LPUART1, &rx_byte, 1UL); in the main loop to enable reception in interrupt. So i get the first byte inside the interrupt. But then i call LPUART_DRV_ReceiveData(INST_LPUART1, &rx_byte, 1UL);  inside the interrupt. it hangs and continuously executing the interrupt.  

void on_rx_complete(void *driverState, uart_event_t event, void *userData)
{
   LPUART_DRV_ReceiveData(INST_LPUART1, &rx_byte, 1UL);

}

But as long as in call this inside the main loop it works. 

Can any one help me on this. I want to build it in event driven mode. I want to enable reception and transmit data inside interrupts. Can you provide me an example or some guidance. I have attached the project below. I m using S32 DS and S32K144_SDK_gcc v0.8.6.

Thank you

Labels (1)
0 Kudos
Reply
1 Reply

1,869 Views
kasundinesh
Contributor II

Actually i fixed it by editing the lpuart_driver.c

pastedImage_1.png

Earlier it was under the callback function. But after i moved it above, it started working. Is there a specific reason to do it after the callback. Or was it designed to used with RTOS. Or is there any other workarounds for this?

0 Kudos
Reply