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.
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.
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?
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?
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.