Skip to main content
Slh
Senior
Jul 29, 2020 7:31 AM UTC
Solved

Using SIM Card with Pin Code in STM32CubeExpansion_Cloud_AZURE_V1.2.1

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.
Guillaume K
Guillaume KBest answer
ST Employee
Jul 31, 2020 11:46 AM UTC

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

Guillaume K
Guillaume KBest answer
ST Employee
Jul 31, 2020 11:46 AM UTC

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).

Slh
SlhAuthor
Senior
Aug 3, 2020 12:22 PM UTC

Thank you. It works:thumbs_up: