
RG500U-CN&RM500U-CN Driver User Guide
RG500U-CN&RM500U-CN
Driver User Guide
www.waveshare.com/wiki 1 / 12

RG500U-CN&RM500U-CN Driver User Guide
Content
1. introduction
2. Overview of Linux USB Interface
3. Linux USB Driver
3.1. USB TO Serial PORT
3.1.1. Add VID and PID
3.1.2. Add the Zero Packet Mechanism
3.1.3. Add Reset-resume Mechanism
............................................................................................................................
...........................................................................................
.....................................................................................................................
..........................................................................................................
....................................................................................................
.........................................................................
............................................................................
3.1.4. Increase the Quantity and Capacity of the Bulk Out URBs (Linux kernel 2.6.29
and below)
3.1.5. Modify Kernel Configuration
3.2. USB network card driver
3.3. Enable PPP dialing (not recommended)
4. AT and USB network card dial-up function test
4.1. AT Function Test
4.2. USB Network Card Dial test
.......................................................................................................................................
5. FAQ
................................................................................................................
................................................................................
..................................................................................................
..........................................................................
.................................................................
.............................................................................................................
...........................................................................................
3
4
5
5
5
5
6
7
7
7
9
10
10
10
11
5.1. How to Check Whether USB Driver Exists in the Module
5.2. How to Check Whether the Module Works Well with the
Corresponding USB Driver
6. Appendix A References
....................................................................................................
........................................................................................................
............................................
..........................................
11
11
11
12
www.waveshare.com/wiki 2 / 12

RG500U-CN&RM500U-CN Driver User Guide
1. IN TRODU C T ION
This document mainly introduces how to integrate the USB-to-serial driver and USB network card
driver of Quectel 5G modules RG500U-CN and RM500U-CN into Linux system, how to test AT
command and USB network card dial-up function, and common problems related to driver migration.
www.waveshare.com/wiki 3 / 12

RG500U-CN&RM500U-CN Driver User Guide
USB RNDIS/ECM/NCM/MBIM
Network Card
2: DIAG command
communication port
4: AT Command
Communication Port
5:Modem Command
Communication Port
6: NMEA Command
Communication Port
7: ADB Command
Communication Port
2. OV ERVIEW OF LINUX US B INT ERFAC E
The USB drivers of Quectel RG500U-CN and RM500U-CN modules contain several different functional
interfaces. The following table takes RG500U-CN as an example to describe the details of the
module’s USB interface under the Linux operating system:
Table 1: Linux USB Interface Information
www.waveshare.com/wiki 4 / 12

RG500U-CN&RM500U-CN Driver User Guide
3. LINUX US B DRIVER
3. 1 . USB TO SER I A L PORT
When the module successfully loads the USB-to-serial option driver, Linux will create multiple
serial device files with names such as ttyUSB0, ttyUSB1, ttyUSB2, etc. name).
The following chapters introduce how to change USB to serial port option driver.
3. 1 .1. A D D VID AND PI D
Add the module's VID and PID information in the file [KERNEL]/drivers/usb/serial/option.c as follows:
Note
If the user uses the driver file (option.c) provided by Quectel, it is recommended that the user check
the option_probe function in [KERNEL]/drivers/usb/serial/option.c. According to the introduction in
Chapter 2, the module interface 2/3/4/5/6 is the serial port. It is necessary to ensure that the
interface after the USB interface number exceeds 4 will not be filtered out.
3. 1 .2. A D D THE ZERO PA C KET ME C H ANISM
For the USB Bulk Out transmission mode, if the length of the data to be sent is an integer multiple of
the length of the USB data packet, an additional data packet with a length of zero needs to be sent to
notify the peer end that the data transfer is complete.
⚫ For Linux kernel 2.6.35 and above, please add the following statement to the file
[KERNEL]/drivers/usb/serial/usb_wwan.c.
www.waveshare.com/wiki 5 / 12

RG500U-CN&RM500U-CN Driver User Guide
For Linux kernel 2.6.34 and below, please add the following statement to the file
[KERNEL]/drivers/usb/serial/option.c
3. 1 .3. A D D RESET- RE SUME ME C H ANISM
Some USB host controllers or USB hubs may power down or reset when the MCU enters suspend or
sleep mode, and the MCU cannot automatically resume USB devices after exiting suspend or sleep
mode. Add the following statement to enable reset recovery flow.
For Linux kernel 3.5 and above, please add the following statement to the file
[KERNEL]/drivers/usb/serial/option.c
For Linux kernel 3.4 and below, please add the following statement to the file
[KERNEL]/drivers/usb/serial/usb-serial.c
www.waveshare.com/wiki 6 / 12

