eclipse-threadx/usbx

Automatically activate/deactivate CDC ECM

ZerAtaii opened this issue · 2 comments

  • What target device are you using?
    LPC55S69
  • Which version of Azure RTOS?
    6.1
  • What toolchain and environment?
    arm-none-eabi-* + WSL

Hi,
I use Azure RTOS with the netxduo layer to manage TCP/IP sockets. The application exchanges a set of commands through netcat via "Windows sub Linux" on different ports (32071 to 32076) with an ethernet over USB protocol (CDC ECM). In my application, there are different communication buses, wifi / BLE / cellular network / IOT (through cellular or WIFI). When there is an error in one, the whole system is "blocked" (no more inputs from USB but the system is still running). After a delay of 29mins, 2 functions are triggered (ux_slave_class_cdc_ecm_instance_activate and ux_slave_class_cdc_ecm_instance_deactivate) and everything works fine after this. Do you know how to automatically trigger these functions after a few minutes without communication?

usb_IF

Best regards,
Antoine

I guess ux_slave_class_cdc_ecm_instance_activate and ux_slave_class_cdc_ecm_instance_deactivate is triggered by a USB bus reset from host side, maybe you can consider adjust some timeout setting on your host side?

On device side, there is usually some way in device controller hardware that can "detach" from host, there is no API for detaching, but you can try to operate the hardware to "detach" and "attach" again to let host re-enumerate your device.

For this project, the USB host is a Windows PC running WSL. I send a curl command and after a while the download speed drops to 0. From then on, I'm no longer able to communicate via the USB connection. The 2 CDC functions allow me to reinstantiate the whole chain and solve the problem.
I don't think we can blame the USB host when it's just a simple PC?
I could manually trigger the functions, but how do i know when i'm actually dealing with the bug?