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

IMEI and HWID

I am trying to get the IEMI and HWID in  my code. I was able to read the IEMI as a client ID using the following API.

nct_client_id_get(client_id_buf);
printk("Client ID: %s\r\n",client_id_buf);

with the result below that is my correct board ID. Is this the correct way to get the IEMI?

[00:00:11.602,996] <dbg> nrf_cloud_transport.nct_client_id_get: client_id = nrf-352656100378150
Client ID: nrf-352656100****** (I blanked out complete client ID)

How do I read the HWID information of the form XX:XX:XX:XX:XX:XX printed on the board?

  • Hi.

    Is this the correct way to get the IEMI?

    Not really, but it might be a usable way regardless. The "correct" answer is that you should use the +CGSN AT command. To get the IMEI, the command is AT+CGSN=1.

    To easier send the the AT command from your application, you can use the modem_info library to get the IMEI, or the at_cmd library to send the AT command yourself.

    The function you found is used internally in the nrf_cloud library to get the client ID used by nrf_cloud if no other ID is provided.

    The reason for why the nRF Cloud client ID is based on the IMEI is that AWS (which nRF Cloud is built on) requires client IDs to be globally unique. As the IMEI is already a gloablly unique number that the device knows it is a very easy way of automatically creating globally unique IDs that the device is able to construct themselves at runtime (which is what the nct_client_id_get() function does). However, the nrf_cloud library does allow you to override this ID generation and instead use another pre-defined ID.

     

    How do I read the HWID information of the form XX:XX:XX:XX:XX:XX printed on the board?

     From the nRF91? You cannot. At least not without some help. The HWID is the Bluetooth MAC address of the nRF52840 on the nRF91DK. So in order for the application running on the nRF9160 to get the HWID, it must first be read from the nRF52840, then sent to the nRF9160, e.g. over UART.

    The question is though, why do you want to read the HWID? On nRF Cloud, it is used only as an "ownership code". A piece of information that is only tied to the board, which is used by nRF Cloud to confirm that you actually are in possession of the board. If you are adding your own custom board to nRF Cloud, you are free to set the client ID and ownership code/HWID/PIN to whatever you want (although the client ID can not be on the form nrf-<18 numbers> as nRF Cloud will then believe you have a "Nordic device", i.e. a Thingy:91 or a 91DK, which already has an ownership code).

    Best regards,

    Didrik

  • Didrik

    thanks or explaining how to access the EMEI. you are correct we will not need HWID. you can close this ticket.

Related