This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

modem_info_short_get fails

Calling modem_info_short_get for the parameters MODEM_INFO_MCC, MODEM_INFO_MNC, MODEM_INFO_AREA_CODE and MODEM_INFO_CELLID fail. Call to modem_info_short_get works with MODEM_INFO_CUR_BAND.

I suspect the problem is in code. Tracing the MCC call shows that the call makes the correct AT query to the modem. However, the parameter returned is (rightly) a string. However the value expected for that parameter is a short so the call fails. Trying to call modem_info_string_get fails because the value is typed as a short in the parameter array.

I believe the answer is to pull the string then convert into a short. Or retype as a string and pull the first 3 characters of the string parameter.

Doug

Parents Reply Children
  • For v1.0.0, which is a stable release, we have not added these to documentation or code. 

    NCS Documentation for Master branch (updated weekly)

    NCS Documentation for tag v1.0.0

    To enable these commands, using the master branch, you must switch to master branch using

    cd <NCS_root>\nrf
    git checkout master
    west update

    This will enable these commands in modem_info.c (master branch)

    static const struct modem_info_data *const modem_data[] = {
    	[MODEM_INFO_RSRP]	= &rsrp_data,
    	[MODEM_INFO_CUR_BAND]	= &band_data,
    	[MODEM_INFO_SUP_BAND]	= &band_sup_data,
    	[MODEM_INFO_UE_MODE]	= &mode_data,
    	[MODEM_INFO_OPERATOR]	= &operator_data,
    	[MODEM_INFO_MCC]	= &mcc_data,
    	[MODEM_INFO_MNC]	= &mnc_data,
    	[MODEM_INFO_AREA_CODE]	= &area_data,
    	[MODEM_INFO_CELLID]	= &cellid_data,
    	[MODEM_INFO_IP_ADDRESS]	= &ip_data,
    	[MODEM_INFO_UICC]	= &uicc_data,
    	[MODEM_INFO_BATTERY]	= &battery_data,
    	[MODEM_INFO_TEMP]	= &temp_data,
    	[MODEM_INFO_FW_VERSION]	= &fw_data,
    	[MODEM_INFO_ICCID]	= &iccid_data,
    	[MODEM_INFO_LTE_MODE]	= &lte_mode_data,
    	[MODEM_INFO_NBIOT_MODE] = &nbiot_mode_data,
    	[MODEM_INFO_GPS_MODE]   = &gps_mode_data,
    };

    While in v1.0.0

     

    static const struct modem_info_data *const modem_data[] = {
    	[MODEM_INFO_RSRP] = &rsrp_data,
    	[MODEM_INFO_BAND] = &band_data,
    	[MODEM_INFO_MODE] = &mode_data,
    	[MODEM_INFO_OPERATOR] = &operator_data,
    	[MODEM_INFO_CELLID] = &cellid_data,
    	[MODEM_INFO_IP_ADDRESS] = &ip_data,
    	[MODEM_INFO_UICC] = &uicc_data,
    	[MODEM_INFO_BATTERY] = &battery_data,
    	[MODEM_INFO_TEMP] = &temp_data,
    	[MODEM_INFO_FW_VERSION] = &fw_data,
    	[MODEM_INFO_ICCID] = &iccid_data,
    };

    Let me know how that works for you.

  • OK clearly I was confused. I was running off the master. The calls fail as described in the initial post.  Thanks for the clarification.

  • It happens sometimes. Glad I could be of help! :) 
    Kind regards,
    Øyvind

Related