AnsweredAssumed Answered

Code example for UART receive?  ReceiveDataBlocking, or with a callback function?

Question asked by John Beale on Jul 24, 2015
Latest reply on Jul 27, 2015 by John Beale

I am using Kinetis Design Studio 3.0.0 on Win7 and my target is Kinetis MKL16Z32VFT4.  I have lpsciCom1 / UART0 set up through Processor Expert, I am using 256000 baud 8/N/1 and the UART transmit side works fine with such commands as:


  LPSCI_DRV_SendDataBlocking(FSL_LPSCICOM1, outString, length, 50);  // port, buffer, # bytes, timeout


I am having trouble with understanding how the UART Receive function should work.  For example, if I do

  status = LPSCI_DRV_ReceiveDataBlocking(FSL_LPSCICOM1, rxString, 2, 50);  // receive serial data from external control device


the return 'status' value is always 0, regardless if anything was received or not. How do I know how many bytes have been received, if any?


I gather there is way to receive data using a callback function, but I have been unable to find any simple examples of such code. I have a very simple application, without any RTOS.