Thanks , I was looking at pico-extras, which seems to be largely the same code in terms of this issue.
So I copied the repo and included it as suggested into my project file:
However, it fails to find any of the functions in that library.I pulled out the essentials into my code. It compiled and ran but did not shut down the processor.This outputs the following: it does not halt the RP2040
So I copied the repo and included it as suggested into my project file:
Code:
include(pico_sdk_import.cmake)# req PICO EXTRAS for DORMANT power stateinclude(pico_extras_import.cmake)Code:
void halt(){ processor_deep_sleep(); _go_dormant(); .... Code:
hello_world.cpp:104:3: error: 'processor_deep_sleep' was not declared in this scopeCode:
#define NO_AUX 0 uint src_hz = XOSC_HZ; DEBUG_PRINTF ("XOSC_HZ = %d kHz\n",XOSC_HZ/kHz); uart_default_tx_wait_blocking(); DEBUG_PRINTF ("Core 0 : Terminating Core 1\n"); multicore_reset_core1(); bool res; uint clk_ref_src = CLOCKS_CLK_REF_CTRL_SRC_VALUE_XOSC_CLKSRC; res = clock_configure(clk_ref, clk_ref_src, NO_AUX, src_hz, src_hz); if (res) DEBUG_PRINTF ("set ref clk %d failed\n",src_hz); uart_default_tx_wait_blocking(); res = clock_configure(clk_sys, CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLK_REF, NO_AUX, src_hz, src_hz); if (res) DEBUG_PRINTF ("set sys clk %d failed\n",src_hz); uart_default_tx_wait_blocking(); clock_stop(clk_adc); clock_stop(clk_usb); DEBUG_PRINTF ("stop USB \n"); res = false; uint clk_rtc_src = CLOCKS_CLK_RTC_CTRL_AUXSRC_VALUE_XOSC_CLKSRC; // *AUXSRC* res |= clock_configure(clk_rtc, NO_AUX, clk_rtc_src, src_hz, src_hz); // 46875, src_hz why literal ??? res |= clock_configure(clk_peri, NO_AUX, CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLK_SYS, src_hz, src_hz); if (res) DEBUG_PRINTF ("set peri clk failed\n"); pll_deinit(pll_sys); pll_deinit(pll_usb); DEBUG_PRINTF ("PLLs off\n"); setup_default_uart(); // def uart =1 in cmake DEBUG_PRINTF ("dormant..........\n"); stdio_flush(); // flush serial ?? scb_hw->scr |= ARM_CPU_PREFIXED(SCR_SLEEPDEEP_BITS); DEBUG_PRINTF ("didn't work ! Not dead. !! \n");Code:
clk_sys = 125000 kHzclk_peri= 125000 kHzpll_sys = 125000 kHzpll_usb = 48000 kHzclk_usb = 48000 kHzclk_adc = 48000 kHzshutting down now..........XOSC_HZ = 12000 kHzCore 0 : Terminating Core 1ref clk set failedsys clk set failedstop USB dormant..........didn't work ! Not dead. !! Statistics: Posted by pie_face — Sun Nov 02, 2025 2:19 am