- Notifications
You must be signed in to change notification settings - Fork1.1k
Bug 1668 v2 - Provide method to prevent init of SYS_CLK, when left on during 'lightsleep'#1672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:develop
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ing 'lightsleep'During 'lightsleep' user may want to keep some clocks running (for example PIOs),but at present microPython calls 'clock-init()' causing the SYS_CLK to be reinitialised.This patch allows microPython to provide the previously used 'sleep_en0 & sleep_en1'signifying which clocks stayed on. As most are dependant of SYS_CLK it can beinferred that this does NOT need to (/should NOT) be re-initilised.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Yes, should be a logical "&&". I'll update PR and add some documentation. Thanks. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I removed the tabs. Do you want the whole series resubmitted (_v3?) as a single patch/pull request? |
That's not my decision to make, so leave it as-is for now unless asked otherwise 🙂 |
fixes#1668 |
/// \tag::configure_clk_sys[] | ||
// CLK SYS = PLL SYS (usually) 125MHz / 1 = 125MHz | ||
clock_configure(clk_sys, | ||
CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, | ||
CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, | ||
SYS_CLK_KHZ * KHZ, | ||
SYS_CLK_KHZ * KHZ); | ||
if (init_sys_clock) { | ||
clock_configure(clk_sys, | ||
CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, | ||
CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, | ||
SYS_CLK_KHZ * KHZ, | ||
SYS_CLK_KHZ * KHZ); | ||
} | ||
/// \end::configure_clk_sys[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This "tag" is used to auto-include this code snippet into page 191 ofhttps://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
So in order not to clutter that example, it might make sense to move your newif
check tooutside of the tag? i.e.
if (init_sys_clock) {/// \tag::configure_clk_sys[]// CLK SYS = PLL SYS (usually) 125MHz / 1 = 125MHzclock_configure(clk_sys,CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX,CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS,SYS_CLK_KHZ*KHZ,SYS_CLK_KHZ*KHZ);/// \end::configure_clk_sys[] }
projectgus commentedJun 25, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If this patch was extended to also check and selectively init PLL_USB then it would also meet the use case in#1746. Looks like a good approach to reuse the sleep bits this way. |
During 'lightsleep' user may want to keep some clocks running (for example PIOs), but at present microPython calls 'clock-init()' causing the SYS_CLK to be reinitialized.
This patch allows microPython to provide the previously used 'sleep_en0 & sleep_en1' signifying which clocks stayed on. As most are dependant of SYS_CLK it can be inferred that this does NOT need to (/should NOT) be re-initialized.