Question : RESERVED Pins

Issue #102 resolved
Turgut Guneysu created an issue

Hi John,

If I understand the source correctly, there are a set of reserved pin numbers and any digital IO to those are not allowed.

Why is that?

eg: ESP8266 has a FLASH button (GPIO-0) and it acts as the Button-A when pressed. However, due to reserved status, it is not possible to monitor that pin via GRAPH or DigitalRead.

This prevents software implemented button press events.

Any clarification will be appreciated.

Comments (4)

  1. Bernat Romagosa

    Hi, Turgut.

    The button A reporter will give you the state of the Flash button in the NodeMCU.

  2. Turgut Guneysu reporter

    Thanks Bernat,

    In my complicated indirect way, I was trying to manipulate pin-0 with digital-Read and -Write.

    Totally forgot about the button A and button B blocks. I kept thinking they are only for micro:bit !!!

    But there is still the question of RESERVED PINS ? Any ideas ?

  3. John Maloney repo owner

    Pin 0 is reserved because it controls the boot behavior:

    https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection

    If, for example, a user connected an LED between that pin and ground then the pin would be held low at startup, causing the chip to run the ROM serial bootloader when it was powered up rather than running MicroBlocks. For anyone not intimately familiar with the ESP32, that behavior would be confusing. The pin also has a pull-up resistor, making it less flexible as a general digital input. It seemed safest just to make it a reserved pin.

    As Bernat said, you can use the button A block to read the button connected to that pin.

    As for the other reserved pins, many of them are used to access the external Flash memory chip and using them will cause a crash. See:

    https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

    I’m not sure why the board designers even make pins 6-11 pins available.

    Finally, the RX and TX pins are used to communicate with the MicroBlocks IDE, so they are off limits for other uses.

  4. Log in to comment