Question on using UART

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

Question on using UART

1,206 Views
pidgeydoyle
Contributor II

Hi everyone,

 

I'm new to Kinetis uCs and I have a few questions in relation to UART on the FRDM_K64 board.

I've been able to make use of the 3 demo apps provided and they are very useful but I'm feeling a bit confused.

The 3 different UART types provided are:

Blocking - doesn't return until receive/transmit is complete.

Non-Blocking - returns immediately.

Polling - checks to see if data is available.

 

but couldn't it be the case that a device could be set up as polling and blocking or polling and non-blocking?

 

I've only dealt with UART in PICs where the RX UART was interrupt driven, where a flag is set that can be read in the while loop to check if new UART data is available.

Are the demo apps also interrupt driven (apart from the polled example obviously) or do I need to implement this separately?

 

Thanks,

 

P

Labels (1)
0 Kudos
2 Replies

836 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Peter Doyle:

I guess you mean the KSDK examples. The examples you mentioned are structured as next:

- uart_blocking_example: This waits until the transfers initiated by UART_DRV_SendDataBlocking() are completed. This example uses interrupts, not polling.

- uart_non_blocking_example: In this example, there are calls to UART_DRV_SendData() and UART_DRV_ReceiveData(), but the application does not wait for the transfers (Tx or Rx) to complete. This example also uses interrupts.

- uart_polling_example: In this case, the interrupts are disabled and the application calls the API UART_HAL_SendDataPolling(), which works in a "blocking" way. This would be your "polling and blocking" case. There is not a similar example which is "poling and non blocking".

There are also examples using DMA (uart_edma_blocking and uart_edma_non_blocking).

The KSDK UART driver is based on interrupts, so you can see that the polling example is made with the UART HAL layer instead.

Just as stated by Mark, the driver examples are meant to show the basic configuration and usage of the KSDK platform (DRV and HAL APIs), but there is a lot more functionality in the UART peripheral itself. KSDK drivers intend to cover common use cases, but if the driver does not fit your requirements then you can either customize it or use the HAL layer directly.

I hope this clarifies a bit. Let me know if you have questions.


Regards!,
Jorge Gonzalez

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

0 Kudos

836 Views
mjbcswitzerland
Specialist V

Hi Peter

The UARTS are powerful, with interrupt and DMA support, whereas the examples in the demos are simple starting points and not to be taken too seriously as to what limitations apply and possibilities exist.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K64: http://www.utasker.com/kinetis/FRDM-K64F.html / http://www.utasker.com/kinetis/TWR-K64F120M.html / http://www.utasker.com/kinetis/TWR-K65F180M.html

UARTs: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

Low power with UARTs: https://community.freescale.com/message/421247#421247

Serial Bootloader for K64 (Ethernet, USB, MSD, KBOOT, AN2295, SREC, SD-card, Memory Stick, Virtual COM SREC): http://www.utasker.com/forum/index.php?topic=1873.msg6796#msg6796 / http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos