What pins can be used on a ESP32-EVB ? A lot of them are not available.

Started by GeorgeFlorian, December 02, 2019, 01:16:29 PM

Previous topic - Next topic

GeorgeFlorian

Hello !

I would like to know what pins are available for general use on the ESP32-EVB board.
I have been trying all day to find an available pin and all I could find is GPIO 16.

I am currently using:
- GPIO 32 and 33 for controlling both relays;
- GPIO 4 and GPI 36 as TX1 and RX1 for UART;

I would like 5 more pins like GPIO 16, so 6 in total.
This is how I use GPIO 16 in code:
#define TRIGGER_PIN 16
void setup() {
  pinMode(TRIGGER_PIN, INPUT_PULLUP);
  digitalWrite(TRIGGER_PIN, HIGH); // not pressed
}
void loop() {
  if(digitalRead(TRIGGER_PIN) == LOW){ // if pressed
    // do something
  }
}

I have seen this thread: https://www.olimex.com/forum/index.php?topic=7163.0 regarding the available pins on the ESP32-POE-ISO board, which doesn't have as many pins as the EVB. In that thread, LubOlimex said that the following pins are available: GPI00, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO13, GPIO14, GPIO15, GPIO16, GPIO32, and GPIO33.

But those pins have other roles on the EVB:
- GPIO0 and 1 souldn't be messed with;
- GPIO2 has multiple roles: MicroSD/D0/UART Bridge;
- GPIO3 is RX0 for UART;
- GPIO4 is already in use in my project;
- GPIO5 is CAN PHY
- etc,etc,etc.

I would like to implement a Wiegand Protocol along the other stuff that I already have in the project: https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino
This needs DATA0 and DATA1, but I am not certain if it needs pins with special attributes.

Thank you !

JohnS

Good question!

I couldn't figure out what the schematic means by
HSPI_CS0
HSPI_CS1
HSPI_CS2
or
VSPI_CS0
VSPI_CS1
VSPI_CS2

Can't find them in www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf either.

John

LubOlimex

@GeorgeFlorian: use two of the pins of the UEXT; I'd suggest the UART or the I2C pins if you don't need both; in ESP32 there is cool multiplexor and you can re-define those pins to act as GPIOs.

Not sure what the rest of the requirements are but ESP32-EVB is the worst choice when you need many free GPIOs since the intention of that board was to act as evaluation board for ESP32 - we wanted to pack as much usable hardware as possible, yet it still few free pins were left over the UEXT. If you wish a board with a couple of extra free pins maybe consider ESP32-GATEWAY or ESP32-POE. If you need further advice in that direction, let me know what peripherals do you need exactly (e.g. Ethernet with connector; SD card; etc).

@JohnS this is the correct datasheet for these: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
Technical support and documentation manager at Olimex

JohnS

As I mentioned, I could not find those items in that data sheet.

So, on the schematic what are
HSPI_CS0
HSPI_CS1
HSPI_CS2
or
VSPI_CS0
VSPI_CS1
VSPI_CS2

John

GeorgeFlorian

Quote from: LubOlimex on December 02, 2019, 04:33:42 PM@GeorgeFlorian: use two of the pins of the UEXT; I'd suggest the UART or the I2C pins if you don't need both; in ESP32 there is cool multiplexor and you can re-define those pins to act as GPIOs.

Not sure what the rest of the requirements are but ESP32-EVB is the worst choice when you need many free GPIOs since the intention of that board was to act as evaluation board for ESP32 - we wanted to pack as much usable hardware as possible, yet it still few free pins were left over the UEXT. If you wish a board with a couple of extra free pins maybe consider ESP32-GATEWAY or ESP32-POE. If you need further advice in that direction, let me know what peripherals do you need exactly (e.g. Ethernet with connector; SD card; etc).

@JohnS this is the correct datasheet for these: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf

Can you, please, list me the available pins from the ES32-EVB ?

I am sorry if I didn't make myself clear. In one of the projects I use:
- GPIO 32 and 33 for controlling both relays;
- POE

In another I use:
- Olimex MOD-RS232 to communicate with an RS232 device and the pins should be GPIO 4 and GPI 36 as TX1 and RX1 for UART;
- GPIO 16
- Also POE

Now I want to add more functionality to both projects, like a button, a LED, Wiegand Protocol. This already means 4 pins. Maybe I will want to add other things. That's why I would like a list of available pins.

I don't think I can answer your question regarding what board I need. That really depends on the project. But mainly I need a board with POE, relays, UART and 6 available GPIO.

LubOlimex

There are a lot of ifs and it is hard to create proper layout diagram.

QuoteCan you, please, list me the available pins from the ES32-EVB ?

By available, I assume you mean completely free, not routed to other peripherals. In ESP32-EVB hardware revision H I'd think it is the ones I've listed below, and most are pulled-up so you'd have to be aware of that. Also one of the pins is just INPUT (GPI36):

ESP32-WROOM-32D#26 - GPIO4/U1TXD - EXT1#5 - UEXT1#3
ESP32-WROOM-32D#27 - GPIO16/I2C-SCL - EXT1#17 - UEXT1#5 (pulled-up to 3.3V via 2.2k)
ESP32-WROOM-32D#4 - GPI36/U1RXD(only input) - EXT1#31 - UEXT1#4 (D5 1n58192S4)
ESP32-WROOM-32D#16 - GPIO13/I2C-SDA - EXT1#14 - UEXT1#6 (pulled-up to 3.3V via 2.2k)
ESP32-WROOM-32D#28 - GPIO16/SPI_CS - EXT1#18 - UEXT1#10 (pulled-up to 3.3V via 10k)

Now you didn't say if you need an SD card, and I'd assume you don't need one, so you can have a lot more pins for usage - the SD card pins.

