SDK 15.2 API 6.10 SES custom board
I am trying to get DFU to work and it is not seeming to work right.
I am trying to engage DFU mode by holding in button on board for 10-20 seconds. after releasing during allotted time i call enter_dfu_mode()
static void dfu_flash_cb(void *p_buf)
{
uint32_t result = *((uint32_t*)p_buf);
if(result == NRF_SUCCESS)
{
NRF_LOG_DEBUG("resetting into DFU...\n");
//blink the led 4x
tb_led_blink(TLBX_LED_LOGO, 4, 500);
NVIC_SystemReset();
}
else
{
NRF_LOG_DEBUG("error 0x%x writing DFU settings\n");
}
}
static void enter_dfu_mode(void)
{
NRF_LOG_DEBUG("writing dfu settings\n");
// uint32_t err_code = sd_power_gpregret_clr(GPREGRET, BOOTLOADER_DFU_START);
// APP_ERROR_CHECK(err_code);
//write the bootloader settings and reset
s_dfu_settings.enter_buttonless_dfu = true;
(void)nrf_dfu_settings_write(dfu_flash_cb);
}
I am using the dfu secure_bootloader no changes to it
I added the buttonless dfu service, not sure if necessary considering my way of wanting to enter DFU mode, from the buttonless_dfu example.
When i call the function it does nothing. When i try and write to the settings nrf_dfu_settings_write returns the following
<error> nrf_fstorage: p_fs->p_api check failed in nrf_fstorage_erase() with value 0x8. <warning> nrf_dfu_flash: nrf_fstorage_erase() failed with error 0x8. <error> nrf_dfu_settings: Could not erase the settings page!
Is there something i am missing with how i want to do this or is there a method to enter DFU mode with a button press i have not seen in examples yet.
Also. Once in DFU mode. How do you reset the device either after OTA is complete or after 20sec of no transfer?