RG500U-CN&RM500U-CN Driver User Guide
3. 1 .4. I N CR EASE TH E QUANTI T Y AND CAP A CITY OF TH E BULK OU T UR BS (LIN U X
KE RNEL 2.6 . 2 9 AND BE L OW)
For Linux kernel 2.6.29 and below, the number and capacity of batch output URBs need to be
increased to obtain faster uplink rate. Please add the following statement to the file
[KERNEL]/drivers/usb/serial/option.c.
3. 1 .5. M O DIFY KE R N EL CONF I G URATI O N
In order to use the USB-to-serial option driver, the following Linux kernel configuration items must be
enabled:
⚫ CONFIG_USB_SERIAL
⚫ CONFIG_USB_SERIAL_WWAN
⚫ CONFIG_USB_SERIAL_OPTION
3. 2 . USB NETW O R K CARD DR IVER
The module supports four network card functions of MBIM/RNDIS/ECM/NCM. The Linux system
supports these USB network card functions by default. The system has a built-in driver module and
does not require any modification to the driver files of the Linux system. The driver source code is
maintained by GNU Linux.
After the module is connected to the Linux Host and successfully loaded with the corresponding
network card driver for USB, a network card will be generated on the Host. cdc_mbim also generates
a cdc-wdm character device for command interaction. The network card mode of the module can be
configured by AT commands, as shown in the following table:
www.waveshare.com/wiki 7 / 12

RG500U-CN&RM500U-CN Driver User Guide
AT+QCFG="usbnet" ,1
Configure ECM Mode
cdc_mbim
(Kernel 3.18 and above)
AT+QCFG="usbnet",2
Configure MBIM Mode
AT+QCFG="usbnet",3
Configure RNDIS Mode
AT+QCFG="usbnet",5
Configure NCM Mode
For details on the above AT commands, please refer to document [1].
To use the USB NIC function, follow the steps below to configure the kernel.
Step 1: Execute the following command to switch to the kernel directory.
CD<KERNEL content>
Step 2: Execute the following commands to set environment variables and export the defconfig file in
the user device operating system.
Step 3: Execute the following command to compile the kernel.
Step 4: Execute the following command to enable the USB network card function through the options
shown in the figure below.
www.waveshare.com/wiki 8 / 12

RG500U-CN&RM500U-CN Driver User Guide
3. 3 . EN ABLE PP P DIALIN G (N OT RECO M MENDE D )
PPP dial-up has the following disadvantages compared to the USB network card Internet access
method:
⚫ More complicated to use
⚫ Higher CPU consumption under the same internet speed
⚫ The data transmission cannot reach the theoretical rate
Therefore, PPP dialing is not recommended. If required, the following Linux kernel configuration items
must be enabled:
⚫ CONFIG_PPP
⚫ CONFIG_PPP_ASYNC
⚫ CONFIG_PPP_SYNC_TTY
⚫ CONFIG_PPP_DEFLATE
www.waveshare.com/wiki 9 / 12

RG500U-CN&RM500U-CN Driver User Guide
4. AT AND USB NE T WORK CA R D DIAL- U P FUNCTI O N TEST
4. 1 . AT FUNC T IO N TEST
After the module successfully loads the USB-to-serial option driver, Linux will create multiple serial
device files with names such as ttyUSB0, ttyUSB1, ttyUSB2, etc. in the /dev directory (the serial
device file names under Linux are not fixed, and the system automatically assigns available names ),
where the third serial port is the AT command port of the module. A serial port tool such as
minicom or busybox microcom can be used to test AT functionality.
The following figure shows the AT function result tested by the busybox microcom tool. The third
serial port name assigned by the system in the example is /dev/ttyUSB2.
4. 2 . USB NETW O R K CARD DI AL TEST
For details of USB network card dialing, please refer to the document [2]
www.waveshare.com/wiki 10 / 12

RG500U-CN&RM500U-CN Driver User Guide
5. FA Q
5. 1 . HOW TO CH E C K WHETH E R USB DRI V ER EXIS T S IN THE MO D U LE
The list of files under the directory /sys/bus/usb/drivers can be used to see which USB drivers have
been existed to the Linux system. E.g
If you need to change USB to serial driver, please make sure option exists. If you need to port the USB
NCM driver, please make sure that cdc_ncm exists;
If you need to port the USB ECM driver, please ensure that cdc_ether exists; if you need to migrate
the USB MBIM driver, please ensure that cdc_mbim exists;
To port USB RNDIS driver, make sure rndis_host exists.
5. 2 . HOW TO CH E C K WHETH E R THE MO D U LE WOR K S WELL WIT H THE
CO RRESP O N DING US B DR IVER
This chapter shows the corresponding log information printed by the Linux system when the module
loads the USB driver correctly. Users can check whether the module has correctly loaded the USB
driver by comparing the logs in this chapter with the actual logs obtained.
www.waveshare.com/wiki 11 / 12

RG500U-CN&RM500U-CN Driver User Guide
Quectel_RG500U-CN&RM500U-CN_AT Command
Quectel_RG500U-CN&RM500U-CN_
Module AT Command Manual
Quectel_RG500U-CN&RM500U-CN_ Network Dial
Guide
Quectel_RG500U-CN&RM500U-CN_
Network Dial Application Guide
Communications Device Class
Mobile Broadband Interface Model
NMEA (National Marine Electronics
Association) 0183 Interface Standard
Remote Network Driver Interface Specification
6. AP PENDIX A RE FERENC E S
Reference Document
Terms and Abbreviations
www.waveshare.com/wiki 12 / 12