USART_SyncCommunication_FullDuplex_IT_Init Example Description

Configuration of GPIO, USART, DMA and SPI peripherals to transmit bytes between a USART and an SPI (in slave mode) in Interrupt mode. This example is based on the STM32C0xx USART LL API (the SPI uses the DMA to receive/transmit characters sent from/received by the USART). The peripheral initialization uses LL unitary service functions for optimization purposes (performance and size).

This example works with only one NUCLEO-C071RB.

USART1 Peripheral is acts as Master using IT. SPI1 Peripheral is configured in Slave mode using DMA. GPIO associated to User push-button is linked with EXTI.

Example execution:

LED1 is blinking Fast (200ms) and wait User push-button action. Press User push-button on BOARD start a Full-Duplex communication from USART using IT. On USART1 side, Clock will be generated on SCK line, Transmission done on TX, reception on RX. On SPI1 side, reception is done through the MOSI Line, transmission on MISO line.

At end of transmission, both received buffers are compared to expected ones. In case of both transfers successfully completed, LED1 is turned on. In case of errors, LED1 is blinking Slowly (1s).

Keywords

Connectivity, UART/USART, Synchronous, Interrupt, SPI interface, Receiver, Transmitter, full-duplex

Directory contents

Hardware and Software environment

Board connector:

How to use it ?

In order to make the program work, you must do the following :