[BPI-R3] Sim error OpenWrt SNAPSHOT, r21666-68f983ba41 003: ID 2c7c:0800 Quectel RM502Q-AE

You may help me with an sim error i got on my r3 model with an Bus 001 Device 003: ID 2c7c:0800 Quectel RM502Q-AE, installed with a adapter M.2 Key B to Mini PCI-e NGFF M2 “https://es.aliexpress.com/item/1005004251364071.html?spm=a2g0o.order_list.order_list_main.5.62d3194dZfPazn&gatewayAdapt=glo2esp

The issue is that i see the device, it seems to work till the point that it cant find the sim no matter the port i choose it keeps on this error, i will put some logs down:

OpenWrt SNAPSHOT, r21666-68f983ba41

<b>[email protected]:~# gcom -d /dev/cdc-wdm0
***SIM ERROR***
Check device port configuration.
Check SIM is inserted
Test SIM in a mobile phone?</b>

**[email protected]:~# dmesg | grep modem**
[   18.298631] usbserial: USB Serial support registered for GSM modem (1-port)
[   18.305706] option 1-1.1:1.0: GSM modem (1-port) converter detected
[   18.312115] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0
[   18.319221] option 1-1.1:1.1: GSM modem (1-port) converter detected
[   18.325608] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1
[   18.332706] option 1-1.1:1.2: GSM modem (1-port) converter detected
[   18.339112] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2
[   18.346185] option 1-1.1:1.3: GSM modem (1-port) converter detected
[   18.352581] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB3
[   18.367564] usbserial: USB Serial support registered for Qualcomm USB modem
<b>[email protected]:~# lsusb</b>
Bus 002 Device 001: ID 1d6b:0003 Linux 5.15.86 xhci-hcd xHCI Host Controller
Bus 001 Device  **003: ID 2c7c:0800 Quectel RM502Q-AE**
Bus 001 Device 002: ID 1a40:0101  USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux 5.15.86 xhci-hcd xHCI Host Controller

