Inconsistent crash handling NRF_EVT_FLASH_OPERATION_SUCCESS on first run after flash memory reset

During startup, I am encountering a new issue where the chip crashed out during boot. See screenshot for crash details:

"mesh_main_start()" is called from my main application code, and invoked after the Soft Device and BLE stack have been fully initialized. From there it calls "mesh_provisionee_start()" and it's all SDK calls after that. It looks like while generating uECC keys I'm running into a Soft Device event, and things are exploding as that event is handled.

What is unusual is that p_op->p_fs->evt_handler appears to be holding a value of 0x81febaf5 which falls outside the flash or ram ranges, so I think that may be the problem, but don't know where it's coming from or how to change it.

Some additional details:
- Only happens after a full memory reset ("nrfjprog -e") then reflashing the application
- If I reset/run multiple times, eventually it gets past this crash
- If it makes it past the crash, it provisions and functions correctly
- Once it makes it past the crash once, it never happens again

Thanks!
Jeremy

Parents
  • Hi Jeremy,

    When the peer manager is initialized, it will also initialize FDS. And if this is the first boot after a full erase and programming, the FDS pages will be fully erased, and FDS will write a page header to each of the FDS pages. So in this case, flash write operations during initialization is expected.

    The question is why this causes a problem in your application, and where, but that is difficult to say from the information here. Do test with optimizations turned off when you see that the evt_handler pointer is invalid? If no, it could be an issue with debugging and not an actual issue. Of if this is indeed the case, then the question is why. Perhaps another part of the application writes to an invalid pointer, or you have a buffer overflow or similar that corrupts some memory? These are just speculations, though.

  • I worked backwards until my application was stripped down to almost an exact match an example project that was working and I was still having the error ... until I matched the preprocessor definitions.

    It appears that adding "INITIALIZE_USER_SECTIONS" to my definitions appears to have fixed my issue. With that change I was able to revert all the other changes and still maintained a valid fds evt_handler pointer.

    Does that sound like the correct fix? My issue appears to be a bit sticky, I've thrown hundreds of darts at the wall today, I don't fully understand what that define accomplishes, and want to make sure I didn't just get lucky.

    Thanks!

Reply
  • I worked backwards until my application was stripped down to almost an exact match an example project that was working and I was still having the error ... until I matched the preprocessor definitions.

    It appears that adding "INITIALIZE_USER_SECTIONS" to my definitions appears to have fixed my issue. With that change I was able to revert all the other changes and still maintained a valid fds evt_handler pointer.

    Does that sound like the correct fix? My issue appears to be a bit sticky, I've thrown hundreds of darts at the wall today, I don't fully understand what that define accomplishes, and want to make sure I didn't just get lucky.

    Thanks!

Children
Related