The C Source, Patches and (shudder!) Bugs
Post Reply
grugrugru
Posts: 3
Joined: 23 Nov 2020, 12:44

Huawei E3531 dongle and usb otg host

Post by grugrugru » 23 Nov 2020, 12:56

Hi,
I am trying to use the huawei e3531 dongle with the STM32 microprocessor via usb otg. This means that I have to perform mode switching to switch to modem mode. I read the source code but still didn't know quite sure the steps needed to perform the mode switching operation.
In my understanding, I can perform the mode switching by these steps, please correct me if I'm wrong:
1. Perform normal enumeration
2. Send bulk data with the special operation code
3. Remove device/config/whatever descriptor from the memory
4. Perform enumeration again

Are these steps enough to switch the dongle from MSC mode to modem mode?

LOM
Posts: 1382
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei E3531 dongle and usb otg host

Post by LOM » 24 Nov 2020, 05:37

Looks ok but:

Enumeration is usually done by the kernel (udev or hotplug) not by the user, are you sure you need to do that by yourself?

Be aware that some USB host controllers in otg mode must be forced into host mode or they may drop the USB VBus during the time your dongle is absent from the bus when it morphs.
If VBus gets dropped then your dongle will reset and come back in initial mode ie not switched.

grugrugru
Posts: 3
Joined: 23 Nov 2020, 12:44

Re: Huawei E3531 dongle and usb otg host

Post by grugrugru » 24 Nov 2020, 18:12

Enumeration is usually done by the kernel (udev or hotplug) not by the user, are you sure you need to do that by yourself?
The ST USB HOST library has its own enumeration process implementation.
I only need to reset the peripheral to get the re-enumeration process started.
Be aware that some USB host controllers in otg mode must be forced into host mode or they may drop the USB VBus during the time your dongle is absent from the bus when it morphs.
If VBus gets dropped then your dongle will reset and come back in initial mode ie not switched.
Yeah, I did see that the VBUS gets dropped but I took that part of the code out. You say that it morphs. How long does it take for the dongle to finish morphing/switching?

New Question:
I sent out the bulk message.Then, when I performed read op, the dongle sent a STALL response. Is this normal?

grugrugru
Posts: 3
Joined: 23 Nov 2020, 12:44

Re: Huawei E3531 dongle and usb otg host

Post by grugrugru » 24 Nov 2020, 20:45

Turns out I didn't convert the raw message into bytestring. Thanks for the support.

Post Reply