Might this be of some help? Have a look here, in section 4.10, page 55.
https://www.espressif.com/sites/default ... ual_en.pdf
trying to read an ADC GPIO
Re: trying to read an ADC GPIO
Hi Mike - yes, that's very helpful. I've passed it along to the HW people. Thanks.
Re: trying to read an ADC GPIO
So, it looks like we're going with GPIO21, which according to the table that Mike referenced, can be used as something called "VSPIHD," which if I'm reading the doc correctly, has something to do with accessing flash and SRAM access. Does this mean that if we try to use it for another purpose, we risk messing up the ability to access flash? And if so, should my code do something like read/save/reset the current settings for the pin before/after use?
Re: trying to read an ADC GPIO
Think of a pin (pad) on the ESP32. Let us call in GPIO 21. That is a physically connectable piece of metal. Now look at Figure 7 in the TRM. GPIO 21 in that diagram is a "digital pad". Notice how it connects to a component called the "IO_MUX". This allows pads to serve a set of purposes. If you then look at table 19 you see the possible purposes served by a given pad based on the function property of IO_MUX. We find that GPIO 21 can be GPIO21, VSPIHD or EMAC_TX_EN ... through IO_MUX. That last part of the story is important. If this were ALL there was, then GPIO 21 could only be one of those 3 functions. However, look again at Figure 7. See also that the IO_MUX can be fed by something called the "GPIO matrix". To engage that, we can tell IO_MUX that for any given pad (eg. GPIO21) then the function of that pad will be determined by the "GPIO matrix". What that means is that ANY of the functions available for peripheral inputs/outputs can be associated (through GPIO matrix) with a given digital pad.
The key take away is that IO_MUX offers a finite and fixed set of mappings between pads and functions but, if desired, ALL the possible functions within an ESP32 can be associated with pad by telling IO_MUX to use the signals associated with GPIO matrix. By going down that route, you are going through extra internal code paths ... but stories seem to say that the overhead is not significant enough to practically care about.
The key take away is that IO_MUX offers a finite and fixed set of mappings between pads and functions but, if desired, ALL the possible functions within an ESP32 can be associated with pad by telling IO_MUX to use the signals associated with GPIO matrix. By going down that route, you are going through extra internal code paths ... but stories seem to say that the overhead is not significant enough to practically care about.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: trying to read an ADC GPIO
Hi Neil - thanks for the input. I was aware that a given GPIO pin could have multiple uses; my concern was whether it was my responsibility to coordinate the "sharing" of this pin with the rest of the system. In the example we're using (IO21), there's mention of VSPIHD. I wasn't sure whether the OS or some other underlying component might be using this pin, and if so, whether I need to prevent colliding with such use.
Sorry for the confusion; I hope I made a little more sense this time.
Thanks...
Sorry for the confusion; I hope I made a little more sense this time.
Thanks...
Re: trying to read an ADC GPIO
Other than GPIO 6-11 which are used by flash, you should be safe to use other pins for interfacing purposes. Obviously, if your solution uses a pin for one purpose it shouldn't also use the same pin for a different purpose at the same time. You won't find interference in an out of the box ESP32 on GPIO21.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: trying to read an ADC GPIO
Thanks, Neil. I'm getting some unexpected behavior on our board (the RTC isn't accepting updates from the NTP server) so I'm glad I can rule out pin collision. More likely we have some weird wiring issue on our prototype.
Re: trying to read an ADC GPIO
mzimmers wrote:I was just hoping that there would be a location where all the pertinent information for GPIOs (including any use by the ESP32 module itself, for example GPIO32 which evidently is the input to the RTC).
For more information about ESP32 pin usage, please refer to the following table located in the appendix section of the ESP32 datasheet.
Who is online
Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 106 guests