Skip to main content
Renesas Singapore - Knowledgebase

How do I change the default MAC Address using the MCU unique ID during run time in NetX and NetX Duo applications?

Last Updated:01/23/2018


How do I change the default MAC Address to an MCU unique address, at runtime, in NetX and NetX Duo applications?


To set a unique MAC address during run time, you need to add a special callback function that allows this change. Simply select your ETHERNET PORT module where you define the NetX IP Instance associated with the NetX or NetX Duo application. An example is shown in the below figure.


Then select the Callback in the properties tab as shown in the following figure.


In this example, the name of the function is entered as setMacAddress.  An example definition of that function is given below and it uses the FMI unique_idGet function to generate an MCU unique MAC Address. This code would be placed in the .c file of the thread that owns the Netx IP instance.

voidsetMacAddress (nx_mac_address_t*_pMacAddress)


    //  REA's Vendor MAC range: 00:30:55:xx:xx:xx

    fmi_unique_id_t id;


    ULONG lowerHalfMac=((0x55000000)|(id.unique_id[0]&(0x00FFFFFF)));






Suitable Products