-
Notifications
You must be signed in to change notification settings - Fork 254
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C6 PMU startup configuration #974
Conversation
6d8cd05
to
40d6931
Compare
b7dca07
to
3536d51
Compare
macro_rules! hp_system_init { | ||
($state:ident => $s:ident) => { | ||
paste::paste! { | ||
unsafe { |
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.
I'm sorry for these macros. esp-idf just indexes into a register group with 3 (HP) or 2 (LP) groups. Unfortunately, in the PAC, the register field names are different for each power state(?) (they contain a bunch of the register's name for each field) and transmuting them would just be super confusing.
From skimming over the code everything looks nice and tidy - probably not useful to compare it line by line with the C code. |
Honestly, I've gone through this enough times and I still think there might be mistakes somewhere. But each register modification is hidden behind 2 levels of indirection and it's extremely annoying to compare. Also, it is somewhat interesting that this PR tries to set the same values as esp-idf, but registers still end up with slightly different values in them, so there may be unintended differences. I think it might be useful for someone to familiarize themselves with the basic flow, that way they can tell if the config values at least correspond to the values in esp-idf. |
e61908c
to
1349c41
Compare
dff2bef
to
0474bee
Compare
So now that a new release cycle is going on, can we try and get this merged, or should I consider the PR in a permanent limbo until documentation becomes available? |
I have no problem merging this, just haven't had the time to review it. @SergioGasquez @JurajSadel can one or both of you please make some time to look over this? The draft chapter for the C6's PMU is available in our internal chat in the Documentation channel. |
I tested a few examples and |
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.
I went line-by-line with ESP-IDF so, hopefully, we haven't missed anything important here, haha
I left a comment where I'm not sure what we want to achieve, otherwise LGTM!
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.
LGTM, thank you!
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.
Thanks for all your work on this!
Also thank you for reviewing @bjoernQ and @JurajSadel, and thanks for testing @SergioGasquez!
* Implement a bunch of missing startup code * Extract peripheral address retrieval * Clean up manual register manipulation * Add missing PMU related setup * Changelog * Clean up revision check * Fix build * Add note about PMU setup code source * Use macros to deduplicate hp/lp system setup * Clean up a bit * Initialize the correct register in modem_clock_hal_select_wifi_lpclk_source
This PR implements PMU setup based on esp-idf v5.1.2.
I implemented PMU setup because I wasn't sure if this was the cause of my MCU not waking up. Well it isn't, but why not add the code to esp-hal :)
I wonder if much of this code should just be ran before main(), these are pre-main in esp-idf, too.
Must
errors
orwarnings
.cargo fmt
was run.CHANGELOG.md
in the proper section.Nice to have