Recently, I've been messing around a lot of recently with the ESP32-S3 - it's a great module to
work with as there's no need for a USB-UART chip.
This means that we can get away with really simple PCBs - all you need is a Low Drop Out
regulator and some decoupling capacitors.
There are a lot of things to like with the S3 - it's really flexible as it has a GPIO
matrix for connecting pins to its peripherals.
This means that, in general, you don't need to worry too much about which pins you use
for things like I2C or SPI.
But, as always, there are some gotchas that can really trip you up.
There are some really great guides out there for the original ESP32 - one of go to ones
for me is the Random Nerd Tutorial page.
But I haven't really found a good one for the S3.
So I thought I'd make one.
I've put mine up on GitHub and I'm hoping we can have a bit of a community effort to
gather everyone's knowledge into one place.
So, let's run through what we know so far.
I've gleaned a lot of this from the various data sheets, personal experience, and of course
great input from all of you.
There are some pins that you definitely need to be careful with.
The most important of these are the strapping pins.
GPIO0, 45 and 46 are the three most critical ones.
Mess these up and you'll probably have a dead board.
GPIO0 is probably the one that you are most familiar with - it's the pin that almost all
dev boards will connect a push button to labeled "boot".
Holding this pin low when the board is powered on or reset will put the ESP32 in to firmware
download mode.
In previous ESP32 dev boards a clever arrangement of transistors could be used to replace this
button dance.
With the S3, in theory, pushing the buttons should not be needed.
You can program the board directly through the USB pins.
However, my experience, and anecdotal information from other people, indicates that this can't
be relied on.
So you may sometimes find that you do need to force the ESP32-S3 into download mode.
The value of GPIO46 can have an impact on the boot mode.
This handy table gives you combinations of values - an important thing to note is that
having GPIO46 high is not a valid if you want to go into firmware download mode.
GPIO45 controls the voltage that is used for the internal flash - unless you really know
what you are doing then messing with this pin can cause all sorts of interesting issues.
GPIO3 is the last strapping pin, and arguably, less important, it only has an impact if you
have burned some eFuses.
If you have burned the appropriate fuses then GPIO3 can be used to switch the default JTAG
debugging pins off.
An important thing to remember about these pins is that apart from GPIO3 they all have
either pull-up or pull-down resistors on them.
GPIO0 has a pull up resistor and GPIO45 and GPIO46 both have pull down resistors.
So that's the strapping pins - my advice is to just not use GPIO45 or GPIO46 - leave them
disconnected.
But, there are some more pins that you need to be careful with.
Two very obvious ones are the USB data pins, GPIO19 and GPIO20 - On most dev boards these
won't be broken out at all, but if you are designing your own PCB then it's worth being
aware of them.
And if you use them in your code you will interfere with any USB communication.
When I was playing with the Voltera and printing an S3 PCB at home I discovered some more pins
to be careful of.
GPIO pins 39 to 42 are used for JTAG debugging.
Until you start using them, these pins can have unexpected values on them.
There are also a couple of default UART pins - these will be used for UART0 unless you
use them for something else.
The final thing to watch out for, as I found to my cost, is only relevant if you are using
an S3 module with octal PSRAM - these are the modules that have 8 megabytes of extra
RAM.
With these modules you cannot use GPIO35, 36 or 37 at the same time as PSRAM.
If you do try and use them then your code will crash.
I used these pins on my ESP32-TV and it was only after I got the boards manufactured by
PCBWay and tried to enable PSRAM and then access the SD Card that I realised my error.
Fortunately the TV firmware doesn't require PSRAM so it wasn't a complete disaster, but
I am still going to redo the PCBs to avoid these pins.
So we'll have another board coming from PCBWay in the near future.
And if you want a PCB for yourself, then check out the PCBWay link in the video description.
That's really it for pins that you need to be careful about.
During boot time there are a surprising number of pins that have very short glitches on them
- GPIO1 through to GPIO20 all have some kind of glitch, either a very brief low level or
brief high level glitch of around 60 micro seconds.
For most use cases, this probably won't have any effect, but it could potentially cause
any hardware connected to them to get into a funny state.
I've documented all of this on the GitHub repo.
One of the nice things with the S3 is that there are far fewer restrictions on the pins
that you can use.
There are some interesting things in the data sheet that need further investigation.
I mentioned earlier that there is a GPIO matrix that means you can use any of the pins for
the S3's peripherals.
I've made a lot of use of this on the ESP32-TV and everything has worked really well, however,
there is also an IO mux.
This is much less flexible than the GPIO matrix, but may offer improved high speed digital
performance - though I have seen some messages on the forums that it may not make that much
difference.
Let me know in the comments if you've had any experience of this.
And please take a look at the GitHub repo and open an issue or even better a pull request
if you can see something that can be improved.