Using AT Commands via USB Interface

Overview

In Host Control Mode, the USB peripheral interface is used for data transmission to fulfill plug-and-play and high compatibility requirements.

The master device and AT device connect in the following modes:

  • Mode 1: Master as USB Host, AT device as USB Device

  • Mode 2: Master as USB Device, AT device as USB Host

Both parties use the USB CDC-ACM protocol for AT command interaction. Configuration steps:

Note

  • USB Mode parameter definition in atcmd_config.json:

    • 0: USB Device

    • 1: USB Host

  • This parameter must match the configuration in Menuconfig.

Master Reference Examples

Select the corresponding example based on the master role:

These examples demonstrate full USB host-device communication flow. It is recommended to run these code samples before development to verify connection and configuration correctness. Subsequently, adapt them to specific MCU platforms based on the reference code.

The example code adds a UART task to receive AT commands and print responses. Overall data flow:

../../_images/usb_at_data_flow.svg

Note

  • USB Host initialization requires waiting for device enumeration to complete.

Communication Speed

For USB link speed testing, refer to AT+TEST command.

Note

USB link speed is affected by:

  • AT module’s USB role (Host/Device)

  • AT module’s supported USB speed mode (Full-Speed/High-Speed)