Sitemap

Enabling Network Connectivity on a Development Board: Detailed Analysis of RT-Thread CherryUSB RNDIS Driver | Technical Gathering

4 min readAug 21, 2025

This document describes the process of enabling network connectivity on a development board by utilizing the CherryUSB package as the USB Host stack in RT-Thread, to drive the AIR780E 4G Cat.1 module’s RNDIS functionality, and integrating it with the lwIP network stack. The implementation uses the STM32F429 as a reference platform.

1. Creating a New Project

2. Configuring CubeMX

The standard peripheral configuration is here.

Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Enable USB HOST

Press enter or click to view image in full size

Enable USB HOST Interrupt

Press enter or click to view image in full size

After completing the above, generate the project and close CubeMX.

3. Configuring CherryUSB

Press enter or click to view image in full size

Compile the project initially.

Press enter or click to view image in full size

An error will occur.Solution: remove RT_WEAK and recompile. The error will no longer appear.

Press enter or click to view image in full size

Next, open RT-Thread Settings, add the CherryUSB package, and configure it.

Press enter or click to view image in full size

In fact, only enabling RNDIS (without enabling CDC ACM) is sufficient to drive AIR780 to achieve lwIP networking, but the terminal will show a large number of red prompts saying CDC ACM is not supported. For neatness, enable it as well.

At this point, save and compile. Many errors will appear, but do not panic. Solve them one by one:

(1) usb_config.h Error

Press enter or click to view image in full size

Solution: create a file usb_config.h under the applications folder with the following content:

#ifndef CHERRYUSB_CONFIG_H #define CHERRYUSB_CONFIG_H … #endif

Recompile. The number of errors will be significantly reduced.

Press enter or click to view image in full size

(2) RT_TIMER_THREAD_STACK_SIZE Issue

Press enter or click to view image in full size

Solution: increase the stack size.

Press enter or click to view image in full size

It is also necessary to enlarge the idle thread stack.

Press enter or click to view image in full size

(3) lwIP Version Incompatibility

Press enter or click to view image in full size

Solution: use lwIP version 2.1.2.

Press enter or click to view image in full size

(4) lwIP Receive Thread Issue

Press enter or click to view image in full size

Solution: disable the lwIP receive thread.

Press enter or click to view image in full size

(5) lwIP Thread Stack Size

Press enter or click to view image in full size

Solution: increase the lwIP thread stack size.

Press enter or click to view image in full size

(6) Linker Script Issue

Press enter or click to view image in full size
Press enter or click to view image in full size

Solution: add the following code to the linker script:

Press enter or click to view image in full size

/* section information for USB Host class (CherryUSB) */ . = ALIGN(4); __usbh_class_info_start__ = .; KEEP(*(.usbh_class_info)) __usbh_class_info_end__ = .;

Recompile. No further errors should occur.

Press enter or click to view image in full size

4. Modifying main.c

Press enter or click to view image in full size

Insert the following code:

#include <rtthread.h>#define DBG_TAG “main”#define DBG_LVL DBG_LOG #include <rtdbg.h>#include <stm32f429xx.h>#include “usbh_core.h”#include “lwip/tcpip.h”int main(void) { usbh_initialize(0, USB_OTG_HS_PERIPH_BASE); return RT_EOK; }

5. Verification

Press enter or click to view image in full size

Flash the firmware to the development board.

Upon startup, terminal output will indicate successful initialization.By issuing the ping command, the board will respond, confirming that network connectivity over the 4G module has been successfully established.

Press enter or click to view image in full size

--

--

RT-Thread IoT OS
RT-Thread IoT OS

Written by RT-Thread IoT OS

An Open-Source Community-Powered Real-Time Operating System (RTOS) Project! Let’s develop, DIY, create, share, and explore this new IoT World together!

No responses yet