Quectel RM502Q-AE 5G Sub-6Ghz and 4G fallback

Hi

I bought a 5g modem kit for raspberry pi 5 from sixfab. It has a Quectel RM502Q-AE 5G modem integrated.

I am having problems connecting to my mobile provider via the raspberry pi 5 running openwrt. The modem is set up (using MBIM) as it should be. Settings are correct. I can connect to the internet via the pi’s wireless card. However, when I insert the sim and restart the modem device I get either a “PIN code rejected” or an “Unknown error (NO_REGISTRATION)”, error message.

I put the sim into my phone and connected to the web immediately with no problem, so the problem isn’t with the mobile internet provider. However, I notice I am connected with 4G. The area I am trying to sort this out is bad for 5g on this carrier.

My understanding was that this modem would fallback to 4g automatically.

Is this wrong?

If it is wrong, is there anything I can do in terms of setup to make this work over 4g?

Thanks

Make sure OpenWrt is not interfering your testing - temporary disable the network interface there.
For the diagnostic you will only need a terminall app like picocom.
Start from at+cpin? command.
Copy/paste the terminal output here as formatted text.

Thanks for your reply.

I deleted the interface then rebooted.
Apologies if you don’t need all of the output from picocom /dev/ttyUSB2 - I am new to picocom, am not familiar with the information it outputs here, and wonder if it might be helpful.

root@OpenWrt:~# picocom /dev/ttyUSB2
picocom v3.1

port is        : /dev/ttyUSB2
flowcontrol    : none
baudrate is    : 9600
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready
at+cpin?
+CME ERROR: 13
AT+CMEE=2
OK
at+cpin?
+CME ERROR: SIM failure

I will say that I just put the sim in my phone and connected to the web automatically, albeit over 4G.

