Skip to main content
Graduate II
July 29, 2020
Solved

Using SIM Card with Pin Code in STM32CubeExpansion_Cloud_AZURE_V1.2.1

  • July 29, 2020
  • 2 replies
  • 873 views

I am using board P-L496G-CELL0x and STM32CubeExpansion_Cloud_AZURE_V1.2.1 software. When I use a SIM card without a Pin Code, the program works fine and I can connect to Microsoft Azure. But the problem is that when the SIM card has a Pin Code, the program does not run and does not ask me for a Pin Code in the terminal.

What should I do to use the SIM card with Pin code?

There is a function in the program called:

at_status_t called fCmdBuild_CPIN (atparser_context_t * p_atp_ctxt, atcustom_modem_context_t * p_modem_ctxt) 

That is related to the PIN code, but I do not know how to use it and what other functions may should use.

    This topic has been closed for replies.
    Best answer by Guillaume K

    I've found one place where the PIN code seems to be set : it's in Middlewares\ST\STM32_Cellular\Core\Cellular_Service\Radio_Service\Cellular\Src\cellular_service_task.c where function CST_init_modem_mngt() calls osCDS_init_modem() with parameter GOOD_PIN_CODE. GOOD_PIN_CODE is defined as empty string "" at beginning of same file. You can try to change GOOD_PIN_CODE with your SIM card PIN code in this source file. Apparently there's no way to set it from upper levels (application).

    2 replies

    ST Employee
    July 31, 2020

    I've found one place where the PIN code seems to be set : it's in Middlewares\ST\STM32_Cellular\Core\Cellular_Service\Radio_Service\Cellular\Src\cellular_service_task.c where function CST_init_modem_mngt() calls osCDS_init_modem() with parameter GOOD_PIN_CODE. GOOD_PIN_CODE is defined as empty string "" at beginning of same file. You can try to change GOOD_PIN_CODE with your SIM card PIN code in this source file. Apparently there's no way to set it from upper levels (application).

    SlhAuthor
    Graduate II
    August 3, 2020

    Thank you. It works:thumbs_up: