1.11 FLEXCOM USART Flow Control
This example application shows how to use the FLEXCOM module in USART flow control mode.
Description
This application configures FLEXCOM0 in non-blocking mode and FLEXCOM1 in blocking mode. FLEXCOM0 is used for data transmission and FLEXCOM1 is used for reception. The TX line of FLEXCOM0 is connected to the RX line of FLEXCOM1. The RTS line of FLEXCOM1 is connected to the CTS line of FLEXCOM0. FLEXCOM0 transmits 100 characters using interrupts. Application however simulates a slow receiver by inserting a delay after each character is read on FLEXCOM1. As a result, once the RX FIFO is full, the RTS line is de-asserted and transmitter (FLEXCOM0) stops sending the data. Eventually, when the receiver reads out sufficient number of bytes from the RX FIFO, such that the number of bytes in the FIFO goes below RXFTHRES2, the RTS line is again asserted and the transmitter continues sending the data. The demo application indicates success if the received data matches the transmitted data.
Downloading and Building the Application
To clone or download this application from Github, go to the main page of this repository and then click Clone button to clone this repository or download as zip file. This content can also be downloaded using content manager by following these instructions.
Path of the application within the repository is apps/flexcom/usart/flexcom_usart_flow_control/firmware.
To build the application, refer to the following table and open the project using its IDE.
Project Name | Description |
---|---|
sam_a5d29_curiosity.X | MPLABX project for SAMA5D29 Curiosity Development Board Kit |
Setting Up AT91Bootstrap Loader
To load the application binary onto the target device, we need to use at91bootstrap loader. Refer to the at91bootstrap loader documentation for details on how to configure, build and run bootstrap loader project and use it to bootstrap the application binaries.
Setting Up the Hardware
The following table shows the target hardware for the application projects.
Project Name | Description |
---|---|
sam_a5d29_curiosity.X | SAMA5D29 Curiosity Development Board Kit |
Setting Up SAMA5D29 Curiosity Development Board
- Connect the UART Debug port on the board to the computer using a FTDI to USB cable
- Connect the Debug USB port on the board to the computer using a Type-C USB cable
- Make connections as following:
- Short pin 5 (FLEXCOM1_TXD) of J8 connector to pin 21 (FLEXCOM4_RXD) of J25 connector.
- Short pin 6 (FLEXCOM1_CTS) of J8 connector to pin 26 (FLEXCOM4_RTS) of J25 connector.
Running the Application
- Build the application using its IDE
- LED is turned ON on success.
Board | LED Name |
---|---|
SAMA5D29 Curiosity Development Board | RGB_LED (Green) |