Skip to main content
Graduate
December 18, 2017
Question

STM32f7 USB Host controlling 4G Modem

  • December 18, 2017
  • 7 replies
  • 8473 views
Posted on December 18, 2017 at 15:55

I'm trying to link my stm32f7 to a Telit LE910 modem over USB. I can already do this over a UART but I want to increase the data rate.

My hope is to use the stm32 USB Host CDC drivers.

I can enumerate the device and I see:

No shield USBH library started. Starting MSC Demo Starting MSC Demo USB Device Attached PID: 1201h VID: 1bc7h Address (&sharp1) assigned. Manufacturer : Android Product : Android Serial Number : 0123456789ABCDEF Enumeration done.

This device has only 1 configuration. Default configuration set. No registered class for this device which wants ff.

In order to link a Linux system to this modem, you're supposed to add the Telit Vendor-ID, Product-ID (i.e. 1bc7:1201) combination into /sys/bus/usb-serial/drivers and then tell ppp to use that USB serial interface.

To my naive way of thinking, this tells me that Linux should be able to talk to the modem using a standard protocol (my guess is CDC) and start talking AT commands to it.

The device class of the modem is 0xff which means vendor-specifc. And yet Linux only needs to be told to use its usb-serial driver. So the question then is how might I associate the modem's VID:PID pair with the CDC interface? I don't see a way without e.g. editing usbh_core.c yet I'd have thought it's a relatively common task.

USBH_StatusTypeDef  USBH_Process(USBH_HandleTypeDef *phost)

  case HOST_CHECK_CLASS:

The modem reveals 7 interfaces. So after that I'd need to pick out the right interface and endpoint. But none of them are USB CDC. All have Class 0xFF, subclasses:protocols are 0xFF:0xFF, 0x42:0x01, 0xFF:0xFF, 0x00:0x00

, 0x00:0x00

, 0x00:0x00

, 0x00:0x00

So I'd probably also need to hack USBH_FindInterface as well.

Has anyone been down this path who is willing to share information?

Thanks in advance,

Danish

#cdc #usb-host #usb-cube-host-cdc #modem
    This topic has been closed for replies.

    7 replies

    Danish1Author
    Graduate
    December 19, 2017
    Posted on December 19, 2017 at 12:41

    Telit modems with this PID use the Qualcomm-proprietary QMI protocol, for which there is a Linux driver according to their Linux user guide.

    Visitor II
    December 19, 2017
    Posted on December 19, 2017 at 14:07

    Are you using CubeMX?

    In any case, somewhere USBH_Init(), USBH_RegisterClass(), and USBH_Start() need to be called to get the USB Host peripheral up and running. USBH_RegisterClass() needs a USBH_ClassTypeDef. USBH_ClassTypeDef is where you can initialize the callbacks needed to enumerate and interface with the Telit modem. The (*Init) function is what you are interested in. (*Init) can validate the VID/PID, select interface, open pipes, etc. USBH_FindInterface() can be called; but, it really doesn't need to be since there is only one interface. No, hacking of HAL is needed.

    Look at the example code in the Firmware Library.

    Danish1Author
    Graduate
    December 19, 2017
    Posted on December 19, 2017 at 14:38

    Thanks for that.

    I started with STM32Cube_FW_F7_V1.7.0

    From what I can see, USBH_Process() chooses a driver only on the basis of

    phost->device.CfgDesc.Itf_Desc[0].bInterfaceClass

    even when the 

    bInterfaceClass is 0xFF i.e. vendor-specific.

    So for this project, which only has the one vendor-specific USB device that can be attached, I can write my own modem driver and register the modem driver to have the interface-class of 0xFF and let USBH_Process tie them together.

    I was hoping to piggy-back on top of the CDC driver, but if I have to write my own then so be it.

     - Danish

    Explorer
    January 24, 2019

    Hi,

    Wondering if you got anywhere with this? I am using a SIM7100 modem, which use a Qualcomm chipset. Similarly to you we can talk to the modem over the UART connection, but the speed is not high enough for our application so we need to connect over the USB interface. SIMCOM provide windows and linux drivers for their module, but I haven't found any information which will allow us to write our own drivers for the STM32.

    Would be interested to hear your progress.

    Thanks

    -Mark

    Danish1Author
    Graduate
    January 25, 2019

    No, sorry. I have not put any more effort into this so far - too many higher-priority issues.

    Regards,

    Danish

    Super User
    January 25, 2019

    @mark_dubo​ You wrote that a Linux driver exists for this device. Is the source available? If yes, this is *the* information. Find a consultant (contractor) to do the porting work, if it is too hard or too boring.

    -- pa

    Explorer
    January 28, 2019

    Hi Pavel, we are looking at the linux drivers now. Hopefully they will give us a bit of a head start.

    Visitor II
    April 14, 2020

    Hi Danish, so did you fixed this problem I got same problem with you, Uart with at command is not enough to switch between send and received. Could you give me a help how to connect modem into usb host

    Thanks

    Danish1Author
    Graduate
    April 14, 2020

    No we didn't get USB working I'm afraid. I could enumerate the endpoints and identify some as interrupt, others bulk in and out.

    But I could not find a way to get the modem to respond to AT commands. So I just have to limit my interface to the serial port.

    Note I was constrained by the Skywire Nimbelink pin-out. You might be able to wire up more than one UART interface if your engineering goal is to have more than one simultaneous communication path, and your modem is directly mounted on the same pcb as the stm32.

    Regards,

    Danish

    Visitor II
    November 8, 2021

    @Danish​ Did you find a solution or made any progress in interfacing the Quectel EC25 to STM over USB?

    EC25 has 5 Interfaces all have interface class as Vendor specific 0xFF.

    I have same task, but have no idea on how to move forward with the USB for configuring and sending AT commands.

    Danish1Author
    Graduate
    November 9, 2021

    No change from 2 years ago. I don't know the Quectel EC25 so I don't even know if it has the same interface (built on top of USB protocols).

    I don't know if mark_duobo made any progress looking at the linux drivers and how they might be ported to stm32.

    I am using PPPoS on a UART cranked up as high as I found to be reliable (921600 baud).

    Although my pcb has the USB interface wired as well, I don't use it. And I don't see that changing any time soon.

    Regards,

    Danish

    Visitor II
    July 19, 2022

    Hi MPati.3 and Danish

    Wondering if you got anywhere with this? I am working in a proyect where I need to interface the Quectel RM500 and a STM32F4 via USB but I get to the error "No registered class for this device." bc ir has a vendor specific class.

    Kind regards, Nicolas.