-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
PSRAM pins in ESP32 are now reserved only if needed #2022
Conversation
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 would try to make this a bit "smarter" and fool proof...
Meaning that the pin reservation should be there when the SPI flash it's present.
I honestly don't see a point of reserving pins. If they are used by SPI flash, you won't anyway be able to open them, you'll get an error. So reserving pins that anyway will return an error if you want to open them doesn't feel logical. |
🤔 I don't think that's the case... you can reassign the GPIO pins used by SPI flash without getting any exception. The result is that, inadvertently, a developer can screw the execution and make the CLR unusable. Having this check layer was one of the motivations for adding all this CPU pins layer code. @AdrianSoundy your input here, please. |
Yes the problem is you don't get an error when pins are used that shouldn't be used. The reserved pins was to make sure that doesn't happen and developer gets a clear message the pin was used elsewhere. Could set a flag in memory.cpp or use :- |
Precisely! That check should be all it takes to reserve those pins only when they are being used by PSRAM. 👍🏻 |
I would argue that you always have the board pin availability. So as a developer, you can only pins that are physically accessible. If they are used by the psram, they are not physically accessible, so you 1. have no reason to use them, 2. if ever you want to use them, when trying to open them, you'll get an error. So I really don't think that reserving them is less confusing than not reserving them as anyway, you'll get an error at the end of the day. |
So I think I finally got it. The detection of PSRAM is done at boot time, before this code is executed. So at this stage, it's about understanding if there is some. And if there is some reserve the pins otherwise, just skip! |
@Ellerbach there are issues with the code style on the source files. Make sure to follow the project code style. Check the details here on how it works and the tools required to help you with that. |
df11b27
to
7373695
Compare
7373695
to
9592a88
Compare
@Ellerbach this is building OK now. Care to check if it's working on your test app? |
any already built nanoCLR I can just download and test? (otherwise, will pull and build locally) |
Sure! Just follow the URL to Azure Pipeline build and grab the bin from there. (nanoFramework it's developer friendly) 😉 |
Works like a charm on en ESP32 PICO (M5 Stick) blinking the led on GPIO 10. Congratulations! |
Description
Removing reserved pins setup on ESP32 for SPI flash in the GPIO controller.
Rational: if SPI Flash is used, then some of the pins will be used by SPI anyway. Not all the pins will be used all the time. The design of some of the ESP32 board (like M5 Stick) uses pins 9 and 10 as they are not used in SPI Flash while the board has some. And those 2 pins are used for IR and Red led.
Motivation and Context
How Has This Been Tested?
Screenshots
Types of changes
Checklist: