Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Which pins can be used? #175

Open
HelenFoster opened this issue Feb 13, 2021 · 2 comments
Open

Which pins can be used? #175

HelenFoster opened this issue Feb 13, 2021 · 2 comments

Comments

@HelenFoster
Copy link

Hi, at the moment this is really quite difficult to figure out. There were people on the forums having trouble too. I think it would be useful if there was a straightforward list of all the exposed pins, stating for each pin whether it can be used freely, or whether there is something to watch out for.

For example, looking at the Basic,

In core/basic.md:

  • 18,19,23 are SPI shared with the LCD and TF card (can they be used for additional SPI?)
  • 25 is connected to the speaker
  • 21,22 are I2C connected to the GROVE port (can they be used as GPIO if not using GROVE?)

ESP32 info:

  • 0,1,3,12 have something to do with the boot sequence
  • 35,36 are input-only without pullups

In the schematic:

  • 1,3 are connected to the CP2104 USB serial
  • ???

Trial and error:

  • I tried to use 2 as an output, it didn't seem to work, but I couldn't find any info about it.

api/gpio.md gives some info about what the different pins are for, but doesn't answer this question. For example, it labels 1,3,16,17 as "UART", but as far as I can tell 16,17 are available for GPIO while 1,3 are not.

@micglin
Copy link

micglin commented Nov 17, 2021

The ESP32 chip has the below list of pins exposed from the MCU. Per the product page for the M5Stack Basic, additional functions have been listed to the specified pins. Further details on functionality and mapping in the ESP32 available in the datasheet. Many functions can be mapped to any available pin by setting it in your code (e.g: using 3&1, 2&5, or 16&17 for a secondary I2C port)

https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf

GP0 = Pin(0)
GP1 = Pin(1) # TXD1, I/O/T (Input/Output/Touch sensor)
GP2 = Pin(2) # GPIO, ADC2_CH2/T2, I/O/T
GP3 = Pin(3) # RXD1, I/O/T
GP4 = Pin(4) # CS TF Card
GP5 = Pin(5) # GPIO, I/O/T
GP6 = Pin(6)
GP7 = Pin(7)
GP8 = Pin(8)
GP9 = Pin(9)
GP10 = Pin(10)
GP11 = Pin(11)
GP12 = Pin(12) # IIS_SK, ADC2_CH5, I/O/T
GP13 = Pin(13) # IIS_WS, ADC2_CH4/T4, I/O/T
GP14 = Pin(14) # CS
GP15 = Pin(15) # IIS_OUT, ADC2_CH3/T3, I/O/T
GP16 = Pin(16) # RXD2, I/O/T, I/O/T
GP17 = Pin(17) # TXD2, I/O/T
GP18 = Pin(18) # ILI9342C LCD CLK, SCK, I/O/T
GP19 = Pin(19) # MISO TF Card, MISO, I/O/T
GP21 = Pin(21) # SDA, Grove Port-A (Red), IPS306 charging/discharging circuit
GP22 = Pin(22) # SCL, Grove Port-A (Red), IPS306 charging/discharging circuit
GP23 = Pin(23) # MOSI TF Card, ILI9342C LCD MOSI/MISO, MOSI, I/O/T
GP25 = Pin(25) # DAC Pin, connected to speaker, DAC_1, ADC2_CH8, I/O/T
GP26 = Pin(26) # Grove Port-B (Black), DAC/ADC, DAC_2, ADC2_CH9, I/O/T
GP27 = Pin(27) # ILI9342C LCD DC
GP32 = Pin(32) # ILI9342C LCD BL
GP33 = Pin(33) # ILI9342C LDC RST
GP34 = Pin(34) # IIS_IN, ADC1_CH6, I
GP35 = Pin(35) # ADC, ADC1_CH7, I
GP36 = Pin(36) # Grove Port-B (Black), DAC/ADC, I
GP37 = Pin(37) # Button C
GP38 = Pin(38) # Button B
GP39 = Pin(39) # Button A

@tanakamasayuki
Copy link
Contributor

https://github.com/m5stack/M5Unified
information here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants