This example demonstrates the Synchronous mode provided by the USART peripherals on SAM.
This example can be used on all SAM EK boards and requires 2 boards to be connected directly through populated USART pins.
- master – slave
- TXD(PA22) – RXD(PA21)
- RXD(PA21) – TXD(PA22)
- SCK(PA23) – SCK(PA23)
GND – GND
This application gives an example of how to use USART in synchronous mode. Synchronous operations provide a high speed transfer capability. The transfer under this mode needs a pair of master and slave, which is determined by which one offers the clock source.
The example initializes USART as master by default. To enable the communication between each side of the connection, the user should change the mode of another side to slave through user interface. If well configured, transfer could be started by typing 'r' and 'w' from terminal application. This example also leaves the interface to select the clock freq.
The meaning of each input character could be found in items of the main menu.
- Build the program and download it into the two evaluation boards.
- Connect a serial cable to the UART port for each evaluation kit.
- On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft Windows) with these settings:
- 115200 bauds
- 8 data bits
- No parity
- 1 stop bit
- No flow control
- Start the application. The following traces shall appear on the terminal:
* -- USART Synchronous Mode Example --
* -- xxxxxx-xx
* -- Compiled: xxx xx xxxx xx:xx:xx --
* -- Menu Choices for this example --
* -- [0-3]:Select clock freq of master --
* -- i: Display configuration info
* -- w: Write data block .--
* -- r: Read data block.--
* -- s: Switch between master and slave mode.--
* -- m: Display this menu again.--
* --USART in MASTER mode--
- The main menu will guide the user to configure the device and conduct operations.