AnsweredAssumed Answered

LPUART transmit and receive data inside an interrupt

Question asked by Kasun Dinesh on May 11, 2018

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

Attachments

Outcomes