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

Read Thread MAC address

Hello All, 

I am developing a product based on thread protocol. 

I am using nRF52840 development kit and nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8 SDK. 

I am new to thread protocol so I would like to know getting started example for my project. 

I have referred the thread related document from Nordic info center. 

With reference to CoAP server and client example test setup I ran CoAP server on 1 dev-kit and CoAP client on another dev-kit. It worked as per explanation. 

Project Requirement, 

-> My final project contains 2 parts, 1) nRF52840 as RF device (i.e.,Node)  which based on Thread and 2) is Thread based Gateway ( this any Gateway) 

-> my node should connect to gateway (like how Zigbee base Node and Coordinator connect)  and there will be some command exchange(like for example light_bulb from Zibgee) 

I have 3 queries which are listed below, 

1) I going to use base example as CoAP server example? Is this correct example for my requirement? 

2) Assuming CoAP  server is my getting started code for development I did some test here to Get MAC address. But I am not sure whether it is correct response or not? 

   below is the snippet which I used to read MAC. I modified the thread_utils.c file thread_init() function. I used otLinkGetFactoryAssignedIeeeEui64(); function to read MAC id. 

 a)  I am not sure about function parameter passed are correct? Please check the snippet and let me know your feedback. 

 b) With above function, I got one value which as below, but I am not sure the representation of data means MSB is [0] postion or MSB is [7] position?let me know your feedback.

[0]:0xf4

[1]:0xce

[2]:0x36

[3]:0x2f

[4]:0xac

[5]:0xe2

[6]:0xc1

[7]:0x9d

void thread_init(const thread_configuration_t * p_config)
{
    otExtAddress ieeeEUI64;
    otError error;

    otSysInit(0, NULL);

#if defined(MULTIPROTOCOL_802154_CONFIG_PRESENT) && defined(MULTIPROTOCOL_802154_MODE)
    uint32_t retval = multiprotocol_802154_mode_set((multiprotocol_802154_mode_t)MULTIPROTOCOL_802154_MODE);
    ASSERT(retval == NRF_SUCCESS);
#endif

#if !defined OPENTHREAD_RADIO
    platform_init();
#endif

#if FEM_CONTROL_DEFAULT_ENABLE
    fem_init();
#endif

    mp_ot_instance = otInstanceInitSingle();
    ASSERT(mp_ot_instance != NULL);

    NRF_LOG_INFO("Thread version   : %s", (uint32_t)otGetVersionString());
    NRF_LOG_INFO("Network name     : %s",
                 (uint32_t)otThreadGetNetworkName(mp_ot_instance));
    
     otLinkGetFactoryAssignedIeeeEui64(mp_ot_instance,&ieeeEUI64); //read mac address

     NRF_LOG_INFO("IeeeEUi64 Id     : %x",ieeeEUI64.m8);

..................
.................// code default
.............
}

3) Is there any other way to get MAC address of device other than programming(means which using API/function) ? 

Thanks and Regards

Rohit R

Parents Reply Children
No Data
Related