Use cellular interface to 5G modem through USB

Hello I have a STM32F4 connected to a quectel 5G modem RM500 through USB, i want to implement the cellular interface example (freertos/cellular-demo) but in the MCU instead of windows, so i can connect to a AWS server and send data with MQTT like in the demo.
But i´ve been reading the documentation for a while but still hard for me to follow the porting guide (freertos/Documentation/api-ref/cellular/cellular_porting)

The first thing I should do is impement the communication interface right? there should be any issue implementing it with an USB connection instead of an UART? Im using the stm32 usb host cdc library and it is working well inside as a freertos task.
How do I do this? and how can I test if the cellular interface can connect to the modem?

Thanks in advice, Nicolas.

Does the device HAVE a USB connection to talk to it with?

Or are you thinking of making your device a USB Host to talk to a USB to Serial Converter? It would seem using a serial port would be better for that.

It does, and it is working. MCU acts as host and MODEM as device.

Hi Nicolas,

You are right. The first thing for porting cellular interface to new platform is to implement the comm interface. You can reference the header file for the comm interface details. The sequence diagram in cellular design describes how the comm interface will be used by the cellular interface.

We have example implementation for STM32 UART. Comm interface doesn’t assume the connection is UART. Since you are using USB interface, you will need to adapt the difference.

The comm interface doesn’t have dependency with the cellular interface. Once you finish your implementation, you can write a demo code to test comm interface directly without initialize cellular interface.

Users who want to use cellular interface only need to implement the comm interface if they are using FreeRTOS supported modem or community supported modem.

It looks like you are using RM500 which doesn’t have a porting yet. You will need to create a modem porting. porting module guide document can be referenced. It is suggested to start with similar modem ( maybe BG96 ) and adapt the difference.

1 Like

Hi, thank you for your answer.
Understood, but I still have many doubts on how to implement the comm interface, I should just copy the header file and then fill the .c with the same functions I´m using for the USB connection? Right now the USB works in a frertos task so idk.
The UART example seems hard to understand for me if I have to edit it onto USB, cant I have more examples of different comm interface implementations?


Here is another - FreeRTOS/comm_if_windows.c at main · FreeRTOS/FreeRTOS · GitHub