<b>[email protected]:~# ls -l /dev/</b>
crw-------    1 root     root       10, 234 Jan  4 23:19 btrfs-control
drwxr-xr-x    3 root     root            60 Jan  1  1970 bus
<b>crw-------    1 root     root      180, 176 Jan  4 23:19 cdc-wdm0</b>
crw-------    1 root     root        5,   1 Jan  1  1970 console
crw-rw-rw-    1 root     root        1,   7 Jan  1  1970 full
crw-------    1 root     root       10, 229 Jan  4 23:19 fuse
crw-------    1 root     root      254,   0 Jan  1  1970 gpiochip0
crw-------    1 root     root       10, 183 Jan  1  1970 hwrng
crw-------    1 root     root       89,   0 Jan  1  1970 i2c-0
crw-------    1 root     root       89,   1 Jan  4 23:19 i2c-1
crw-------    1 root     root       89,   2 Jan  4 23:19 i2c-2
crw-------    1 root     root        1,  11 Jan  1  1970 kmsg
srw-rw-rw-    1 root     root             0 Jan  4 23:19 log
crw-------    1 root     root       10, 237 Jan  1  1970 loop-control
brw-------    1 root     root        7,   0 Jan  1  1970 loop0
brw-------    1 root     root        7,   1 Jan  1  1970 loop1
brw-------    1 root     root        7,   2 Jan  1  1970 loop2
brw-------    1 root     root        7,   3 Jan  1  1970 loop3
brw-------    1 root     root        7,   4 Jan  1  1970 loop4
brw-------    1 root     root        7,   5 Jan  1  1970 loop5
brw-------    1 root     root        7,   6 Jan  1  1970 loop6
brw-------    1 root     root        7,   7 Jan  1  1970 loop7
brw-------    1 root     root      179,   0 Jan  1  1970 mmcblk0
brw-------    1 root     root      179,   8 Jan  1  1970 mmcblk0boot0
brw-------    1 root     root      179,  16 Jan  1  1970 mmcblk0boot1
brw-------    1 root     root      179,   1 Jan  1  1970 mmcblk0p1
brw-------    1 root     root      259,   0 Jan  1  1970 mmcblk0p128
brw-------    1 root     root      179,   2 Jan  1  1970 mmcblk0p2
brw-------    1 root     root      179,   3 Jan  1  1970 mmcblk0p3
brw-------    1 root     root      179,   4 Jan  1  1970 mmcblk0p4
brw-------    1 root     root      179,   5 Jan  1  1970 mmcblk0p5
crw-------    1 root     root      250,   0 Jan  1  1970 mmcblk0rpmb
crw-------    1 root     root       90,   0 Jan  1  1970 mtd0
crw-------    1 root     root       90,   1 Jan  1  1970 mtd0ro
crw-------    1 root     root       90,   2 Jan  1  1970 mtd1
crw-------    1 root     root       90,   3 Jan  1  1970 mtd1ro
crw-------    1 root     root       90,   4 Jan  1  1970 mtd2
crw-------    1 root     root       90,   5 Jan  1  1970 mtd2ro
crw-------    1 root     root       90,   6 Jan  1  1970 mtd3
crw-------    1 root     root       90,   7 Jan  1  1970 mtd3ro
brw-------    1 root     root       31,   0 Jan  1  1970 mtdblock0
brw-------    1 root     root       31,   1 Jan  1  1970 mtdblock1
brw-------    1 root     root       31,   2 Jan  1  1970 mtdblock2
brw-------    1 root     root       31,   3 Jan  1  1970 mtdblock3
crw-rw-rw-    1 root     root        1,   3 Jan  1  1970 null
crw-------    1 root     root        1,   4 Jan  1  1970 port
crw-------    1 root     root      108,   0 Jan  4 23:19 ppp
crw-rw-rw-    1 root     root        5,   2 Jan  5 06:50 ptmx
drwxr-xr-x    2 root     root             0 Jan  1  1970 pts
crw-rw-rw-    1 root     root        1,   8 Jan  1  1970 random
lrwxrwxrwx    1 root     root             8 Jan  1  1970 shm -> /tmp/shm
lrwxrwxrwx    1 root     root            15 Jan  1  1970 stderr -> /proc/self/fd/2
lrwxrwxrwx    1 root     root            15 Jan  1  1970 stdin -> /proc/self/fd/0
lrwxrwxrwx    1 root     root            15 Jan  1  1970 stdout -> /proc/self/fd/1
crw-rw-rw-    1 root     root        5,   0 Jan  1  1970 tty
crw-rw----    1 root     dialout     4,  64 Jan  1  1970 ttyS0
crw-rw----    1 root     dialout     4,  65 Jan  1  1970 ttyS1
crw-rw----    1 root     dialout     4,  74 Jan  1  1970 ttyS10
crw-rw----    1 root     dialout     4,  75 Jan  1  1970 ttyS11
crw-rw----    1 root     dialout     4,  76 Jan  1  1970 ttyS12
crw-rw----    1 root     dialout     4,  77 Jan  1  1970 ttyS13
crw-rw----    1 root     dialout     4,  78 Jan  1  1970 ttyS14
crw-rw----    1 root     dialout     4,  79 Jan  1  1970 ttyS15
crw-rw----    1 root     dialout     4,  66 Jan  1  1970 ttyS2
crw-rw----    1 root     dialout     4,  67 Jan  1  1970 ttyS3
crw-rw----    1 root     dialout     4,  68 Jan  1  1970 ttyS4
crw-rw----    1 root     dialout     4,  69 Jan  1  1970 ttyS5
crw-rw----    1 root     dialout     4,  70 Jan  1  1970 ttyS6
crw-rw----    1 root     dialout     4,  71 Jan  1  1970 ttyS7
crw-rw----    1 root     dialout     4,  72 Jan  1  1970 ttyS8
crw-rw----    1 root     dialout     4,  73 Jan  1  1970 ttyS9
<b>crw-rw----    1 root     dialout   188,   0 Jan  4 23:19 ttyUSB0
crw-rw----    1 root     dialout   188,   1 Jan  4 23:19 ttyUSB1
crw-rw----    1 root     dialout   188,   2 Jan  4 23:38 ttyUSB2
crw-rw----    1 root     dialout   188,   3 Jan  4 23:19 ttyUSB3</b>
crw-------    1 root     root      249,   0 Jan  1  1970 ubi0
crw-------    1 root     root      249,   1 Jan  1  1970 ubi0_0
crw-------    1 root     root      249,   2 Jan  1  1970 ubi0_1
crw-------    1 root     root      249,   3 Jan  1  1970 ubi0_2
crw-------    1 root     root      249,   4 Jan  1  1970 ubi0_3
crw-------    1 root     root      249,   5 Jan  1  1970 ubi0_4
crw-------    1 root     root      249,   6 Jan  1  1970 ubi0_5
crw-------    1 root     root       10, 127 Jan  1  1970 ubi_ctrl
brw-------    1 root     root      254,   0 Jan  1  1970 ubiblock0_2
brw-------    1 root     root      259,   1 Jan  1  1970 ubiblock0_2p1
crw-rw-rw-    1 root     root        1,   9 Jan  1  1970 urandom
crw-------    1 root     root       10, 130 Jan  1  1970 watchdog
crw-------    1 root     root      252,   0 Jan  1  1970 watchdog0
crw-rw-rw-    1 root     root        1,   5 Jan  1  1970 zero

