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

Hold output pin during bootloader jump

I am trying to keep an output pin asserted while I jump to the DFU on the 52840.

We have a dead-man switch hooked up to pin 19.  I need to hold this pin high while I jump to the bootloader.  However, it seems like it is being reset to an input or toggle low when I jump.

Here is how I jump to the bootloader.

Fullscreen
1
2
3
4
5
6
// Save update in restart register
NRF_POWER->GPREGRET = BOOTLOADER_DFU_START;
nrf_sdh_disable_request();
StartApplication(0xf1000);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
void StartApplication(uint32_t start_addr)
{
__ASM volatile(
"LDR R2, [%0] \n" // Get App MSP.
"MSR MSP, R2 \n" // Set the main stack pointer to the applications MSP.
"LDR R3, [%0, #0x00000004] \n" // Get application reset vector address.
"BX R3 \n" // No return - stack code is now activated only through SVC
// and plain interrupts.
".ALIGN \n" ::"r"(
start_addr) // Argument list for the gcc assembly. start_addr is %0.
);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX