8.2 UART Driver Example Source Code Reference
This file contains the API that implements the UART Example functionalities.
This file contains sample source codes to demonstrate the UART Foundation Services APIs.
For this example application to work the following needs to be done:
- Configure the EUSART module as follows:
- Enable EUSART: ticked
- Enable Transmit: ticked
- Enable Receive: ticked
- Enable EUSART Interrupts: ticked
- Redirect STDIO to USART: ticked
- Configure other settings as desired.
- Select TX and RX pins in Pin Manager: Grid View.
- Connect the board to a laptop serial port.
- Open a serial port terminal application (i.e. PuTTY or TeraTerm)
- Configure the serial port application to the following settings:
- Baud Speed: same as the UART configuration
- Data: same as the UART configuration
- Parity: none
- Stop bits: same as the UART configuration
- Flow control: none
- Receive: Carriage Return
- Transmit: Carriage Return
- Local Echo: On
- Call UART_example_<USE_CASE>() from main().
This example works like this:
- Upon reset, the application will display "START" to test UART_Write function.
- The program will then print the following to test printf support: Hello World! 1 Hello World! 2 Hello World! 3
- The program will then display "Receive test: Type a message then press enter (max 16 chars):"
- Type a message no longer than 16 characters.
- The program will then print "You typed:" and echo back your message. This will ensure that the UART_Read function is working.
- If everything is working fine, the program will print "OK."
Note: To test other instances, feel free to modify this file.