Table of Contents

Before I start using a component, I try to soak up as much as possible about it in advance. These are my notes on the TTGO 32-Micro, by studying the datasheet(s):

I have written this without actually having one, so my findings might change/update once I try things out.

Overview

The TTGO Micro-32 contains an ESP32-PICO-D4 which is a System-in-Package (SiP) module that is based on ESP32 and also includes 4-MB SPI external flash and a 40 MHz crystal oscillator. This makes it an ideal candidate for projects with size constraints (e.g. a smartwatch).

The external flash part is a bit confusing as it is embedded into the ESP32-PICO-D4, so from that point of view it’s internal, but from the ESP32’s point of view it’s external. So we stick to external. :) (If you look at the schematics in the datasheet on page 13 you will see this makes sense).


The small size makes it interesting for projects with size constraints. (Image © LILYGO.cn)

If you look at my previous projects, you can see, that I’ve collected some experience with the ESP8266 based D1 mini, as well as the ESP8285 based M3 modules. This means I’m not entirely new to the ESP world, so I know there are a few things too look out for. For example Pins you shouldn’t use.

“Forbidden” Pins

As mentioned in the data sheet

Pins GPIO16,GPIO17,CMD,CLK,SD0 and SD1 are used for connecting the embedded flash, and are not recommended for other uses. For details, please see Section 6 Schematics.

Which means, GPIO16 is internally wired to SPI flash /CS, as well as GPIO17 to SPI flash DO, so we will leave those untouched.

Also,

For connecting external PSRAM, SD3 (GPIO10) is recommended for PSRAM_CS.

And, there is some magic going on with the strapping pins:

MTDI, GPIO0, GPIO2, MTDO, GPIO5

According to the datasheet they should be set the following way:

PIN Value Reason
MTDI (a.k.a. GPIO12) 0 Datasheet: “The operating voltage of ESP32-PICO-D4’s integrated external SPI flash is 3.3V. Therefore, the strapping pin MTDI should hold bit “0” during the module power-on reset.”
GPIO0 0/1 To program (0) or boot (1), a.k.a. download mode or SPI boot mode
GPIO2 0/1 Don’t care, see datasheet (only applicable if MTDI = 1, then set to 0 for download mode
MTDO (a.k.a. GPIO15) 0/1 To enable (1) or disable (0) boot debug log on U0TXD
GPIO5 0/1 Depending on the timing of SDIO Slave, see datasheet, in combination with MTDO

Especially the GPIO5 needs to be tested. So I’m not sure yet what needs to be done here.

As well as,

EN needs to be pulled high to start, (pull low to reset)

This means we have to consider the GPIO diagram with a few additions:


No all pins are equal. (Original Image © github.com/LilyGO/TTGO-micro32-V2.0/)

Confusing Pins

When looking at the bottom row of the pins (image above) we have:

GPIO13,GPI9,GPIO10,SD2,CLK,SD3, SD1,GPIO15.

This is where the confusion starts (at least for me, maybe you can help out?). The peripheral schematics map the pins of the PICO-D4 uniformly, e.g. IO34 = IO35, IO35 = IO35 and so on. This makes sense and is simple. I assume this is consistently labeled on the TTGO 32-Micro package.

Now, the confusing part:

ESP-PICO-D4 module pin Peripheral pin (assumed) TTGO 32-Micro pin
SD1 SIO0 (SD1)
SD0 SIO2 (SD2)
CLK SCLK (CLK)
CMD SIO3 (SD3)
SD3 PSRAM_CS (IO10)
SD2 IO9 IO9
IO17 SIO1 IO17
IO16 FLASH_CS IO16

I will have to test this with a module once I get them.

SPI

According to the datasheet any pin can be configured for this.

The best resource regarding SPI I could find is this example: https://github.com/espressif/arduino-esp32/blob/master/libraries/SPI/examples/SPI_Multiple_Buses/SPI_Multiple_Buses.ino

The ESP32 has four SPI buses, however as of right now only two of them are available to use, HSPI and VSPI. Simply using the SPI API as illustrated in Arduino examples will use VSPI, leaving HSPI unused.

Which gives us the default VSPI pins (which is correct in the diagram above :) ):

SPI Pin GPIO
SCLK 18
MISO 19
MOSI 23
SS 5

I2C

According to the diagram the default pins for I2C are IO21/IO22, which overlap with VSPIHD/VSPIWP. But, we can switch the SDA/SCL pins on demand:

// redefine default pins
#define SDA 23
#define SCL 19

See this thread for more details: https://github.com/espressif/arduino-esp32/issues/722

Also: https://github.com/espressif/arduino-esp32/blob/master/libraries/Wire/src/Wire.cpp