Loose MAC address


I have a custom application that can store data in flash. But sometimes, after a flash write, the device looses its MAC address and it restarts with the MAC address defined in APP_BSP_MAC_ADDRESS. This is very anoying because devices with same MAC cannot communicate.
I know that the NVRAM is located in the last flash partition, and I don’t write in it. What could be the reason for the data in NVRAM to be corrupted?




I suspect that the loss of the MAC address is due to a conflict with an other process when writting to the flash. I assume this could be avoided by an initial call to “NAFlashCreateSemaphores”, but this function always returns a negative value (NAFLASH_MEMORY_OUTOFBOUND if I remember).

Does somebody use several thread that can write to flash?
Any idea?



Paul sent in an e-mail that this is resolved, copying it here as an fyi:

I have finally resolved the problem. It appeared that the flash write failed when a FastIP interrupt occured at the same time. In this FastIP handler was a flash reading conflicting with the writing. Ok it’s not very clever to read the flash at this point. But the conflict resulted by a total flash erasing, including NVRAM data.

Yes, thanks, it was my own response :wink: !
I have forgotten to post it on this subject…


Hi. I think I have the same problem, that the MAC address gets erased. But how do I fix the MAC address? The problem happens to a CONNECT ME without JTAG.


You’ll need to use the dialog menu on the serial port to write the MAC address (assuming you’re using NET+OS).

Thank you very much for the reply. I have tried that, but the problem is that there is no menu showing. All I got from the window is this: “.Hello World. recovery Ready” (without quotes). “recovery” is the name of a project I built with all the default settings and nothing added or changed. So I’m guessing that the NVRAM is somehow corrupted. Do you know anyway to recover the NVRAM?

Thank you very much.


I think you’ll need to reprogram the module with a default NET+OS application. Fix the mac, and then reprogram with your application.

Tip: You might want to consider adding the ability to change the MAC address to your program.

I reprogrammed it with a default NET+OS application, but it still doesn’t show the dialog when I connect it though serial port. I’m trying to use the function customizeSetMACAddress(). I’m really new to Digi and I don’t know how to use that function. Can you give me a step-by-step instruction on how to use that function? Do I need to add a new file boardParams.c?

Thank you very much!

if you don’t get a dialog menu, then I wouldn’t be sure that you have the default project loaded.

Make sure that you have it enabled in your project properties.

In file bsp_sys.h is a maro entitled BSP_ENABLE_DIALOG. It is located in the platforms directory of your installation tree and/or the bsp directory of an ESP project. If this is defined as FALSe, you will not get a dialog. Try looking for this MACRO and update as needed.

Hi Anika,
at first check you header file named appconf.h and find this definition #define APP_USE_NVRAM

you should have select APP_FOR_ALL_PARAMETERS which loads all parameters from nvram

One you have rewrite it by some way, you can set it up again manually.

By API ref. you can try

BYTE mac_addrp[] = {0x01,0x02,0x03,0x04,0x05,0x06}; // fill up with your MAC
int customizeSetMACAddress(mac_addrp);

Or for something different im readig all dev boards params where is MAC stored

devBoardParamsType myDevBoardParams;  // read params
memset((char *)&myDevBoardParams, '\0', sizeof(devBoardParamsType));
myDevBoardParams.ethernetMac[0] = 0x01;    // your mac
myDevBoardParams.ethernetMac[1] = 0x02;
myDevBoardParams.ethernetMac[2] = 0x03;
myDevBoardParams.ethernetMac[3] = 0x04;
myDevBoardParams.ethernetMac[4] = 0x05;
myDevBoardParams.ethernetMac[5] = 0x06;
// myDevBoardParams.rootPassword   here is you root password
customizeWriteDevBoardParams(&myDevBoardParams);  // write params