<b>[email protected]:~# comgt -v</b>
comgt 06:53:16 -> Verbose output enabled
comgt 06:53:16 -> argc:2
comgt 06:53:16 -> argv[0]=comgt
comgt 06:53:16 -> argv[1]=-v
comgt 06:53:16 ->  ---Script---
   [email protected] opengt
   [email protected]     set com 115200n81
   [email protected]     set senddelay 0.05
   [email protected]     send "AT+CFUN=1^m"
   [email protected]     waitquiet 1 0.2
   [email protected]   :start
   [email protected]     flash 0.1
   [email protected]     send "AT+CPIN?^m"
   [email protected]     waitfor 30 "SIM PUK","SIM PIN","READY","ERROR","ERR"
  [email protected]     if % = -1 goto error
  [email protected]     if % = 0 goto ready
  [email protected]     if % = 1 goto getpin
  [email protected]     if % = 2 goto ready
  [email protected]     if % = 3 goto error
  [email protected]     if % = 4 goto error
  [email protected]   :error
  [email protected]     print $s," ***SIM ERROR***
  [email protected] "
  [email protected]     print "Check device port configuration.
  [email protected] Check SIM is inserted
  [email protected] Test SIM in a mobile phone?
  [email protected] "
  [email protected]     exit 1
  [email protected]   :getpin
  [email protected]     #handle case where original Vodafone 3G generates wrong response
  [email protected]     waitfor 1 "2"
  [email protected]     if % = 0 goto ready
  [email protected]     print "
  [email protected] Enter PIN number: "
  [email protected]     input $x
  [email protected]     let a=len($x)
  [email protected]     if a<>5 goto getpin
  [email protected]     let c=0
  [email protected]   :test
  [email protected]     let $c=$mid($x,c,1)
  [email protected]     if $c<"0" goto getpin
  [email protected]     if $c>"9" goto getpin
  [email protected]     inc c
  [email protected]     if c<4 goto test
  [email protected]     let a=val($x)
  [email protected]     if a<0 goto getpin
  [email protected]     if a>9999 goto getpin
  [email protected]     let $c=$left($x,4)
  [email protected]   :enterpin
  [email protected]     send "AT+CPIN=\""
  [email protected]     send $c
  [email protected]     send "\"^m"
  [email protected]     waitfor 20 "OK","ERR"
  [email protected]     if % = -1 goto timeerror
  [email protected]     if % = 0 goto cont
  [email protected]     if % = 1 goto pinerror
  [email protected]   :pinerror
  [email protected]   :timeerror
  [email protected]     print "ERROR entering PIN code
  [email protected] "
  [email protected]     print "Caution! - entering the wrong PIN code three times will lock the SIM
  [email protected] "
  [email protected]     exit 1
  [email protected]   :ready
  [email protected]     print "SIM ready
  [email protected] "
  [email protected]   :cont
  [email protected]     print "Waiting for Registration..(120 sec max)"
  [email protected]     let c = 0
  [email protected]   :waitreg
  [email protected]     send "AT+CREG?^m"
  [email protected]     waitfor 2 "+CREG: 0,1","+CREG: 0,5"
  [email protected]     if % = -1 goto regagain
  [email protected]     if % = 0 goto homereg
  [email protected]     if % = 1 goto roamreg
  [email protected]   :regagain
  [email protected]     if c > 120 goto regtimeout
  [email protected]     let c=c+2
  [email protected]     print "."
  [email protected]     goto waitreg
  [email protected]   :regtimeout
  [email protected]     print "
  [email protected] Failed to register
  [email protected] "
  [email protected]     exit 1
  [email protected]   :homereg
  [email protected]     print "
  [email protected] Registered on Home network: "
  [email protected]     goto registered
  [email protected]   :roamreg
  [email protected]     print "
  [email protected] Registered on Roaming network: "
  [email protected]     goto registered
  [email protected]   :registered
  [email protected]     waitquiet 1 0.1
  [email protected]     send "AT+COPS?^m"
  [email protected]     get 2 "^m" $s
  [email protected]     get 2 "^m" $s
  [email protected]     let a=len($s)
  [email protected]     let b=a-12
  [email protected]     if b < 1 goto regtimeout
  [email protected]     let $c=$right($s,b)
  [email protected]     print $c,"
  [email protected] "
 [email protected]     let c=0
 [email protected]   :signal
 [email protected]     waitquiet 1 0.1
 [email protected]     send "AT+CSQ^m"
 [email protected]     get 2 "^m" $s
 [email protected]     get 2 "^m" $s
 [email protected]     let a=len($s)
 [email protected]     let a=a-6
 [email protected]     let $s=$right($s,a)
 [email protected]     if $s <> "0,0" goto sigcont
 [email protected]     if c > 3 goto sigexit
 [email protected]     let c=c+1
 [email protected]     pause 1
 [email protected]     goto signal
 [email protected]   :sigexit
 [email protected]     print "Signal strength measure 0,0 too low!"
 [email protected]     exit 1
 [email protected]   :sigcont
 [email protected]     print "Signal Quality:",$s,"\n"
 [email protected]     waitquiet 1 0.1
