Hi,
I would like to know what are the prerequisites to get the ICCID of the sim card:
int err = 0; LOG_INF("Initializing modem library"); /* initialize the modem library */ err = nrf_modem_lib_init(NORMAL_MODE); if (err) { LOG_ERR("nrf_modem_lib_init error: %i", err); } /* register callbacks */ lte_lc_register_handler(on_modem_lte_lc_event); err = nrf_modem_at_printf("AT%%CESQ=1"); if (err) { LOG_ERR("nrf_modem_at_printf(CESQ): %i", err); return; } /* initialize info structures, this will contain the SIM card numbers as well */ err = modem_info_init(); if (err) { LOG_ERR("Failed to initialize modem info!"); return; } LOG_INF("Changing functional mode"); modem_get_info(INFO_IMEI); <=== in this internal function I can get the IMEI at this stage char temp_char[24] = {0}; err = nrf_modem_at_cmd(temp_char, sizeof(temp_char), "AT%%XICCID"); if(err == 0) { LOG_INF("AT cmd ICCID: %s", temp_char); } else { LOG_ERR("AT cmd ICCID failed %d", err); <=== I always get here with error 65536 }
This is the code I use, nothing special. I can get the IMEI of the modem but not the ICCID, I always get error 65536 which does not really make sense to me (= 0x10000, which is also not a negative nr).
Question is what do I need more to get the ICCID?
At this moment I do a lte_lc_init_and_connect, but that feels like overkill, just to get the ICCID...
Kind regards