Dear All,
I have problem in receiving bytes in ISR see below code.
void UART3_RX_TX_IRQHandler(void)
{
UART_DRV_IRQHandler(3);
if(inx>9)
{
inx=0;
}
UART_HAL_Getchar(UART3, &RxBuff[inx]);
inx++;
}
I am sending 8 bytes (1,2,3,4,5,6,7,8) but first receiving is wrong RxBuff[0] =0xFF instead of 1 remaining 7 bytes are good.
MY TX & RX pins are short.
My suspect is RX interrupt is not enabled.
Thanks in advance
Regards
rishi
Hello Rishi Kumar:
There is no need to call the API UART_HAL_Getchar(). This is already done inside of UART_DRV_IRQHandler() and the Rx Buffer should be automatically filled with the received bytes, you only need to call the driver APIs UART_DRV_ReceiveData() or UART_DRV_ReceiveDataBlocking(). See the attached example I made for a FRDM-K64F. If you are using a different board just adjust the clock gate, uart instance and pins as required.
:smileyinfo: NOTE: This main.c assumes that the file fsl_uart_irq.c is already part of the project.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Dear Mr. Jorge ,
Thanks for support. It is working fine but In my case i don't know the receiving packet length.
So that I can read complete packet without losing bytes or mixing with next packet.
How i can check the SCI Idle status Flag in K64F? I need example for this too.
Thanks & regards
Rishi