Jump to main content

# 1.12 FLEXCOM USART Flow Control

This example application shows how to use the FLEXCOM module in USART flow control mode.

## Description

This application configures FLEXCOM11 in Non-blocking mode and FLEXCOM8 in Blocking mode. FLEXCOM11 is used for data transmission and FLEXCOM8 is used for reception. The TX line of FLEXCOM11 is connected to the RX line of FLEXCOM8. The RTS line of FLEXCOM8 is connected to the CTS line of FLEXCOM11. FLEXCOM11 transmits 100 characters using interrupts. Application however simulates a slow receiver by inserting a delay after each character is read on FLEXCOM8. As a result, once the RX FIFO is full, the RTS line is de-asserted and transmitter (FLEXCOM11) 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.

To build the application, refer to the following table and open the project using its IDE.

Project Name | Description
--- | ---
sam_a7d65_curiosity.X | MPLABX project for SAMA7D65 Curiosity Board
sam_a7d65_curiosity_pro.X | MPLABX project for SAMA7D65 Curiosity Pro Board

## 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_a7d65_curiosity.X | SAMA7D65 Curiosity Board
sam_a7d65_curiosity_pro.X | SAMA7D65 Curiosity Pro Board

### Setting Up SAMA7D65 Curiosity Board

Setting up the board:

- Connect the USBA port J3 on the board to the computer using a Type-C USB cable (to power the board)
- Make connections as following:
  - Connect mikroBUS1 pin 3 to RPi connector 26 pin
  - Connect RPi connector pin 19 to RPi connector pin 10

### Setting Up SAMA7D65 Curiosity Pro Board

Setting up the board:

- Connect the USBA port J1 on the board to the computer using a Type-C USB cable (to power the board)
- Make connections as following:
  - Connect mikroBUS1 pin 3 to RPi connector 26 pin
  - Connect RPi connector pin 19 to RPi connector pin 10

## Running the Application

1. Build the application using its IDE.
2. LED is turned ON on success.

The following table provides the LED name:

Board | LED Name
--- | ---
SAMA7D65 Curiosity Board | RGB_LED (Green)
SAMA7D65 Curiosity Pro Board | RGB_LED (Green)

Rev: C