MCUXpresso SDK Documentation

usart_transfer_sync_b2b_master

usart_transfer_sync_b2b_master#

Overview#

The usart_interrupt_sync_transfer example shows how to use usart API in synchronous mode:

In this example, one usart instance will be selected as master ,and another as slave. The master will send data to slave in polling way, and slave will receive data in nonblocking way. After all data has been received by slave, info will be printed by debug console.

Supported Boards#

LPCXpresso802
Hardware requirements
  • Mini/micro USB cable

  • LPCXpresso802 board

  • Personal Computer

Board settings

Please connect the USART1_CLK pin to USART2_CLK pin directly. No need to connect other pins. The data pins are shared.

Master - USART1                Slave - USART1   

Pin Name Board Location Pin Name Board Location
TXD CN3 pin 21 RXD CN3 pin 19
RXD CN3 pin 19 TXD CN3 pin 21
SCK CN3 pin 22 SCK CN3 pin 22

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the CMSIS DAP USB port on the board

  2. Open a serial terminal with the following settings:

    • 9600 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The log below shows the output of the hello world demo in the terminal window:

Usart synchronous transfer example.
Master USART will send data to slave on one board.
All data matched, data transfer success!

LPCXpresso804
Hardware requirements
  • Mini/micro USB cable

  • LPCXpresso804 board

  • Personal Computer

Board settings

Please connect the USART1_CLK pin to USART1_CLK pin directly. No need to connect other pins. The data pins are shared.

Master - USART1                Slave - USART1   

Pin Name Board Location Pin Name Board Location
TXD CN3 pin 10 RXD CN3 pin 9
RXD CN3 pin 9 TXD CN3 pin 10
SCK CN8 pin 2 SCK CN8 pin 2

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the CMSIS DAP USB port on the board

  2. Open a serial terminal with the following settings:

    • 9600 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The log below shows the output of the hello world demo in the terminal window:

Usart synchronous transfer example.
Master USART will send data to slave on other board.