Why can't I get the ICCID number from 9160's modem on the ncs1.9.0 sdk?

After upgrading the SDK from 1.2.0 to 1.9.0, I found a problem: the ICCID numbers that could be read are now unreadable! I still use the AT instruction "AT% XICCID" to read, and it returns an error prompt. Why? The IMEI number and IMSI number can still be read.

my modem fw is V1.3.1,and this is my function:

#define CMD_GET_IMEI	"AT+CGSN"
#define CMD_GET_IMSI	"AT+CIMI"
#define CMD_GET_ICCID	"AT%XICCID"

void func(void)
{
    ...
    
	if(nrf_modem_at_cmd(tmpbuf, sizeof(tmpbuf), CMD_GET_IMEI) == 0)
	{
	#ifdef NB_DEBUG
		LOGD("imei:%s", tmpbuf);
	#endif
		strncpy(g_imei, tmpbuf, IMEI_MAX_LEN);
	}

	if(nrf_modem_at_cmd(tmpbuf, sizeof(tmpbuf), CMD_GET_IMSI) == 0)
	{
	#ifdef NB_DEBUG
		LOGD("imsi:%s", tmpbuf);
	#endif
		strncpy(g_imsi, tmpbuf, IMSI_MAX_LEN);
	}

	if(nrf_modem_at_cmd(tmpbuf, sizeof(tmpbuf), CMD_GET_ICCID) == 0)
	{
	#ifdef NB_DEBUG
		LOGD("iccid:%s", &tmpbuf[9]);
	#endif
		strncpy(g_iccid, &tmpbuf[9], ICCID_MAX_LEN);
	}
	
	...
	
}

  • I changed to %% but i still seem to have the issue,

    char *device_config_get_iccid(dev_config_shadow_id_t attribute)
    {
        nrf_modem_init();
        modem_info_init();
        char response[256];
        int response_size = sizeof(response);
        nrf_modem_at_cmd(response, response_size, "AT+CFUN=1");
        k_msleep(100);
        int result= nrf_modem_at_cmd(response, response_size, "AT%%XICCID");
       
        char *allocated_response = (char *) malloc(response_size);
        if (allocated_response == NULL) {
            // Error handling for malloc failure
            return NULL;
        }
       
        memcpy(allocated_response, response, response_size);
        return allocated_response;
    }
    Can someone help?
Related