WIP
This commit is contained in:
@@ -62,8 +62,53 @@ And here is some of the pin reference documentation from Espressif on the ESP32-
|
||||
<br/>
|
||||
<img alt="Espressif ESP32-S3 GPIO functions" src="esp32s3gpiofunctions.png" width="100%" />
|
||||
|
||||
... The datasheet goes on to explain that not only might these pins have multiple different functions, but that those functions:
|
||||
|
||||
## WS2812s
|
||||
* Might be input only, output only, or both
|
||||
* May or may not be high impedance
|
||||
* What the input signal of unused functions on a given pin will read when checkeed
|
||||
* What is the default state of the pin after reset
|
||||
* What is the drive strength of the signal on the pin (how many milliamps)
|
||||
* What glitches occur on which pins at powerup (high level, low level, pull up, pull down) and how long does that glitch last
|
||||
* Which pins have mappings to which in-package Flash/SRAM pins, which makes these pins unsuitable for other usage
|
||||
|
||||
It's also worth pointing out that, in order to get the most complete picture of the pin configuration, I actually had to consult THREE different datasheets:
|
||||
|
||||
* The Espressif ESP32-S3 datasheet
|
||||
* The Espressif ESP32-S3 WROOM datasheet (the specific ESP32-S3 package my dev board is using, which has some differences vs a regular ESP32-S3)
|
||||
* The Freenove devboard documentation (such as it is)
|
||||
|
||||
Using this information, I was able to make pin selections for my code, while noting some incompatibilities if we were to turn on other functions.
|
||||
|
||||
```
|
||||
// Pin 21 is GPIO only
|
||||
#define PIN_BUTTON 21 // Calibration button
|
||||
|
||||
// Apparently there is a dedicated 2812 controller in the ESP32-S3 that lives on this pin
|
||||
// and this pin only.
|
||||
#define PIN_2812 48 // Data bus for the 2812 LED
|
||||
|
||||
// These pins are shared with the second ADC unit. We're not using that unit in this project
|
||||
// but for future projects as my boards become more dense I need to remember that each pin
|
||||
// choice is a tradeoff. At a certain point we run out of available pins for adding stuff on,
|
||||
// and have to start getting creative about how we use the pins we have left.
|
||||
|
||||
#define PIN_LED_X 16 // Red X axis LED
|
||||
#define PIN_LED_Y 18 // Green Y axis LED
|
||||
#define PIN_LED_Z 15 // Yellow Z axis LED (button)
|
||||
|
||||
// Pins 1 and 2 are on ADC channel 0 and 1.
|
||||
#define PIN_JOY_X 1
|
||||
#define PIN_JOY_Y 2
|
||||
// Pin 47 is GPIO only
|
||||
#define PIN_JOY_Z 47
|
||||
```
|
||||
|
||||
Interstingly enough, the Freenove documentation labels pin 48 on their dev board as featuring some kind of dedicated WS2812 controller. However the text of their C tutorial says that the WS2812 is driven through the RMT controller (more on that in a minute). The ESP32-S3 WROOM MCU on this devboard doesn't even list 48 pins on the datasheet (though the parent ESP32-S3 datasheet does, so I guess the parent datasheet is authoritative? Maybe the missing pins are in the WROOM's "keep out zone"). When you're designing a board, you may need to ask questions like, "how will this dev board map to the real world when my code is driving the MCU on a different PCB? Will my assumptions about pins be correct? Will the peripherals be in the same place and work the same way? *Will this peripheral I'm using on the dev board even be there*?"
|
||||
|
||||
Hopefully the documentation makes all of that clear. Sometimes it does not, and you have to go spelunking, or ask the vendor questions directly. In the case of the WS2812 mystery pin 48, we can see in the ESP32-S3 datasheet chapter 3 (peripheral pin configurations) that the remote control peripheral (RMT) can be assigned to "any GPIO pin", depending on how it is initialized. So it looks like the Freenove WS2812 driver library is simply forcing the assignment of one of the RMT channels to pin 48, and that's why the tutorials and datasheets list pin 48 as the home for WS2812.
|
||||
|
||||
## WS2812s and the RMT
|
||||
|
||||
The WS2812 is a series of LEDs on a strip, which can be controlled by sending a compact stream of data to the strip, and each LED takes its own data before forwarding on the rest. This allows you to control each LED individually in a theoretically endless string of LEDs with very little hardware overhead. In the particular example here, the WS2812 strip is arranged as an octagon of LEDs on a square PCB package with one `V+` line, one `GND` line, and one `S`(ignal) line.
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 59 KiB |
Reference in New Issue
Block a user