Thingy91X - Wake from System OFF

Hi,

We're coming to the end of prototyping a project on the Thingy91X and are fine-tuning the power management.  We have been able to implement a simple demo on the nrf9151dk and wanted to port this to our own code on the Thingy91X.  Although very simple, the code creates some odd behaviour which I'd be grateful if someone could explain to me.  The code should put the device into System OFF then wake it from the user button (P0.26).  This works perfectly on the nRF9151 using Button 1 and 2 (Pins 8 and 9).  The Thingy, however produces wifi related errors on almost every second shutdown and fails to register the the button as the wake up cause also 50% of the time.  Any ideas what is going on here:

Code in main.cpp:

#include <zephyr/logging/log.h>
#include <hal/nrf_gpio.h>
#include "app.hpp"

#include <zephyr/kernel.h>
#include <hal/nrf_regulators.h>
#include "nrf9120_bitfields.h"
#include "nrfx_config.h"
#include <hal/nrf_power.h> // For nrf_power_resetreas_get/clear

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);

#define WAKE_BUTTON_PIN_1 26 // Button 1 on DK

int main()
{

uint32_t resetReason = nrf_power_resetreas_get(NRF_POWER_NS);


if (resetReason & POWER_RESETREAS_RESETPIN_Msk) {
printk("Reset reason: %d, %s.\n",resetReason, "Reset pin.");
};

if (resetReason & POWER_RESETREAS_DOG_Msk) {
printk("Reset reason: %d, %s.\n",resetReason, "Watchdog.");
}

if (resetReason & POWER_RESETREAS_LOCKUP_Msk) {
printk("Reset reason: %d, %s.\n",resetReason, "CPU Lockup.");
}

if (resetReason & POWER_RESETREAS_OFF_Msk) {
printk("Reset reason: %d, %s.\n",resetReason, "System OFF.");
}

// Clear the reasons after processing
nrf_power_resetreas_clear(NRF_POWER_NS, resetReason);

printk("Pin 26 - %d\n", nrf_gpio_pin_latch_get(WAKE_BUTTON_PIN_1));

LOG_INF("System OFF test - entering in 2 seconds...");
k_msleep(2000);
nrf_gpio_pin_latch_clear(WAKE_BUTTON_PIN_1);
nrf_gpio_cfg_input(WAKE_BUTTON_PIN_1, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_sense_set(WAKE_BUTTON_PIN_1, NRF_GPIO_PIN_SENSE_LOW);

LOG_INF("Entering System OFF now");
k_msleep(100); 

NRF_REGULATORS->SYSTEMOFF = 1;

// Never reached
return 0;
}

Output:

*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Attempting to boot slot 0.
Attempting to boot from address 0x8200.
I: Trying to get Firmware version
I: Verifying signature against key 0.
I: Hash: 0x3e...f9
I: Firmware signature verified.
Firmware version 2
[00:00:00.254,211] <inf> spi_nor: GD25LE255E@0: 32 MiBy flash
[00:00:00.306,945] <inf> wifi_nrf_bus: SPIM spi@b000: freq = 8 MHz
[00:00:00.313,568] <inf> wifi_nrf_bus: SPIM spi@b000: latency = 0
[00:00:00.325,408] <err> wifi_nrf_bus: Error: RPU comms test: sig failed: expected 0x42000020, got 0x0

[00:00:00.335,540] <err> wifi_nrf: zep_shim_bus_qspi_dev_add: RPU enable failed with error -1
[00:00:00.344,879] <err> wifi_nrf: nrf_wifi_bus_qspi_dev_add: nrf_wifi_osal_bus_qspi_dev_add failed
[00:00:00.354,675] <err> wifi_nrf: nrf_wifi_bal_dev_add: Bus dev_add failed
[00:00:00.362,426] <err> wifi_nrf: nrf_wifi_sys_hal_dev_add: nrf_wifi_bal_dev_add failed
[00:00:00.371,368] <err> wifi_nrf: nrf_wifi_sys_fmac_dev_add: nrf_wifi_sys_hal_dev_add failed
[00:00:00.380,615] <err> wifi_nrf: nrf_wifi_fmac_dev_add_zep: nrf_wifi_fmac_dev_add failed
[00:00:00.389,648] <err> wifi_nrf: nrf_wifi_if_start_zep: nrf_wifi_fmac_dev_add_zep failed
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Reset reason: 4, System OFF..
Pin 26 - 1
[00:00:00.411,132] <inf> main: System OFF test - entering in 2 seconds...
[00:00:02.418,518] <inf> main: Entering System OFF now
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Attempting to boot slot 0.
Attempting to boot from address 0x8200.
I: Trying to get Firmware version
I: Verifying signature against key 0.
I: Hash: 0x3e...f9
I: Firmware signature verified.
Firmware version 2
[00:00:00.254,211] <inf> spi_nor: GD25LE255E@0: 32 MiBy flash
[00:00:00.306,976] <inf> wifi_nrf_bus: SPIM spi@b000: freq = 8 MHz
[00:00:00.313,598] <inf> wifi_nrf_bus: SPIM spi@b000: latency = 0
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Reset reason: 4, System OFF..
Pin 26 - 0
[00:00:00.535,308] <inf> main: System OFF test - entering in 2 seconds...
[00:00:02.542,694] <inf> main: Entering System OFF now
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Attempting to boot slot 0.
Attempting to boot from address 0x8200.
I: Trying to get Firmware version
I: Verifying signature against key 0.
I: Hash: 0x3e...f9
I: Firmware signature verified.
Firmware version 2
[00:00:00.254,241] <inf> spi_nor: GD25LE255E@0: 32 MiBy flash
[00:00:00.307,006] <inf> wifi_nrf_bus: SPIM spi@b000: freq = 8 MHz
[00:00:00.313,629] <inf> wifi_nrf_bus: SPIM spi@b000: latency = 0
[00:00:00.325,469] <err> wifi_nrf_bus: Error: RPU comms test: sig failed: expected 0x42000020, got 0x0

[00:00:00.335,601] <err> wifi_nrf: zep_shim_bus_qspi_dev_add: RPU enable failed with error -1
[00:00:00.344,940] <err> wifi_nrf: nrf_wifi_bus_qspi_dev_add: nrf_wifi_osal_bus_qspi_dev_add failed
[00:00:00.354,766] <err> wifi_nrf: nrf_wifi_bal_dev_add: Bus dev_add failed
[00:00:00.362,487] <err> wifi_nrf: nrf_wifi_sys_hal_dev_add: nrf_wifi_bal_dev_add failed
[00:00:00.371,429] <err> wifi_nrf: nrf_wifi_sys_fmac_dev_add: nrf_wifi_sys_hal_dev_add failed
[00:00:00.380,706] <err> wifi_nrf: nrf_wifi_fmac_dev_add_zep: nrf_wifi_fmac_dev_add failed
[00:00:00.389,709] <err> wifi_nrf: nrf_wifi_if_start_zep: nrf_wifi_fmac_dev_add_zep failed
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Reset reason: 4, System OFF..
Pin 26 - 1
[00:00:00.411,224] <inf> main: System OFF test - entering in 2 seconds...
[00:00:02.418,609] <inf> main: Entering System OFF now
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Attempting to boot slot 0.
Attempting to boot from address 0x8200.
I: Trying to get Firmware version
I: Verifying signature against key 0.
I: Hash: 0x3e...f9
I: Firmware signature verified.
Firmware version 2
[00:00:00.254,211] <inf> spi_nor: GD25LE255E@0: 32 MiBy flash
[00:00:00.306,976] <inf> wifi_nrf_bus: SPIM spi@b000: freq = 8 MHz
[00:00:00.313,598] <inf> wifi_nrf_bus: SPIM spi@b000: latency = 0
*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
Reset reason: 4, System OFF..
Pin 26 - 0
[00:00:00.535,308] <inf> main: System OFF test - entering in 2 seconds...
[00:00:02.542,694] <inf> main: Entering System OFF now



 

Parents Reply Children
No Data
Related