How to detect if a SIM card is not inserted at startup

How can I detect when no SIM card is inserted at startup?
The purpose is to operate without a connection if there is no SIM card.

[Environ]
    nRF Connect SDK v3.2.1
    nRF9151 (Custom board)
    VSCode (1.109.5)

Currently, this is done in the following way:

  1. Modem Initialization (nrf_modem_lib_init())
  2. LTE connection processing (lte_lc_connect_async())
  3. After 1 second, send AT command [AT%XSIM?]
    Here, check "%XSIM: 1". (0 means none)
    (5 trials every 200ms)

This will take time.
Is there a better way?

Best regards,
Kato.

Parents
  • Hi,

    If you are doing a custom PCB, you might want to find a SIM card socket that has a "SIM_DETECT" pin and connect it to a GPIO on the microcontroller. That would be the easiest and fastest way to check if a SIM card is present or not in the socket.

    If you cannot do that for some reason, you can try to send the needed AT commands by yourself, it might be faster than going through the full LTE api. But this method is still way longer and power hungry than the GPIO pin solution.

    I hope I was able to help. If you have any more questions, feel free to ask.

    Best regards,

    Simon D-M 

  • Thanks, your constant support.

    This board is a prototype, "SIM DETECT" method is difficult. (Low priority and mass production costs)

    What are the "needed AT commands"?
    Are there any other options besides "AT%XSIM?" and "AT+CPIN?"

    Best regards,

    Kato.

Reply Children
No Data
Related