cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f7 USB Host controlling 4G Modem

Danish1
Lead II
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
22 REPLIES 22

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

From the network or locally?

And what's the performance of the modem on a PC via USB using equivalent software?​

Wouldn't you want to shovel more data across the connection than 1500 bytes?​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Actually I've just confirmed that it's around 8m and not 20ms as stated before, which still holds us up too much. If we want to send a 15k packet it will take around 80ms to send.

I've never tried this modem on a PC. It's soldered directly onto our PCB and connected to our STM32.

Although that baud-rate is visible, it might not be the dominant rate-limiting process.

mark_duobo, are you using TCP or UDP to send your data? And are you using a protocol-stack on your stm32 (where you have control) or on your modem module?

If TCP, then you have (at least) the full net round-trip time between your packet being sent and an acknowledge coming back. But once a TCP link is established, a good protocol-stack will allow several unacknowledged packets to be "in the ether" - in other words sent-but-not-yet-acknowledged, with the sender able to re-send those packets if an acknowledgement never comes or if the acknowledgement says that certain packets were missed. For the LWIP stack this means you have to give it sufficiently large buffers. Also this feature does not come in immediately - there are rules about "playing fairly" and not overwhelming the network.

If UDP, then you can choose to ignore the rules fire off several packets one after another, knowing that some or all of them might not get through. In which case you're limited by the slowest data-rate of your link, which might be that from the stm32 to the modem. But it might also be your network link - for example over a 4G Cat NB1 link the expected data-rate is 32 Kbps downlink and 70 Kbps uplink (ref: Quectel QBG96 data sheet).

Danish

Hi Danish,

Thanks for the info. I've just got more details today from the engineer working on this, and he's told me that that 8ms time was due to echo being enabled, so sending was x2 slower than necessary.

We are sending over UDP (streaming JPEG and audio data), so not ever waiting on acknowledgments from the other side. We will be receiving a similar stream from the other side though.

Thanks again

Mark

Hi Danish,

I need to build a solution where the STM32 platform is using a 2G/3G/GPRS modem to talk to a cloud service. I want to use LWIP with PPPOS, however I cannot find any usable examples for that. Have you been able to put this solution together? If you could share any info that would be very helpful.

Thanks!

Hi Ken. No sorry we haven't made any progress on this. However it has now become a priority so our plan is to pay a contractor to build a sample project that does this. We can then integrate his code into our project.

Danish

HShin.2
Associate

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

Danish1
Lead II

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