Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.

Hi,

     I'm currently working with the nRF9160DK and referencing the asset tracking v2 application code. For my project, I need to retrieve the IMEI number of the connected board through the COM port, which serves as the terminal in Visual Studio. However, I'm unsure where in the asset tracking example code the IMEI number of the board is obtained and sent to the nRF Cloud. Could you please provide any sample code to retrieve the IMEI number?

Parents Reply
  • Hi,
        I added the header as they mentioned #include"nrf_modem_at.h" and added this code in my GNSS sample code and called the function in main() foo();

    void foo(void)
    {
            int err;
            char response[64];

            err = nrf_modem_at_cmd(response, sizeof(response),  "AT+CGSN=%d", 1);
            if (err) {
                    /* error */
                    printf("error\n");
            }

            /* buffer contains the whole response */
            printf("Modem response:\n%s", response);
    }
     but in the output, I'm getting message. for confirmation I added printf("error\n");so the output is given below.
     error
    Modem response:


    there is no response but in return of err we are getting true value for err.
    what we need to do?
Children
Related