Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB host CDC-ECM functionality is not working for LTE module as USB CDC-ECM device #173

Open
MaheshAvula-Alifsemi opened this issue Sep 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@MaheshAvula-Alifsemi
Copy link

MaheshAvula-Alifsemi commented Sep 18, 2024

Hi,

  • -> Target device as Alif semiconductor Devkit.
  • ->I am using usbx version is v6.1.9_rel.
    --> compiler as ARMCLANG
    --> IDE as ARMDS

I am working with the USBx CDC-ECM class in host mode.
I have connected a USB device, which functions as a USB-to-Ethernet CDC-ECM adapter, to my target,
which operates as a USB host.

The USB-to-Ethernet adapter (USB device) is enumerated on the host,
and a network connection is established. An IP address is assigned to the host,
and I can successfully ping the server IP from the client and vice versa.

We have another CDC-ECM USB device, which is an LTE module.
When I connect the LTE module to the host, it enumerates successfully, but I don’t see any network connection notifications
on the interrupt endpoint from the USB device. Since no network connection is established, the CDC-ECM link remains down,
and my application thread keeps checking for the link to be up, resulting in an infinite loop.

The same device(LTE module) works on Linux, and after debugging, I found that the Linux host sends a class-specific request as a SET Ethernet Packet Filter
to the device, which then acknowledges it. Following this, the LTE device sends network connection notifications on the interrupt endpoint, and everything functions correctly.

I was reviewing the USBX host CDC-ECM class code and noticed that it is not sending any class-specific requests to the device.
The device may be expecting these requests from the host.

Below are the code change in the USBX host CDC-ECM class code to send the SET Ethernet Packet Filter request to the device,
and device acknowledges it. Following this, the LTE device sends network connection notifications on the interrupt endpoint,
and everything functions correctly.

--> ux_host_class_cdc_ecm_mac_address_get.c
packt_filter = _ux_utility_memory_allocate(UX_SAFE_ALIGN, UX_CACHE_SAFE_MEMORY, 8);
if (descriptor == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
/* Create a transfer_request for the request. /
transfer_request -> ux_transfer_request_data_pointer = packt_filter;
transfer_request -> ux_transfer_request_requested_length = 0;
transfer_request -> ux_transfer_request_function = USB_CDC_SET_ETHERNET_PACKET_FILTER;
transfer_request -> ux_transfer_request_type = UX_REQUEST_OUT | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_INTERFACE;
transfer_request -> ux_transfer_request_value = USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST | USB_CDC_PACKET_TYPE_ALL_MULTICAST;
transfer_request -> ux_transfer_request_index = cdc_ecm -> ux_host_class_cdc_ecm_interface_control -> ux_interface_descriptor.bInterfaceNumber;
/
Send request to HCD layer. */
status = _ux_host_stack_transfer_request(transfer_request);

 /* Check for correct transfer. */
 if (status == UX_SUCCESS)
 {
      return status;
 }
 else
 {
     return status;
 }

I would like to know if this code change is acceptable. If not, could you please provide pointers on how to make it work?"

Regards
Mahesh

@MaheshAvula-Alifsemi MaheshAvula-Alifsemi added the bug Something isn't working label Sep 18, 2024
@MaheshAvula-Alifsemi
Copy link
Author

Hi @xiaocq2001 ,

Could you please help on this issue.

@Robiberto
Copy link

Hi Mr MaheshAvula.
Do you solved the problem ?

Thanks
Roberto

@MaheshAvula-Alifsemi
Copy link
Author

Hi @Robiberto, With above code changes it's enumerated , but those changes are acceptable or not.

@rbtripathi
Copy link

Hi @MaheshAvula-Alifsemi
I've been trying CDC-ECM host mode with a generic USB-Ethernet dongle with STM32H743 using ThreadX-NetxDuo and USBX. The ping works for me for about 40 seconds and then USB dongle is powered down by the host stack. Any suggestion what could be wrong?
Can you please share steps for the correct way to setup the CDC-ECM in host mode. I tried xiaocq2001's steps but no improvement.

@MaheshAvula-Alifsemi
Copy link
Author

Hi @rbtripathi , Could you please provide more details and what was the issue you are seeing after 40sec ping? if possible could you provide more debug logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants