GPREGRET - Hold the state of GPIO and state

Hi everyone!!! I need help with our new version of HW after validating the previous one that works.

I read some similar posts related to the GPRETREG for HOLD a GPIO while the DFU is performing.

I have a "smart power button " STM6601 to power up the system.

The code used in the previous version for hold the state is the following:

static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context)
{
    if (state == NRF_SDH_EVT_STATE_DISABLED)
    {
        // Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
        nrf_power_gpregret_set(BOOTLOADER_DFU_GPREGRET );
        nrf_power_gpregret2_set(  BOOTLOADER_DFU_SKIP_CRC);

        //Go to system off.
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
    }
}

HW changes ( Shortage :( )

I changed the BLE module:

Fanstel : 840F --------------> Ublox: NINA- B306

Fanstel chip version

Ublox chip version

Any suggestion or recommendation to test will be grateful!!

Best regards.

Parents
  • Hi Lucas,

    Ah, sorry. I misread your question. Yes, you can store the state in a GPREGRET register, as long as you have one available. But the pin will change state during the resets before you configure it as an output and set the value you want when the application comes back up.

    The bootloader can use GPREGRET and GPREGRET2 for different purposes (GPREGRET for buttonless DFU, i.e. entering bootloader mode from the application, and GPREGRET2 to signal that CRC check of the application should be skipped). For most applications the second use case is not relevant, so in that case you can set NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2 to 0 in the bootloader's sdk_config.h, and then the bootloader will not use this register at all, and you are free to use it from the application.

    Clarification: This concept resides entirely within the chip and firmware, so any HW changes (like changing to a different module with the same SoC) does not affect the use of GPREGRET.

Reply
  • Hi Lucas,

    Ah, sorry. I misread your question. Yes, you can store the state in a GPREGRET register, as long as you have one available. But the pin will change state during the resets before you configure it as an output and set the value you want when the application comes back up.

    The bootloader can use GPREGRET and GPREGRET2 for different purposes (GPREGRET for buttonless DFU, i.e. entering bootloader mode from the application, and GPREGRET2 to signal that CRC check of the application should be skipped). For most applications the second use case is not relevant, so in that case you can set NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2 to 0 in the bootloader's sdk_config.h, and then the bootloader will not use this register at all, and you are free to use it from the application.

    Clarification: This concept resides entirely within the chip and firmware, so any HW changes (like changing to a different module with the same SoC) does not affect the use of GPREGRET.

Children
No Data
Related