Hello,
for my project I'm using: SDK11, s130, nrf51 (nrf51822-QFAC), central and peripheral roles, DFU.
I've managed to have both peripheral and central roles with DFU with solution taken from this post: devzone.nordicsemi.com/.../
I wanted to add FDS functionality for storing some data in flash, so I've followed Nordic's example: github.com/.../nRF52-fds-example
both solutions work great separately, but I have problems when I try to mix them, whilst trying to manage FDS write operation. Here is my main:
int main(void)
{
ret_code_t err_code;
bool erase_bonds=true;
bool app_dfu = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_END);
if (app_dfu)
{
NRF_POWER->GPREGRET = 0;
}
// initializations..
ble_stack_init();
peer_manager_init(erase_bonds, app_dfu);
db_discovery_init();
gap_params_init();
services_init();
// adding FDS for custom use
err_code = fds_test_init(); // OK, fs callback came
nrf_delay_ms(100);
APP_ERROR_CHECK(err_code);
err_code = fds_test_find_and_delete(); // OK, fs callback came
APP_ERROR_CHECK(err_code);
err_code = fds_test_write(); // <--- CRASH Here
APP_ERROR_CHECK(err_code);
//wait until the write is finished.
while (write_flag==0);
fds_read();
advertising_start();
while(1) { }
}
fds_test_init() and fds_test_find_and_delete() return NRF_SUCCESS and fds_test_write() doesn't return anything just crashes somewhere and nRF resets.
Settings from fds_config.h are defaults. For dual bank bootloader I used code from example located here: nRF5_SDK_11.0.0\examples\dfu\bootloader\pca10028\dual_bank_ble_s130\arm5_no_packs
Another try:
I also tried to use just Flash Storage: infocenter.nordicsemi.com/index.jsp and again, without bootloader it works fine: I store 0xDEADBEAF and I'm able to read this value. When I upload application by DFU (so bootloader is flashed) then storing doesn't work, I store 0xDEADBEEF but when read value from p_start_addr I get 0x0.
I printed start and end addresses:
LOG_INFO("addr start: 0x%X", fs_config.p_start_addr);
LOG_INFO("addr end: 0x%X", fs_config.p_end_addr);
and I've got:
addr start: 0x3B000
addr end: 0x3B400
My appliaction size is 63276B.
Another thing I observed: my appliaction size (with debug on) is 63276B, when I turn off debug size is shrink to 49716B and then there is no problem, I'm able to read proper value after uploading (by OTA DFU) application. However, the start and end addresses are the same as above. Maybe it is somehow messed up with bootloader (which starts at 0x3C000).
any ideas what could be wrong?
Thanks!