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

GPIO pin settings when moving from Bootloader to Application mode

Hi,

 

I am using nRF52840 S140 with ble_app_blinky application. I have a basic query of GPIO configuration when moving from Bootloader to Application.

 

We are using Secure Serial Bootloader. Via DFU we will load our BLE blinky application package. In Secure Serial bootloader code, P0.25 is configured as input and Pull-UP. So pin will be always high. Where as in blinky application we are not configuring any GPIO pins other than button and led.

 

After every reset of nRF chip, control will go to Bootloader mode. If P0.25 is low then only bootloader will enter into DFU mode. If pin is high control will immediately go to ble_blink application.

 

My queries are:

1) Whatever pin configurations done in bootloader, whether the same settings will retain even when control goes to ble_blink.

2) If yes, if P0.25 is configured as PullUP in bootloader, to my understanding I can configure P0.25 to PullDown in ble_blink application.

 

Thanks & Regards

Vishnu Beema

Parents
  • beemavishnu said:
    I am trying to understand your statement "I would imagine that they would be reset again, but perhaps they are manually reset ".

     What I meant was that in an unmodified bootloader + application, the configuration of pins from the bootloader doesn't follow into the application. E.g. if the application uses UART, the UART pins will either be reset in the transition from bootloader->application or the pins will be reset due to some UART deinit function.

    However, I see that this is not the case for the button used in NRF_BL_DFU_ENTER_METHOD_BUTTON. By default, this is set to button 4 (pin P0.25). Remember that you can read out the GPIO configuration. The registers are listed on InfoCenter:

    https://infocenter.nordicsemi.com/topic/ps_nrf52840/gpio.html?cp=4_0_0_5_8_1_9#register.PIN_CNF-0-31

    So for pin 25 that would be address 0x50000764. If you read this address using nrfjprog --memrd 0x50000764 after programming the bootloader, you will see that it has the value 0x0003000C. If you change the bootloader define in sdk_config.h:

    #define NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN 25
    to
    #define NRF_BL_DFU_ENTER_METHOD_BUTTON_PIN 26

    You will see that address 0x50000768 (pin 26) reads 0x0003000C.

    If you also perform a DFU, so that your chip contains a bootloader and an application, and you start the application, you can see that pin 26 is still set to 0x0003000C, meaning it has a pullup, and is a connected input with sense for low level, even if your application didn't initialize anything on pin P0.26.

    The reason I tested with button pin 26 is that most examples initialize the buttons with the same settings, and pin P0.25 is Button4 on the DK.

    This means that if you want different behavior on the pins in your bootloader and application, you must set this in the application.

    Best regards,

    Edvin

Reply Children
No Data
Related