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

Bootloader and settings problem - gcc compiler

I have a custom board with an application that works fine. 

But when adding a secure bootloader my board starts to act weird. I am using the RESET pin on the chip as an input PIN. My chip resets every time the input is used when the app is run with the bootloader. But it works fine without the bootloader.

I am running SDK13 - Softdevice 4.0.5 on a nrf52832CIAA. 

I am compiling with gcc - both the app and bootloader. I have used nrfutil to create bootloader settings file. 

I have used merge-hex to merge the SD, app, Bootloader and settings-file.

All has been run on a MAC / OSX.

I have read somewhere on the Nordic DEVZONE that the gcc compiler places the settingsfile in the wrong place of the memory map. But I lack a good method of fixing it.

Parents
  • Hello

    did you take a look at the declaration of CONFIG_GPIO_AS_PINRESET in both your app and your bootloader?

    Check the comment in system_nrf52.c:

    /* Configure GPIO pads as pPin Reset pin if Pin Reset capabilities desired. If CONFIG_GPIO_AS_PINRESET is not
    defined, pin reset will not be available. One GPIO (see Product Specification to see which one) will then be
    reserved for PinReset and not available as normal GPIO. */


    Best,

  • Hi Cyril,

    I have defined the PIN reset to a normal GPIO. 

    The app works fine. But the bootloader does not work. Strange, because both are using the same board file. 

    regards

    Jens

  • Hi Vidar,

    First time I performed the procedure the board got into a deadlock, possibly because it resets constantly:

    iMac:nrfjprog jenzo$ ./nrfjprog --eraseall

    Erasing user available code and UICR flash areas.

    Applying system reset.

    iMac:nrfjprog jenzo$ ./nrfjprog --program bl_blset_app_sd_v22.hex

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programing device.

    iMac:nrfjprog jenzo$ ./nrfjprog --reset

    Applying system reset.

    Run.

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    ERROR: Cannot connect to any nRF device. Please make sure a device is

    ERROR: connected to the debugger and supplied.

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    ERROR: Cannot connect to any nRF device. Please make sure a device is

    ERROR: connected to the debugger and supplied.

    iMac:nrfjprog jenzo$

    I used another board and got this result:

    iMac:nrfjprog jenzo$ ./nrfjprog --eraseall

    Erasing user available code and UICR flash areas.

    Applying system reset.

    iMac:nrfjprog jenzo$ ./nrfjprog --program bl_blset_app_sd_v22.hex

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programing device.

    iMac:nrfjprog jenzo$ ./nrfjprog --reset

    Applying system reset.

    Run.

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    0x40000400: 00000004                              |....|

    iMac:nrfjprog jenzo$

    Regards

    Jens

  • Hi Jens,

    This sounds more like HW issue. Do you have any Output pins that control regulator supply, etc.? Please try attached bootloader (.hex) and see if you get the same result. It's based on the original project but without any re-configuration of the GPIO pins. 

    nrf52832_xxaa_s132.hex

  • Hi Vidar,

    I get the same result with the bootloader provided by you.

    I do have output pins that control DC motor driver.

    If it is a hardware problem, how can you explain the issue? It works perfectly without the bootloader.

    Regards

    Jens

  • Hi Jens, I was referring to the nrjprog error "Cannot connect to any nRF device". A "deadlock" should not prevent the debugger from connecting. However, I think it makes sense to ignore that for now as it works on the other board you had. 

    iMac:nrfjprog jenzo$ ./nrfjprog --reset

    Applying system reset.

    Run.

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    0x40000400: 00000004     

    Did you turn the power off and on before you read the RESETREAS register here? In that case, the application is doing a soft reset. 

  • Hi Vidar,

    Now I am performing a power cycle before reading the register! The bootloader used is the one you provided. 

    iMac:nrfjprog jenzo$ ./nrfjprog --eraseall

    Erasing user available code and UICR flash areas.

    Applying system reset.

    iMac:nrfjprog jenzo$ ./nrfjprog --program bl_blset_app_sd_v22.hex

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programing device.

    POWER CYCLE the device!

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    0x40000400: 00000004                              |....|

    iMac:nrfjprog jenzo$

    Regards

    Jens

Reply
  • Hi Vidar,

    Now I am performing a power cycle before reading the register! The bootloader used is the one you provided. 

    iMac:nrfjprog jenzo$ ./nrfjprog --eraseall

    Erasing user available code and UICR flash areas.

    Applying system reset.

    iMac:nrfjprog jenzo$ ./nrfjprog --program bl_blset_app_sd_v22.hex

    Parsing hex file.

    Reading flash area to program to guarantee it is erased.

    Checking that the area to write is not protected.

    Programing device.

    POWER CYCLE the device!

    iMac:nrfjprog jenzo$ ./nrfjprog --memrd 0x40000400 --n 4

    0x40000400: 00000004                              |....|

    iMac:nrfjprog jenzo$

    Regards

    Jens

Children
Related