This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem Loading Bonding Info From Flash

Unless manually set the value of bond_init_data.bonds_delete to true in the function bond_manager_init to clear bonded masters, I end up in the HardFault_handler. The last call I can trace is line 641 in pstorage.c,memcpy (p_dest, (((uint8_t *)p_src->block_id) + offset), size); From that code it doesn't look like a memcpy is ever expected to fail.

The example I'm primarily working on is the experimental ble_app_ancs, but it occurs in other examples as well. I am using the latest SDK and soft device, but this has happened with the previous version as well.

I suspect this is related to my target setup, but I'm just using the defaults from the example project - nrf51822_xxaa_s110 (256). I've had a look at the Dev Kit User Guide, but those numbers seem to be different.

How do I go about finding the source of this issue?

Thanks, Eric

Parents
  • A HardFault can be caused by a number of different reasons, but one of them is unaligned access. Even though the line above the one you quote is supposed to catch this, can you please check what the pointer values are at the point where you suspect it fails?

    Also, even when you get a HardFault, you should be able to see a backtrace to the point that caused it with version 6.0.0 of the softdevice. What do you see in the call stack window when you put a breakpoint in the HardFault handler?

    A HardFault is also what will happen if you try to do an operation that the MPU forbids, or try to access flash/RAM outside the valid areas. This does however seem unlikely in this case, unless you have very strange values for the flash pages used for bonds and system attributes, but it could be worth checking.

    If you still have trouble, could you please share your complete project? As normal, if you need confidentiality, please create a support case on our regular web site.

    Edit: Rephrased somewhat in first and third paragraph.

Reply
  • A HardFault can be caused by a number of different reasons, but one of them is unaligned access. Even though the line above the one you quote is supposed to catch this, can you please check what the pointer values are at the point where you suspect it fails?

    Also, even when you get a HardFault, you should be able to see a backtrace to the point that caused it with version 6.0.0 of the softdevice. What do you see in the call stack window when you put a breakpoint in the HardFault handler?

    A HardFault is also what will happen if you try to do an operation that the MPU forbids, or try to access flash/RAM outside the valid areas. This does however seem unlikely in this case, unless you have very strange values for the flash pages used for bonds and system attributes, but it could be worth checking.

    If you still have trouble, could you please share your complete project? As normal, if you need confidentiality, please create a support case on our regular web site.

    Edit: Rephrased somewhat in first and third paragraph.

Children
No Data
Related