Skip to content

Add ability to specify which clocks are re-initialized in 'clock_init()', after microPython 'lightsleep()' #1668

@mungewell

Description

@mungewell

From thread:
https://github.com/orgs/micropython/discussions/14087

I am looking to keep the PIOs running during 'lightsleep()', as this will help my project save power. The CPU can pre-fill the FIFOs and then sleep, whilst the PIOs are processing the data.

ATM microPython 'lightsleep()' function calls the 'clock_init()' func after the CPU re-awakes, which causes the clocks to be reinitialized. This is 'bad' for me, as it overwrites the prior 'machine.freq(x)' call, but also potentially causes a glitch on the SYS clock - and therefore glitch on the PIO clocks.

This patch allows the passing of previously used sleep_en0 and sleep_en1 values, which are used to determine whether SYS_CLOCK should be reinitialized, or skipped:

20240314_sdk_keep_pios_running.patch.txt

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions