0

circuitpython 6.01 metro-esp32-s2 board module
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

circuitpython 6.01 metro-esp32-s2 board module

by robert_iowa on Sun Jan 10, 2021 1:11 pm

Forum:

Probably missing something simple, but I don't understand the pin abstractions from board module w/r metro-esp32-s2. They don't seem to be consistent with "primary guide:
adafruit metro esp32-s2". I was expecting to see options such as IO# and others. Please advise on where my thinking has gotten confused.

Thanks Again

repl output follows:


adafruit CircuitPython 6.0.1 on 2020-12-28; Metro ESP32S2 with ESP32S2
>>>
>>> import board
>>> dir(board)
['__class__', 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'D0', 'D1', 'D10', 'D11', 'D12', 'D13', 'D2', 'D3', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'DEBUG_RX', 'DEBUG_TX', 'I2C', 'MISO', 'MOSI', 'NEOPIXEL', 'RX', 'SCK', 'SCL', 'SDA', 'SPI', 'TX', 'UART']
>>>

robert_iowa
 
Posts: 5
Joined: Thu Mar 01, 2018 10:35 am

Re: circuitpython 6.01 metro-esp32-s2 board module

by dastels on Sun Jan 10, 2021 2:52 pm

It's a metro so there are pins that correspond to the metro/uno pinout (the A and D pins) as well as synonyms for the standard communication/sercom pins (i2c (SCL & SDA), serial (TX & RX), and spi (MOSI, MISO, & SCK) pins) as well as the debug serial pins. Additionally there convenience functions to create/cache/return SPI, I2C, and UART objects. Finally, there the pin driving the onboard NEOPIXEL.

Dave

dastels
 
Posts: 4850
Joined: Tue Oct 20, 2015 3:22 pm

Re: circuitpython 6.01 metro-esp32-s2 board module

by robert_iowa on Sun Jan 10, 2021 4:07 pm

I'm still confused somewhat. As noted this is a "metro" board however the documentation for this board is noted below. Not sure how to reconcile your response with the output from the repl and the documentation.

Thanks for the help


CircuitPython for the Metro ESP32-S2 uses different pin names than you may be used to. Many CircuitPython boards use the D prefix for digital pin names, such as D1 or D12. The pin names for the Metro ESP32-S2 use the IO prefix, such as IO1 or IO12.

The pin numbers on the Metro ESP32-S2 match the ESP32-S2 'low level chip pin numbers' that ESP32 users are most familiar with. The pins are not numbered like other typical Metro-shaped boards, so where you may expect pin 0 to be, its actually IO5.

We're not yet using D prefix names to avoid the confusion of having D-prefix names not match the IO pins.

The following pins have both the standard CircuitPython pin name and the IOx pin name available:

Analog pins A0-A5
Default I2C port SCL & SDA
Default SPI port SCK, MISO, MOSI
Default hardware Serial port RX, TX
LED (red LED)
NEOPIXEL (built in RGB LED)
Pin numbers next to pins are the ESP32 IO pin number. E.g. pin 5 is IO5 and 21 is IO21. This is not true for pin names such as A0 thru A5 (these are IO17, IO18, IO1, IO2, IO3, and IO4 in that order), SPI pins (SCK is IO36, MOSI IS IO35 and MISO is IO37) or I2C pins (SDA is IO33 and SCL is IO34)
A0 and A1 are the only DAC output pins. These can be used as 8-bit true analog outputs. No other pins can do so.
A0 thru A5, IO5 to IO16 - can also be analog inputs. The labeled SPI port, I2C port and pins 21 and 42 cannot.
IO12 thru IO16 and A0 plus A1 are on ADC2
A2 thru A5 plus IO5 thru IO10 are on ADC1
Check the ESP32-S2 datasheet for the ADC channel names for each pin if you need em!
The 2x3 SPI pins on the right side of the board is on the ESP32 high speed SPI peripheral - you can set any pins to be the low-speed peripheral but you won't get the speedy interface!
The SDA/SCL I2C pins have 3.3V pullups on them, and are shared with the STEMMA QT port
Pin 42 is connected to a red LED and is also shared with the JTAG TMS pin. If you happen to be JTAG debugging, this pin will not be available to you.
Pin 45 is connected to the NeoPixel and is a special bootrstap pin but we only use it as an output so it doesn't matter that there's a pullup/down on it.

robert_iowa
 
Posts: 5
Joined: Thu Mar 01, 2018 10:35 am

Re: circuitpython 6.01 metro-esp32-s2 board module

by dastels on Sun Jan 10, 2021 5:46 pm

You should update your install of CircuitPython to at least 6.1.0-rc.0

The IOx naming replaced the Dx naming for at that point.

Dave

dastels
 
Posts: 4850
Joined: Tue Oct 20, 2015 3:22 pm

Re: circuitpython 6.01 metro-esp32-s2 board module

by robert_iowa on Sun Jan 10, 2021 8:29 pm

OK that got me on the way! Blinky test seems to work now.

Thanks for information

-Robert

robert_iowa
 
Posts: 5
Joined: Thu Mar 01, 2018 10:35 am

Please be positive and constructive with your questions and comments.