Kinetis K60: 100MHz MK60DN256VLQ10 problem with UART5 ISR Rx Data

cancel
Showing results for 
Search instead for 
Did you mean: 

Kinetis K60: 100MHz MK60DN256VLQ10 problem with UART5 ISR Rx Data

231 Views
krunalpatel
Contributor I

Hi All,

I am using Kinetis K60: 100MHz  MK60DN256VLQ10 with MCUXpresso SDK 2.0 for UART Rx application.

I referred SDK Driver example code for Rx/Tx data, but I am facing problem with receiving data in ISR of UART5, via terminal I am writing 12 Bytes of data but in ISR I am able to receive only 2 bytes not 12 bytes, mean I am not able to receive bulk data for UART5

It is mentioned in Ref. Manual that UART2 to UART5 is having no FIFO, only having Doubled buffer, what it mean?

Please help me out this problem

Below is my ISR code:

/**************** UART Handler definition *******************/
void UART5_RX_TX_IRQHandler(void)
{
      if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART5))
      {
            uint8_t data = UART_ReadByte(UART5);
            printf("Rx :  %u \n", data);

      }
}

And UART5 Configurations :

int main()

{

uart_config_t config;

BOARD_InitPins();
BOARD_BootClockRUN();

UART_GetDefaultConfig(&config);
      config.baudRate_Bps = 9600U; // also tried 115200U
      config.parityMode = kUART_ParityDisabled;
      config.enableTx = true;
      config.enableRx = true;
      config.txFifoWatermark = 0;
      config.rxFifoWatermark = 1;

UART_Init(UART5, &config, CLOCK_GetFreq(kCLOCK_BusClk));

/* Enable RX interrupt. */

UART_EnableInterrupts(UART5, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable);
EnableIRQ(UART5_RX_TX_IRQn);

uint64_t k = 0;

while (1) {

   k++;

}

}

Thanks in advance

Labels (1)
0 Kudos
3 Replies

82 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi KRUNAL PATEL,

Please download the latest MCUXpresso SDK for MK60DN256VLQ10.
You can direct refer the uart_interrupt example in SDK_2.2.0_MK60DN256xxx10.(...\MK60DN256xxx10\boards\twrk60d100m\driver_examples\uart\interrupt)
The uart_functioncal_interrupt example shows how to use uart driver functional API to receive data with interrupt method:
In this example, one uart instance connect to PC through uart, the board will
send back all characters that PC send to the board.

uart_interrupt.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

82 Views
krunalpatel
Contributor I

Hi Robin,

Thanks for the reply.

I am using the same SDK Example ( See Attached File ), and even the your example is same as mine. Your attached example is Loopback one, so in that case you will never faced any issue of data losses, but here If I am writing 10 bytes of data into UART5 from HOST device ( Here It is Hyper Terminal ) without any delay, I'm facing an issue while receiving the UART data, i am getting only 2 bytes of data out of 10 bytes. 

If I am writing data byte by byte with some delay between two consecutive bytes I am able to receive correct data. 

If you have any serial communication example between  HOST Device - K60 Module, share it

Thnaks Again 

0 Kudos

82 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Sorry for my late reply!

Have you try to receive data into demoRingBuffer[]  in UART5_RX_TX_IRQHandler and send out after 10 bytes received in main?

You can find that example will check the UART state before send data: Send data only when UART TX register is empty and ring buffer has data to send out.

Or try to test:

void UART5_RX_TX_IRQHandler(void)
{
      if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(UART5))
      {
            uint8_t data = UART_ReadByte(UART5);

                     UART_WriteByte(DEMO_UART, data);

      }
}

Best Regards,

Robin

0 Kudos