To use the UART driver to send data or receive, the application calls the following APIs:
UART_lld_init() must be called before any other UART APIs. This function uses uart handle to initialize each instance. Calling UART_lld_init() a second time with the same handle previously passed to UART_lld_init() will result in an error. You can, though, re-use the handle if the instance is closed via UART_lld_deInit(). In DMA mode, UART_lld_initDma() needs to be called instead of UART_lld_init() to acquire and initialize uart instance. Please note that initializing UART driver is taken care by the SysConfig generated code.
The UART driver supports two transfer modes of operation: interrupt and polling mode. In polling mode a task's code execution is blocked until a UART transaction has completed or a timeout has occurred.
In interrupt mode, again there are two modes blocking and callback. The UART driver defaults to blocking mode, if the application does not set it. Once a UART driver is opened, the only way to change the operation mode is to close and re-open the UART instance with the new write mode.
In callback mode, a UART transaction functions asynchronously, which means that it does not block code execution. After a UART transaction has been completed, the UART driver calls a user-provided callback function. Callback mode is supported in the execution context of tasks and hardware interrupt routines.
The UART driver supports two read modes of operation: interrupt and polling mode. In polling mode a task's code execution is blocked until a UART transaction has completed or a timeout has occurred.
In interrupt mode, again there are two modes blocking and callback. The UART driver defaults to blocking mode, if the application does not set it. Once a UART driver is opened, the only way to change the operation mode is to close and re-open the UART instance with the new read mode.
In callback mode, a UART transaction functions asynchronously, which means that it does not block code execution. After a UART transaction has been completed, the UART driver calls a user-provided callback function. Callback mode is supported in the execution context of tasks and hardware interrupt routines.
Include the below file to access the APIs
Instance Open Example
Instance Close Example
Write Non-Blocking Transfer Example
Read Non-Blocking Transfer Example
Non-Blocking Example write callback
Non-Blocking Example read callback
Non-Blocking Example ISR CALL callback