-
Notifications
You must be signed in to change notification settings - Fork 280
Add all SPI
examples for the ESP32-H2
#549
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
Conversation
Maybe it would make sense to change the pins - at least on my boards GPIO7 doesn't seem to be available on the pin headers |
Agree, here is the diff my pin changes that I've used for testing: pins.zip |
Btw, just tested the examples again and all of them seem to be working! |
Everybody seems to have different dev kits, I already have to change the pins for a bunch of examples in the repo so I guess I don't really care what they're set to. If you want them changed please tell me which pins to change them to. |
Yep
|
Okay thanks, I'll update each example to use those pins and add the missing example. |
I've been investigating the frequency issue, here is what I've found: I was able to solve it by using the XTAL clock (changing to Looking at esp-idf source, H2 and C6 default clock is the PLL and, the select method is the same for H2 and C6 The thing is, according to the TRM if we want to use the PLL clock, @bjoernQ tested (my C6 devkit is not working for some reason) if the frequency issue was also present in C6, since it should be the same, but C6 works fine. |
8a07cc6
to
f8d4d3b
Compare
I've rebased and updated the SPI clock configuration as per the above comment. @SergioGasquez would you mind please verifying that things are now working correctly? |
Just tried the |
f8d4d3b
to
7b92921
Compare
but using XTAL_CLK would mean we limit the max SPI speed 🤔 |
XTAL_CLOCK works because there is this let apb_clk_freq: HertzU32 = HertzU32::Hz(clocks.apb_clock.to_Hz()); And we have desired_rates: RawClocks {
cpu_clock: HertzU32::MHz(96),
apb_clock: HertzU32::MHz(32),
xtal_clock: HertzU32::MHz(32),
i2c_clock: HertzU32::MHz(32),
}, So, the APB_CLOCK of 32MHz matches the XTAL_CLK |
ebea2c5
to
2f88b2e
Compare
I've fixed the comment and rebased this branch again. Given that the |
Probably doesn't make sense to further block this but we should probably create an issue to remind us to re-think the choose of the clock source here? |
I'm doing some testing based on internal discussion, please don't merge this yet |
When CI is green this should be ready for final review. I tested all examples with LA but QSPI, @bjoernQ could you please try that? |
|
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
Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com>
909ce12
to
bb1c605
Compare
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.
Changes LGTM, although I couldn't verify the freq as my LA decided not to work
* Update the `GDMA` driver to support the ESP32-H2 * Update the `SPI` driver to support the ESP32-H2 * Add `SPI` examples for ESP32-H2 * Update CHANGELOG * Remove copy-pasted references to ESP32-C6 * Update GPIO pins used in SPI examples, add `qspi_flash` example * Update SPI clock configuration to produce correct clock rate * Correct comment regarding clock source frequency Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com> * H2: Add PLL_48M_CLK src to ClockControl and RawClocks * H2: Use PLL_48M_CLK as SPI clk src * H2: cleanup commented block in SPI driver * H2: update docs comment in embassy_spi example * fmt * Add a new line in embassy_spi example --------- Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com> Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
* Update the `GDMA` driver to support the ESP32-H2 * Update the `SPI` driver to support the ESP32-H2 * Add `SPI` examples for ESP32-H2 * Update CHANGELOG * Remove copy-pasted references to ESP32-C6 * Update GPIO pins used in SPI examples, add `qspi_flash` example * Update SPI clock configuration to produce correct clock rate * Correct comment regarding clock source frequency Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com> * H2: Add PLL_48M_CLK src to ClockControl and RawClocks * H2: Use PLL_48M_CLK as SPI clk src * H2: cleanup commented block in SPI driver * H2: update docs comment in embassy_spi example * fmt * Add a new line in embassy_spi example --------- Co-authored-by: Sergio Gasquez Arcos <sergio.gasquez@gmail.com> Co-authored-by: Juraj Sadel <juraj.sadel@espressif.com>
Adds all SPI-related examples for the ESP32-H2. This involved updating the
GDMA
andSPI
peripheral drivers.This was verified on hardware by @SergioGasquez and @JurajSadel, however I committed some
git
crimes since then so probably wouldn't hurt just to triple-check the examples.