How to Use AT Command with SDIO

Overview

In Host Control Mode, when high performance and throughput are required, the SDIO peripheral interface can be used for data transfer.

The host device acts as the SDIO Host, and the AT device acts as the SPI Device. The two parties exchange AT command data through the SDIO protocol.

Refer to AT Configuration Modification to set up the SDIO peripheral interface.

Pin Description

The SDIO interface supports both one wire and four wire modes, and the required pins are as follows:

  • One line mode (mandatory): CMD, CLK, DATA0, DATA1

  • Four wire mode (optional): DATA2, DATA3

  • GND

Refer to AT Configuration Modification to modify group of pins.

Host Reference Example

https://github.com/Ameba-AIoT/ameba-rtos/tree/master/component/example/atcmd_host/atcmd_sdio_host

The Host example code is based on the STM32F429 platform and demonstrates the communication process between the SDIO host and the device. Please refer to {SDK}/component/example/atcmd_host/atcmd_sdio_host/STM32/README.md and use Keil5 for compilation and burning. It is recommended to run this example before formal development to validate the connection and configuration.

The code includes a UART task for receiving AT commands and printing AT responses. The overall data flow diagram is shown below:

../../rst_rtos/0_at_command/figures/sdio_at_data_flow.svg

Note

  • During SDIO host initialization, the SDIO protocol configuration is implemented, including 1-bit or 4-bit bus mode selection and SDIO clock frequency optimization

  • SDIO host initialization must await device initialization completion before proceeding.

  • In case of transmission/reception errors, both host and device must perform SDIO re-initialization.

Communication Format

When transmitting or receiving data via SDIO AT commands, the following format specification must be followed:

Tx Descripter (16 bytes)

Data (Data Len bytes)

Rx Descripter (16 bytes)

Data (Data Len bytes)

Where:

Tx Descripter:

Fixed header for transmitted data, primarily containing information such as data length.

Rx Descripter:

Fixed header for received data, primarily containing information such as data length.

Note

For specifics on what needs to be populated in Tx/Rx Descripter and how to interpret it, refer to the implementation in the Host Reference Example.

Communication Rate

To test the SDIO link rate, refer to AT+TEST command.

Note

Due to the differences in the process of sending and receiving data on the host side of the SDIO protocol, the protocol overhead for receiving data is higher, so the downlink rate will be significantly lower than the uplink rate.