comgt 06:53:16 ->  ---End of script---
comgt 06:53:16 -> @0000 opengt
Trying list of devices
comgt 06:53:16 -> Opened /dev/ttyUSB2 as FD 3
comgt 06:53:16 -> @0011 set com 115200n81
comgt 06:53:16 -> @0033 set senddelay 0.05
comgt 06:53:16 -> @0056 send "AT+CFUN=1^m"
comgt 06:53:17 -> @0079 waitquiet 1 0.2
comgt 06:53:17 -> @0097 :start
comgt 06:53:17 -> @0108 flash 0.1
comgt 06:53:17 -> @0122 send "AT+CPIN?^m"
comgt 06:53:18 -> @0144 waitfor 30 "SIM PUK","SIM PIN","READY","ERROR","ERR"

moderated by frank-w: format output as code, change title

this seems to be a 5G-Card, not sure it will work (at least for the usb2…most 5g cards need usb3), but maybe sim-pins are different to 4g-cards. adapter looks like the one i have and i had no sim-issue on debian.

pleas format logs/code as code for better reading

Thanks the very fast reply! yes its a 5G card, sorry for the code i dont know how to format it (how i do it?) and uhmm so you think it wont work then !? maybe move to a rockchip ?

you can select the text and format it with the “</>”-button

i’m not sure it can work…i have only a 4g-card and it is working, maybe it can work, but with limited bandwith, i thought sim-pins should be same for 4g/5g. your adapter passes sim-pins to pcie-slot? or does it have a sim-slot on the adapter itself (i do not always trust images :wink: )?

mtk-boards are better supported in mainline and for router purposes they have better bandwith and offloading-features. imho bpi have no board yet supporting 5g cards (should be m.2 slot with usb3, no pcie), maybe there comes a r3 with with modification (@sinovoip are there any plans?)

in theory, “3042/3052 M.2 key B card size” Adaptador-M-2-Key-B-a-Mini-PCI-e-NGFF-M2-a-Mini-PCI-Express-PCIe.jpg_Q90.webp (79.9 KB)

