Problem: Module running NET+OS changes MAC to 00:40:9D:43:35:97
Explanation:00:40:9D:43:35:97 is the
default MAC address, and means your system has reset all NVRAM values to defaults.
NVRAM is stored/emulated in the last sector of FLASH, and is protected by CRC. This means that upon system boot NET+OS calculates the CRC, and compares it with the one previously stored in FLASH which was calculated during the most recent write.
The NVRAM would reset to defaults in 3 cases:
-user requested Reset of NVRAM in serial dialog, via prompt in DigiESP when you start debug session, or through iDigi
-software purposely or accidentally calls “reset NVRAM” customizeUseDefaultParams(nvParamsPtr);)
-during boot NVRAM CRC check fails, and the system decides it needs to reset NVRAM to default values.
This can be caused by accidental FLASH write to NVRAM sector (due to a memory leak in code or file-system growing too much for example). Another reason could be a bad FLASH, where read of some blocks is inconsistent. But the most common reason for this to happen is when a power-cycle or external reset was triggered during the legitimate system write to NVRAM. If such an event occurs after the system already wrote the new variable to NVRAM, but before the new calculated CRC was updated there, the CRC check will fail after reboot, and the system will reset the NVRAM structure to default as designed.From our experience in 99% of all cases – the reason for this is reset/power failure that happens while NVRAM is being updated – The new value was written to the NVRAM structure, but the new CRC has not been yet calculated and written. If the reset comes between those 2 events you would automatically get a CRC mismatch on the next boot and the NVRAM structure will be reset.
Does your system have to do frequent updates to NVRAM? Can they be eliminated?
Was the size of the NVRAM sector increased?
Do you use FLASH filesystem?
You can consider using the backup NVRAM sector that will be copied to the main one instead of reset to defaults. In your platform’s bsp_drivers.h file, modify -#define BSP_NVRAM_DRIVER BSP_NVRAM_LAST_FLASH_SECTORTo #define BSP_NVRAM_DRIVER BSP_NVRAM_LAST_2_FLASH_SECTORS to enable backup NVRAM sector.
Last updated: Aug 23, 2017