There are more free pins in ESP32-PoE.

This can easily be tracked in the schematic opening it with KiCAD - there is highlight wire tool that allows you to see where wires go.
Technical support and documentation manager at Olimex

GeorgeFlorian

Quote from: LubOlimex on December 03, 2019, 01:57:14 PMThere are a lot of ifs and it is hard to create proper layout diagram.

QuoteCan you, please, list me the available pins from the ES32-EVB ?

By available, I assume you mean completely free, not routed to other peripherals. In ESP32-EVB hardware revision H I'd think it is the ones I've listed below, and most are pulled-up so you'd have to be aware of that. Also one of the pins is just INPUT (GPI36):

ESP32-WROOM-32D#26 - GPIO4/U1TXD - EXT1#5 - UEXT1#3
ESP32-WROOM-32D#27 - GPIO16/I2C-SCL - EXT1#17 - UEXT1#5 (pulled-up to 3.3V via 2.2k)
ESP32-WROOM-32D#4 - GPI36/U1RXD(only input) - EXT1#31 - UEXT1#4 (D5 1n58192S4)
ESP32-WROOM-32D#16 - GPIO13/I2C-SDA - EXT1#14 - UEXT1#6 (pulled-up to 3.3V via 2.2k)
ESP32-WROOM-32D#28 - GPIO16/SPI_CS - EXT1#18 - UEXT1#10 (pulled-up to 3.3V via 10k)

Now you didn't say if you need an SD card, and I'd assume you don't need one, so you can have a lot more pins for usage - the SD card pins.

There are more free pins in ESP32-PoE.

This can easily be tracked in the schematic opening it with KiCAD - there is highlight wire tool that allows you to see where wires go.

I do not need the SD card. This means that I can also use the following pins: GPIO2, GPIO14 and GPIO15, right ?

These are the pins that I've tried as INPUT_PULLUP:
//#define GPIO_ 2
//#define GPIO_ 3 // HIGH at boot
//#define GPIO_ 4
//#define GPIO_ 5
//#define GPIO_ 13
//#define GPIO_ 14
//#define GPIO_ 15
//#define GPIO_ 16
// #define GPIO_ 17

They are HIGH when not connected and LOW when connected to GND.

There are pins that you haven't listed: GPIO3, GPIO5 and GPIO17. They appear OK. What do you think ?

LubOlimex

> I do not need the SD card. This means that I can also use the following pins: GPIO2, GPIO14 and GPIO15, right ?

Yes.

> There are pins that you haven't listed: GPIO3, GPIO5 and GPIO17. They appear OK. What do you think ?

GPIO3 is used for programming the board via the USB, man.

GPIO5 is connected to the CAN module.

GPIO17 is the last pin I mentioned - I made a typo, it is this one:

ESP32-WROOM-32D#28 - GPIO16/SPI_CS - EXT1#18 - UEXT1#10 (pulled-up to 3.3V via 10k)
Technical support and documentation manager at Olimex

GeorgeFlorian

Quote from: LubOlimex on December 04, 2019, 04:05:46 PM> I do not need the SD card. This means that I can also use the following pins: GPIO2, GPIO14 and GPIO15, right ?

Yes.

> There are pins that you haven't listed: GPIO3, GPIO5 and GPIO17. They appear OK. What do you think ?

GPIO3 is used for programming the board via the USB, man.

GPIO5 is connected to the CAN module.

GPIO17 is the last pin I mentioned - I made a typo, it is this one:

ESP32-WROOM-32D#28 - GPIO16/SPI_CS - EXT1#18 - UEXT1#10 (pulled-up to 3.3V via 10k)

I've just tried using GPIOs 14-15 and 13-17 as W0-W1 for a Wiegand Reader. I am trying to read the bits from a card using a card reader. I have found this library: https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino

But I get no output.

LubOlimex

I can't say about that library and I don't have the shield to test it. It seems to me that the demo library was originally made for ATmega328, so if something doesn't work I'd focus my efforts in that direction. I tested whether the ESP32-EVB pins mentioned work fine as inputs and outputs, empirically. Only GPIO14 experienced some issues working as input, I guess the resistor near the SD card is insufficient I am not sure about it. The rest seem to work fine.

I uploaded the two videos in YouTube you find them following the links below:

Inputs, button test: https://youtu.be/CDRmXMnTZng

Outputs, LED test: https://youtu.be/S8g57_YGUIw

Code for the tests is in the comments.

If the issues you experience remain, I'd recommend asking the developers and manufacturers behind the shield on guidance for using it with ESP32 boards.
 
Technical support and documentation manager at Olimex

GeorgeFlorian

Hello @LubOlimex ! And a happy New Year.

Sorry I haven't checked this in a while.
I appreciate the trouble you've went through to actually make two YouTube videos demonstrating the working capabilities of the board.
The only thing is that you have posted the same "OUTPUT" code on both videos.

I have ended up using GPIO 13 and GPIO 17 as OUTPUTS to send Wiegand signals and it works perfectly fine.

Now I am trying GPIO 15 and GPIO 16 as INPUTS for a different project. I thought of using GPIO14 but you've said that it experienced some issues as an INPUT.
I'm also not so sure about GPIO15 since it's listed as Internal Bootstrapping Resistor. I think it's used for the "Debugging Log on U0TXD During Booting", where 1 means "toggle" and 0 means "do not toggle". But I don't think this will be an issue because I will not pull GPIO 15 UP or DOWN on boot. All I need is to check its status in `void loop()`.

  //setting the pins for Inductive Loop
  pinMode(INDUCTION_1, INPUT_PULLUP);
  pinMode(INDUCTION_2, INPUT_PULLUP);
  digitalWrite(INDUCTION_1, HIGH);
  digitalWrite(INDUCTION_2, HIGH);