The issue somehow is that i work with IT on remote so i was wanted badly a 5G working in this router as its a very good router. what is your 4g model!?

i have a sierra em7455 card (dell-branded from ebay), which works in mbim-mode (have not yet got qmi mode completely working), but no issue with sim-card.

i see, they seems to be m.2 keyb aswell, what about those mpcie, any decent speed ?

i did as you said remove the qmi and left nbim-mode it give me diff errors like

[email protected]:~# dmesg | grep modem
[   18.875727] usbserial: USB Serial support registered for GSM modem (1-port)
[   18.882851] option 1-1.1:1.0: GSM modem (1-port) converter detected
[   18.889253] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0
[   18.896351] option 1-1.1:1.1: GSM modem (1-port) converter detected
[   18.902753] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1
[   18.909860] option 1-1.1:1.2: GSM modem (1-port) converter detected
[   18.916266] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2
[   18.923367] option 1-1.1:1.3: GSM modem (1-port) converter detected
[   18.929767] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB3
[   18.944822] usbserial: USB Serial support registered for Qualcomm USB modem


[email protected]:~# dmesg | grep serial
[    0.069640] 11002000.serial: ttyS0 at MMIO 0x11002000 (irq = 122, base_baud = 2500000) is a ST16650V2
[    0.798303] 11003000.serial: ttyS1 at MMIO 0x11003000 (irq = 123, base_baud = 1625000) is a ST16650V2
[   14.285084] usbcore: registered new interface driver usbserial_generic
[   14.291690] usbserial: USB Serial support registered for generic
[   18.875727] usbserial: USB Serial support registered for GSM modem (1-port)
[   18.939044] usbcore: registered new interface driver qcserial
[   18.944822] usbserial: USB Serial support registered for Qualcomm USB modem

[email protected]:~# comgt
Trying list of devices
SIM ready
Waiting for Registration..(120 sec max).

The mpcie slot has no pcie lanes,only usb2,so you will have only usb2 speed.

Here is what i had done (not yet cleaned): https://wiki.fw-web.de/doku.php?id=en:bpi-r3:lte

Thanks a lot, seems to not work with openwrt, however i bought a PCIe Quectel EC25-E as it works with usb 2.0 lets wait BPI upgrade this board if they do … !

Man thanks a lot for the help!! wish you a great weekend!

Also the newer Quectel modem should work fine with OpenWrt, and also when connected via USB 2.0 only (which will cap the speed).

However, I read that it only works when using modemmanager, and modemmanager has to be built with support for QMI enabled.

Also note that this modem supports two SIM cards and afaik also has a built-in eSIM. You may need to switch to the correct SIM slot before your SIM is recognized.

i need build my own image or just get one from oenwrt? how to correct sim card? i may try if you explain :slight_smile:

Yes, you need to build OpenWrt from source, as by default ModemManager is built without the necessary support for Qualcomm’s QMI protocol (CONFIG_MODEMMANAGER_WITH_QMI).

To find out which logical SIM slot represents the physical SIM slot on the BPi-R3 you can use qmicli which has a on option to switch the SIM card slot, but ModemManager will just handle that more or less automatically afaik.

--uim-switch-slot=[(slot number)]               Switch active physical slot

Hello, I use Quectel EC25-EUX without modemmanager.

[email protected]_R3:~# cat /etc/openwrt_release  
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='SNAPSHOT'
DISTRIB_REVISION='r21666-68f983ba41'
DISTRIB_TARGET='mediatek/filogic'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt SNAPSHOT r21666-68f983ba41'
DISTRIB_TAINTS=''

[email protected]_R3:~# lsusb | grep -i ec25
Bus 001 Device 003: ID 2c7c:0125 Quectel EC25-EUX

[email protected]_R3:~# uci show network | grep wwan0
network.wwan0=interface
network.wwan0.proto='qmi'
network.wwan0.device='/dev/cdc-wdm0'
network.wwan0.auth='none'
network.wwan0.apn='internet'
network.wwan0.pdptype='ipv4'

I used this for the configuration.

hi guys, i will work on it at weekend then i give you all an feedback, however i got a ec25-e in case it dont work i will try with this one!

thanks!!!