USB DTE plugin for esp_modem component


# USB DTE plugin for esp_modem [![Component Registry](]( > :warning: **Experimental feature**: USB DTE is under development! This component extends [esp_modem]( with USB DTE. ## Examples For example usage see esp_modem examples: * [console example]( * [PPPoS example]( ## USB hot-plugging and reconnection USB DTE supports device reconnection and hot-plugging. You must only register callback function for `DEVICE_GONE` event and react accordingly: C++ with lambda callback: ```cpp auto dte = create_usb_dte(&dte_config); dte->set_error_cb([&](terminal_error err) { if (err == terminal_error::DEVICE_GONE) { // Signal your application that USB modem device has been disconnected } }); ``` C: ```c static void usb_terminal_error_handler(esp_modem_terminal_error_t err) { if (err == ESP_MODEM_TERMINAL_DEVICE_GONE) { // Signal your application that USB modem device has been disconnected } } esp_modem_dce_t *dce = esp_modem_new_dev_usb(ESP_MODEM_DCE_BG96, &dte_usb_config, &dce_config, esp_netif); esp_modem_set_error_cb(dce, usb_terminal_error_handler); ``` ## Dual port modems Some modems provide two equivalent AT ports. One of the ports can be used for AT commands, while the other one can be used for network data. This way, you don't have to switch between command and data modes of one terminal. To use this feature, specify interface number of the second port in `esp_modem_usb_term_config`. ## Adding a new modem For simple cases with one AT port, you should be able to open communication with the modem by defining: 1. **USB VID and PID:** This can be found by plugging the modem to a PC and running `lsusb -v` on Linux or by [USB Device Tree Viewer]( on Windows. 2. **AT port interface number:** USB modems have usually multiple CDC-ACM-like ports. One (or two) is dedicated for AT commands. You can find the correct interface number based on its string descriptor (using methods from point 1), from the modem's datasheet or by trial and error. Then, you can pass these constants to [ESP_MODEM_DEFAULT_USB_CONFIG]( macro and start testing AT commands. ## List of tested modems The following modems were tested with this component, their configurations can be found in [esp_modem_usb_config.h]( * Quactel BG96 * SimCom SIM7600E * SimCom A7670E


## 1.0.0 - Initial version ## 1.1.0 - Update to [CDC-ACM driver]( to v2 - Provide default configurations for tested modems - Fix USB receive path bug, where received data could be overwritten by new data - Initial support for modems with two AT ports


Supports all targets

License: Apache-2.0

To add this component to your project, run: add-dependency "espressif/esp_modem_usb_dte^1.1.0~1"

or download archive


  • espressif/esp_modem >=0.1.28,<2.0.0
  • espressif/usb_host_cdc_acm 2.*
  • ESP-IDF >=4.4
  • Stats

    • Downloaded in total
      Downloaded in total 18.5k times
    • Downloaded this version
      This version: 2.7k times


    espressif/esp_modem_usb_dte version: 1.1.0~1 |