Cannot edit my messages (
I think you need to check SIM card selection on the sixfab board, not on the modem.
I’m guessing you may have ESIM selected instead of a physical SIM.

Hi
Thanks for your reply - I have limited internet access so sometimes won’t reply immediately.

Your suggestion seems very possible. I am googling and looking through sixfab’s documentation for AT commands that seem relevant to this functionality.

AT commands are applicable to modems, while you need to do something with the adapter.

It seems I can only reply once an hour at the moment, so please bear with me.

Thanks for your reply.

I see that GPIO 13 pin is somehow involved in SIM select.

I haven’t used a raspberry pi’s gpio pins before, however, I am finding various tutorials utilising python to turn pins on and off, and I have enough experience with python to manage this, if this is what I have to do. Particularly if I can find a relevant tutorial. I am concerned at the risk of damaging the HAT experimenting with this when I don’t really know what I am doing!

So, do I need to use python (or something similar), or is there a simpler way of setting the SIM? If I do have to use python does anybody know of a tutorial as close to what I need as possible (in order to minimise risk of damaging the HAT)?

Thanks very much, any help is appreciated.

Since you’re using OpenWrt and need to manipulate GPIO, you should refer to their wiki.

Ok so I tried various commands:

cat /sys/class/gpio/gpiochip*/base | head -n1
512

The gpio pin specified in the quectel diagram is 13, so:

 echo 1 > /sys/class/gpio/gpio525/value

(I actually tried various things prior to this command but this, according to the advice I received on the openwrt forum, set the gpio pin 13 to the correct value).

root@OpenWrt:~#  cat /sys/class/gpio/gpio525/value
1

But, after restarting the device in openwrt I get:

Error: Unknown error (NO_REGISTRATION)

I was earlier concerned about the pin so I put in a deliberately wrong PIN and got:

Error: PIN code rejected

When I deleted the PIN completely and restarted the device the error message changed back to:

Error: Unknown error (NO_REGISTRATION)

After this I wanted to make sure that the SIM PIN was what I had set. So I tried the following, which I found confusing: (I am aware that all of the following might be wrong, but) although I am basically new to AT commands, I thought the +CPIN: READY response to AT+CPIN? meant there was no PIN set on the SIM, when I was sure I had set a PIN.

AT+CPIN?
+CPIN: READY

OK
AT+CLCK="SC",1,"1234"
+CME ERROR: 13
AT+CMEE=2
OK
AT+CPIN?
+CPIN: READY

OK
AT+CLCK="SC",1,"2345"
+CME ERROR: SIM failure

I changed the pin first to 1234, then to 2345 (because I just wondered if 1234 being a default pin for asda mobile was causingr something I didn’t expect to happen). Then finally I get ‘SIM failure’.

If the value of gpio525 is correct at 1 (I just tried it again and it is still set to ‘1’) could the SIM be corrupted somehow? It seems unlikely as the SIM connectts to the internet immediately in my phone (albeit over 4g), but I just wonder?

You do not need to post all these details. The only relevant information is this:

Once you get to this state, run through the checklist:

AT+CEREG?
AT+CGDCONT?
AT+CGPADDR
AT+CGCONTRDP
AT+QENG="servingcell"
AT+CEREG?
+CEREG: 0,0

OK
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","MY.INTERNET","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0,,,,,,,,,"",,,,0

OK
AT+CGPADDR
+CGPADDR: 1,""

OK
AT+CGCONTRDP
OK
AT+QENG="servingcell"
+QENG: "servingcell","SEARCH"

OK

Thank you.

Do you still have +cpin? reporting Ready?

At the point I issued those commands AT+cpin? probably was reporting Ready.

After rebooting today it wasn’t, so I entered the SIM PIN and reran the commands without any change.

Sorry if you didn’t want me to enter the SIM PIN and rerun the commands. As a newcomer I still have a limited amount of posts per hour/day so want to avoid any obvious next step if possible.

For similar reasons, and on the off chance you want to me to check, I will say that I am still getting the " Error: Unknown error (NO_REGISTRATION)" error after restarting the interface with this modem in openwrt.

Terminal ready
AT+cpin?
+CPIN: SIM PIN

OK
AT+CPIN="1234"
OK

+CPIN: READY

+QUSIM: 1

+QIND: SMS DONE

+QIND: PB DONE
AT+CPIN?
+CPIN: READY

OK
AT+CEREG?
+CEREG: 0,0

OK
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","MY.INTERNET","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0,,,,,,,,,"",,,,0

OK
AT+CGPADDR
+CGPADDR: 1,""

OK
AT+CGCONTRDP
OK
AT+QENG="servingcell"
+QENG: "servingcell","SEARCH"

OK

Thanks very much, your help is appreciated.

Again, delete or disable the interface in OpenWrt, terminal app is the only tool that you need for now.
Disable PIN on the SIM, restart modem and check:

AT+CPIN?
AT+CFUN?
AT+CSQ
AT+CGATT?
AT+CGACT?
Terminal ready
ATZ
OK
AT+CPIN?
+CPIN: SIM PIN

OK
AT+CPIN="1234"
OK

+CPIN: READY

+QUSIM: 1

+QIND: SMS DONE

+QIND: PB DONE
AT+CLCK="SC",0,"1234"
OK
AT+CPIN?
+CPIN: READY

OK
AT+CFUN?
+CFUN: 1

OK
AT+CSQ
+CSQ: 99,99

OK
AT+CGATT?
+CGATT: 0

OK
AT+CGACT?
+CGACT: 1,0

OK

Thanks

You need to follow the sequence precisely - disable PIN, restart modem then reconnect and do the rest.
Since the PIN check is already disabled, you need to restart the modem (at+cfun=1,1 or power toggle) then re-test with the remaining commands.

Hi, so I actually did delete the interface in OpenWrt, then power toggled the pi/modem, then ran through the commands after ssh’ing into the pi.

I have just repeated exactly that, thanks.

Terminal ready
AT+CPIN?
+CPIN: READY

OK
AT+CFUN?
+CFUN: 1

OK
AT+CSQ
+CSQ: 99,99

OK
AT+CGATT?
+CGATT: 0

OK
AT+CGACT?
+CGACT: 1,0

OK

If you are a member of the public helping me then I am very grateful for your help, but if you are a quectel employee then I will say I am extremely disappointed in the support I have received.

I was told I was posting too much and had to wait an hour. I waited an hour, at which point I was told I had to wait twenty hours. Yesterday I could make only one post before being prevented from posting further. If any quectel employee sees this and has the ability to, please give me the means to post here, otherwise I will have to assume this product is simply faulty and return it.

But as I say, AndrewZ iff you are just some guy helping me then I very much appreciate it.

Assuming the antennas are connected correctly, I would expect a different result. I’m running out of ideas, sorry.
As a final check, since you technically have two SIMs, send at+cimi to the modem and see if the response (your IMSI) starts with 234 then 2 digits for your carrier (no need to post these details here, just check).
I completely understand your frustration with the restrictions of the forum.
I’m not affiliated with Quectel.

Hi thanks for your reply.

I have delayed replying because I decided that in order to contact sixfab I needed to follow their guidelines for ‘getting started’, so I installed Raspberry Pi OS, python3, atcom etc and repeated the various suggestions that have been made to me without getting anywhere really. I am now going to go back and just ensure the antenna is connected as it should be.

There are a couple of things that may or may not be of interest.

First, in response to your last post, although I changed the last two numbers of the response here, the modem appeared to respond as expected.

at+cimi
234 ... 53

OK

Second, the value of gpio pin 525 changed after uninstalling openwrt/installing raspberrypi os. Does this indicate anything? (see below)

$ cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 512-543, parent: platform/107d508500.gpio, gpio-brcmstb@107d508500:
 gpio-512 (-                   )
 gpio-513 (2712_BOOT_CS_N      |spi10 CS0           ) out hi ACTIVE LOW
 gpio-514 (2712_BOOT_MISO      )
 gpio-515 (2712_BOOT_MOSI      )
 gpio-516 (2712_BOOT_SCLK      )
 gpio-517 (-                   )
 gpio-518 (-                   )
 gpio-519 (-                   )
 gpio-520 (-                   )
 gpio-521 (-                   )
 gpio-522 (-                   )
 gpio-523 (-                   )
 gpio-524 (-                   )
 gpio-525 (-                   )
 gpio-526 (PCIE_SDA            )
 gpio-527 (PCIE_SCL            )
 gpio-528 (-                   )
 gpio-529 (-                   )
 gpio-530 (-                   )
 gpio-531 (-                   )
 gpio-532 (PWR_GPIO            |pwr_button          ) in  hi ACTIVE LOW
 gpio-533 (2712_G21_FS         )
 gpio-534 (-                   )
 gpio-535 (-                   )
 gpio-536 (BT_RTS              )
 gpio-537 (BT_CTS              )
 gpio-538 (BT_TXD              )
 gpio-539 (BT_RXD              )
 gpio-540 (WL_ON               |wl_on_reg           ) out hi 
 gpio-541 (BT_ON               |shutdown            ) out hi 
 gpio-542 (WIFI_SDIO_CLK       )
 gpio-543 (WIFI_SDIO_CMD       )

gpiochip1: GPIOs 544-547, parent: platform/107d508500.gpio, gpio-brcmstb@107d508520:
 gpio-544 (WIFI_SDIO_D0        )
 gpio-545 (WIFI_SDIO_D1        )
 gpio-546 (WIFI_SDIO_D2        )
 gpio-547 (WIFI_SDIO_D3        )

gpiochip2: GPIOs 548-564, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c00:
 gpio-548 (RP1_SDA             )
 gpio-549 (RP1_SCL             )
 gpio-550 (RP1_RUN             |RP1 RUN pin         ) out hi 
 gpio-551 (SD_IOVDD_SEL        |vdd-sd-io           ) out hi 
 gpio-552 (SD_PWR_ON           |sd_vcc_reg          ) out hi 
 gpio-553 (SD_CDET_N           |cd                  ) in  lo ACTIVE LOW
 gpio-554 (SD_FLG_N            )
 gpio-555 (-                   )
 gpio-556 (2712_WAKE           )
 gpio-557 (2712_STAT_LED       |ACT                 ) out hi ACTIVE LOW
 gpio-558 (-                   )
 gpio-559 (-                   )
 gpio-560 (PMIC_INT            )
 gpio-561 (UART_TX_FS          )
 gpio-562 (UART_RX_FS          )
 gpio-563 (-                   )
 gpio-564 (-                   )

gpiochip3: GPIOs 565-570, parent: platform/107d517c00.gpio, gpio-brcmstb@107d517c20:
 gpio-565 (HDMI0_SCL           )
 gpio-566 (HDMI0_SDA           )
 gpio-567 (HDMI1_SCL           )
 gpio-568 (HDMI1_SDA           )
 gpio-569 (PMIC_SCL            )
 gpio-570 (PMIC_SDA            )
gpiochip4: GPIOs 571-624, parent: platform/1f000d0000.gpio, pinctrl-rp1:
 gpio-571 (ID_SDA              )
 gpio-572 (ID_SCL              )
 gpio-573 (GPIO2               )
 gpio-574 (GPIO3               )
 gpio-575 (GPIO4               )
 gpio-576 (GPIO5               )
 gpio-577 (GPIO6               )
 gpio-578 (GPIO7               )
 gpio-579 (GPIO8               )
 gpio-580 (GPIO9               )
 gpio-581 (GPIO10              )
 gpio-582 (GPIO11              )
 gpio-583 (GPIO12              )
 gpio-584 (GPIO13              )
 gpio-585 (GPIO14              )
 gpio-586 (GPIO15              )
 gpio-587 (GPIO16              )
 gpio-588 (GPIO17              )
 gpio-589 (GPIO18              )
 gpio-590 (GPIO19              )
 gpio-591 (GPIO20              )
 gpio-592 (GPIO21              )
 gpio-593 (GPIO22              )
 gpio-594 (GPIO23              )
 gpio-595 (GPIO24              )
 gpio-596 (GPIO25              )
 gpio-597 (GPIO26              )
 gpio-598 (GPIO27              )
 gpio-599 (PCIE_RP1_WAKE       )
 gpio-600 (FAN_TACH            )
 gpio-601 (HOST_SDA            )
 gpio-602 (HOST_SCL            )
 gpio-603 (ETH_RST_N           |phy-reset           ) out hi ACTIVE LOW
 gpio-604 (-                   )
 gpio-605 (CD0_IO0_MICCLK      |cam0_reg            ) out lo 
 gpio-606 (CD0_IO0_MICDAT0     )
 gpio-607 (RP1_PCIE_CLKREQ_N   )
 gpio-608 (-                   )
 gpio-609 (CD0_SDA             )
 gpio-610 (CD0_SCL             )
 gpio-611 (CD1_SDA             )
 gpio-612 (CD1_SCL             )
 gpio-613 (USB_VBUS_EN         )
 gpio-614 (USB_OC_N            )
 gpio-615 (RP1_STAT_LED        |PWR                 ) out hi ACTIVE LOW
 gpio-616 (FAN_PWM             )
 gpio-617 (CD1_IO0_MICCLK      |cam1_reg            ) out lo 
 gpio-618 (2712_WAKE           )
 gpio-619 (CD1_IO1_MICDAT1     )
 gpio-620 (EN_MAX_USB_CUR      )
 gpio-621 (-                   )
 gpio-622 (-                   )
 gpio-623 (-                   )
 gpio-624 (-                   )

This confirms that you’re talking to the right SIM.

GPIO 13 that is used to control the SIM switch on the external board is technically not in use. However, the proper SIM is selected, probably due to the default state of the given GPIO.