I made all steps in a guide devzone.nordicsemi.com/.../ All works fine. After that prepare my own firmware like appendix 1. Also works good. I merge bootloader_setting.hex and bootloader and my application. Flash SD and this merged firmware. Works like my native firmware. If I recompile bootloader to
if (1)//(nrf_dfu_enter_check())
{
NRF_LOG_DEBUG("Application sent bootloader request\n");
enter_bootloader_mode = 1;
}
(I don't have buttons on a board) I can see DfuTarg on a nRF Connect. Looks work fine. Step by step- fine.
Now I want to enter in the bootload mode from my application by receive command from UART. I returned bootloader to normal view:
if (nrf_dfu_enter_check())
...
and like in an appendix 2 added in to my application
err_code = sd_power_gpregret_clr(0, 0xffffffff);
APP_ERROR_CHECK(err_code);
err_code = sd_power_gpregret_set(0, 0xB1);
APP_ERROR_CHECK(err_code);
If I start my app and check
if(NRF_POWER->GPREGRET == 0xB1)
{
return true;
}
I see that GPREGRET was set to 0xB1.
But if now I flash SD, merged bootloader with app, I can't see start bootload mode. more interesting- if I flash in this board SD and only bootloader, I do not see DfuTarg? If I flash in to anothe board same, I see DfuTarg. I try to erase all many times and flash again- no result. What happens? How to correct put board in to boot mode?