First, as to how your ID block probably got corrupted. Runaway code can certainly cause flash corruption, such as an erased ID block, and is usually very difficult to debug. Some things to check for include large auto buffers, arrays or structures that consume considerable stack space. When combined with deeply nested or recursive function calls, large auto items can greatly contribute to stack overflow. Less commonly, large function parameter items may be a problem, but it is still worth checking that large-item parameters are passed by reference rather than by value wherever possible (i.e. pass a pointer to a large item, rather than the large item itself) . Some customers have also experienced runaway code problems due to use of uninitialized variables or pointers and particularly calls via uninitialized function pointers.
If the application is writing directly into the reserved ID+User blocks area (i.e. bypassing the standard WriteUserBlock functionality) then a single ill-timed loss of power could result in a corrupted or erased ID block.
It could also be that, even in the above direct-write case, that excessive flash writes have simply worn the flash out. For example, if the custom application is frequently calling the standard WriteUserBlock functionality, say once per minute, then a flash rated for 100,000 writes to any individual sector could be worn out after only a little more than two months (69.444 days). If the custom application is frequently writing to the User block, our recommendation is to write larger amounts of data less frequently, perhaps using battery-backed memory to buffer more interim data.
As for rewriting the ID block, see this link http://www.digi.com/support/productdetail?pid=4978&type=documentation. Download Rabbit - Write ID Block 10.70 which is under General Documentation. Unzip the file into the Dynamic C directory. Then go to the Utilities\Write_ID folder and open write_idblock_rcm66xxw.c. Follow the instructions at the top of the file for whichever version of the RCM6600W family that you have.
Apr 12, 2019