I'm trying to run a USB Host and collect data from a device that exposes itself as a generic CDC-ACM device. I'm trying to run the usb/cdc_acm_host example and running into a crash I can't quite track down.
First, I was running into an issue with the usb_host_cdc_acm component, as it does not recognize devices with class and subclass set to 0x00. I modified the component (specifically this line https://github.com/espressif/idf-extra- ... ost.c#L674) to look for class and subclass 0x00. The rest of the code works as expected, as it looks for a interface with the appropriate class and subclass.
Next, I run the cdc_acm_host example, modifying it to look for the correct vendor and product IDs, as well as adapting the line coding to my device (115200, 8 data bits, 0 parity, 0 stop bits).
The example runs and receives some data from the device, but will periodically (30 seconds or so) reboot. Here's a sample output just before the panic and reboot:
Code: Select all
I (1424) USB-CDC: 0x3fc9d858 63 74 69 6f 6e 53 74 61 74 75 73 3e 0d 0a |ctionStatus>..|
I (1434) USB-CDC: Setting up line coding
E (1444) USBH: usb_transfer_t num_bytes > data_buffer_size
E (1444) cdc_acm: cdc_acm_host_send_custom_request(1294): CTRL transfer failed
E (1454) cdc_acm: cdc_acm_host_line_coding_get(1221):
ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x420091f8
0x420091f8: app_main at ../reader/cdc_acm_host/main/usb_cdc_example_main.c:157 (discriminator 1)
file: "./main/usb_cdc_example_main.c" line 157
func: app_main
expression: cdc_acm_host_line_coding_get(cdc_dev, &line_coding)
abort() was called at PC 0x40379c2b on core 0
0x40379c2b: _esp_error_check_failed at ../reader/esp-idf/components/esp_system/esp_err.c:50
Backtrace: 0x40375976:0x3fc99170 0x40379c35:0x3fc99190 0x4037ff82:0x3fc991b0 0x40379c2b:0x3fc99220 0x420091f8:0x3fc99250 0x42024a27:0x3fc992b0 0x4037c56d:0x3fc992e0
0x40375976: panic_abort at ../reader/esp-idf/components/esp_system/panic.c:452
0x40379c35: esp_system_abort at ../reader/esp-idf/components/esp_system/port/esp_system_chip.c:93
0x4037ff82: abort at ../reader/esp-idf/components/newlib/abort.c:38
0x40379c2b: _esp_error_check_failed at ../reader/esp-idf/components/esp_system/esp_err.c:50
0x420091f8: app_main at ../reader/cdc_acm_host/main/usb_cdc_example_main.c:157 (discriminator 1)
0x42024a27: main_task at ../reader/esp-idf/components/freertos/app_startup.c:217 (discriminator 13)
0x4037c56d: vPortTaskWrapper at ../reader/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162
I've further experimented with the code and tried to remove the
Code: Select all
cdc_acm_host_line_coding_get
Code: Select all
cdc_acm_host_line_coding_set
Experimenting even further, I modified the code such that the line coding is only set when the device is opened, rather than on each loop, but this results in similar issue.
I have entertained the VCP route, but I can't find much on the device I have, so I would be essentially implementing a generic CDC ACM driver, which already exists in the usb_host_cdc_acm component.
Does anyone have suggestions on further debugging?
Thanks!