UART Interrupt not tirggering from receive

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

UART Interrupt not tirggering from receive

Jump to solution
1,388 Views
kamal1
Contributor III

Hello,

 

 

 

I am using a custom board based off the MIMXRT1050-EVK demo board. I am currently trying to communicate with an external RFID board through port LPUART4. When I send a command through the RFID <BA 02 F0 48> I should receive back <BA 02 F0 48 BD 1A F0 00 53 4C 30 33 32 2D 32 2E 37 20 56 33 2E 31 2D 32 30 31 39 30 31 30 32 01>.

 

 

 

For some reason, I am getting all the data back besides the last byte "01". The 01 is not triggering the LPUART4 interrupt. I can manually read the LPUART4 data register after waiting at least 3 milliseconds and see the 01 but it never triggers the UART interrupt.

 

 

 

Any ideas on what may be happening?

 

 

 

//Initialize uart, set fifo levels, clear registers and interrupts.

void InitUart(volatile LPUART_Type *pUart)

{

LPUART_SoftwareReset(pUart); // cpu port

lpuart_config_t lpuartConfig;

lpuartConfig.baudRate_Bps = 115200U;

lpuartConfig.parityMode = kLPUART_ParityDisabled;

lpuartConfig.dataBitsCount = kLPUART_EightDataBits;

lpuartConfig.isMsb = false;

lpuartConfig.stopBitCount = kLPUART_OneStopBit;

lpuartConfig.txFifoWatermark = 0;

lpuartConfig.rxFifoWatermark = 1;

lpuartConfig.enableRxRTS = FALSE;

lpuartConfig.enableTxCTS = FALSE;

lpuartConfig.enableTx = true;

lpuartConfig.enableRx = true;

LPUART_Init(pUart, &lpuartConfig, 80000000U);

}

 

void test(void)

{

LPUART_EnableInterrupts(LPUART4, kLPUART_TxDataRegEmptyInterruptEnable | kLPUART_RxDataRegFullInterruptEnable);

EnableIRQ(LPUART4_IRQn); //@knxnew xint2

 

XmitCrt((uint8_t)0xBA);

XmitCrt((uint8_t)0x02);

XmitCrt((uint8_t)0xF0);

XmitCrt((uint8_t)0x48);

 

 

 

milisec(3); //if i dont wait at least 3miliseconds I wont see the 01

unsigned char data = LPUART_ReadByte(LPUART4); //read character and store in data

}

Tags (1)
0 Kudos
1 Solution
1,384 Views
kamal1
Contributor III

Found the issue.

lpuartConfig.rxFifoWatermark = 1;

The rx fifo was set to 1 which means it needs more than 1 byte to trigger the interrupt. I set it to 0 and that fixed my issue.

View solution in original post

0 Kudos
1 Reply
1,385 Views
kamal1
Contributor III

Found the issue.

lpuartConfig.rxFifoWatermark = 1;

The rx fifo was set to 1 which means it needs more than 1 byte to trigger the interrupt. I set it to 0 and that fixed my issue.

0 Kudos