Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

migmel
Posts: 22
Joined: Wed Oct 25, 2023 9:01 am

Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

Postby migmel » Wed Nov 08, 2023 12:31 am

Hello, I have received a custom board to test it. One of the items to test is whether GPIO33 to GPIO37 can be used for any task unrelated to SPI FLASH/PSRAM management.
The SoC model is ESP32-S3 and it is using a 16MB external flash memory and an 8MB external PSRAM IC. The SPI FLASH/PSRAM configuration is 4 data lines in QUAD mode.
At boot time the FLASH/PSRAM and operation mode are correctly recognized.
For one of the tests, I want to light 3 LEDs whose cathode are connected directly to GPIO33-35. LED's anodes are connected to a 3.3 V source thru a separate resistance for each LED.
The LEDs setting is like below:
  1. /* GPIO TEST */
  2. void set_gpio(void) {
  3.     gpio_config_t io_conf;
  4.     // Bit mask for the pins
  5.     io_conf.pin_bit_mask = (1ULL << GPIO_NUM_33)|(1ULL << GPIO_NUM_34)|(1ULL << GPIO_NUM_35)|(1ULL << GPIO_NUM_40);
  6.     // Set as an open-drain output pin.
  7.     io_conf.mode = GPIO_MODE_OUTPUT_OD;
  8.     // No pull-up/pull-down resistors.
  9.     io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
  10.     io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
  11.     // No interrupt enabled.
  12.     io_conf.intr_type = GPIO_INTR_DISABLE;
  13.     // Configure the GPIO with the settings.
  14.     gpio_config(&io_conf);
  15. }
I have added GPIO40 just as reference to compare the outputs.
Then I have created a task to blink the LEDs every 5 seconds:
  1. void gpio_task(void* arg) {
  2.     for(;;) {
  3.     gpio_set_level(GPIO_NUM_33, 0);
  4.     gpio_set_level(GPIO_NUM_34, 0);
  5.     gpio_set_level(GPIO_NUM_35, 0);
  6.     gpio_set_level(GPIO_NUM_40, 0);
  7.     vTaskDelay(pdMS_TO_TICKS(5000));
  8.     gpio_set_level(GPIO_NUM_33, 1);
  9.     gpio_set_level(GPIO_NUM_34, 1);
  10.     gpio_set_level(GPIO_NUM_35, 1);
  11.     gpio_set_level(GPIO_NUM_40, 1);
  12.     vTaskDelay(pdMS_TO_TICKS(5000));
  13.     }
  14. }
The results: only GPIO40 change status every 5 s, GPIO33-35 remain unchanged. Looks like the setting does not take effect at all for GPIO33-35
When the LEDs are not connected, GPIOs output is always 0 but once connected the LEDs are OFF. So, even when GPIO output is 0 there is not current coming into GPIO ports to turn LEDs ON.
I have read ESP32-S3 datasheet, reference manual and from it I understand that when SPI FLASH/PSRAM operate as 4 lines data in quad mode, GPIO33 to GPIO37 can be used. However I am struggling to set it correctly to be able to use them.

Please, can anybody guide me how to proceed with this? Evidently I am doing something wrong cannot realize myself.
Also, can anybody confirm that I can certainly use GPIO33-37 as outputs to light a LED?
Any help or advise would be greatly appreciated.
Thank you

username
Posts: 539
Joined: Thu May 03, 2018 1:18 pm

Re: Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

Postby username » Wed Nov 08, 2023 5:37 am

Not 100% sure what flavor ESP32-S3 you have, but check this link:
https://docs.espressif.com/projects/esp ... io-summary

Further down on that page you will see this.


Strapping pin: GPIO0, GPIO3, GPIO45 and GPIO46 are strapping pins. For more infomation, please refer to ESP32-S3 datasheet.

SPI0/1: GPIO26-32 are usually used for SPI flash and PSRAM and not recommended for other uses. When using Octal Flash or Octal PSRAM or both, GPIO33~37 are connected to SPIIO4 ~ SPIIO7 and SPIDQS. Therefore, on boards embedded with ESP32-S3R8 / ESP32-S3R8V chip, GPIO33~37 are also not recommended for other uses.

USB-JTAG: GPIO 19 and 20 are used by USB-JTAG by default. In order to use them as GPIOs, USB-JTAG will be disabled by the drivers.

migmel
Posts: 22
Joined: Wed Oct 25, 2023 9:01 am

Re: Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

Postby migmel » Wed Nov 08, 2023 6:58 am

Thank you for your reply,
The note you attached applies to any ESP-32-S3 flavor. It's just that in case of ESP32-S3R8 / ESP32-S3R8V chips, they already have in-package SPI FLASH/PSRAM with octal mode preset. So, it is not possible to set 4 data lines FLASH/PSRAM Quad mode for this models.
In my case, the model I have is one that does not include in-package SPI FLASH/PSRAM and external flash/psram are necessary otherwise will only have the 512 KB internal SRAM. In this context, datasheet states that GPIO33 to GPIO37 group have "no restrictions, unless the chip is connected to flash/PSRAM using 8-line SPI mode" which is not my case.
Now, no restrictions means that theoretically I can use this GPIO group for any IO general purpose. for that reason I am struggling trying to light these LEDs connected to this group of GPIOs.
The note is also a little confusing as "not recommended" is not the same as not allowed, which is actually the case when octal FLASH/PSRAM are in use.

MicroController
Posts: 1735
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

Postby MicroController » Wed Nov 08, 2023 9:50 pm

We had that topic here a few weeks ago.
Also, can anybody confirm that I can certainly use GPIO33-37 as outputs to light a LED?
No, you cannot.
"not recommended" is not the same as not allowed
In this case, "not recommended" apparently means that the hardware is in theory capable of doing it, but the runtime environment (ESP-IDF) won't let you do it without something breaking.

migmel
Posts: 22
Joined: Wed Oct 25, 2023 9:01 am

Re: Can a LED be directly connected to GPIO33-GPIO37 on ESP32-S3?

Postby migmel » Thu Nov 09, 2023 4:41 am

No, you cannot.
Thank you for the confirmation. I have empirically come to it but kept trying because of the datasheet statements. Datasheet is misleading in this regard and should be modified or have fixed this issue in the latest ESP-IDF version.
I am using ESP-IDF 5.1.1 which is the previous version to the latest Master version. It has probably been already fixed in Master, however i think it is not mature enough and some bugs have to be addressed before it can be completely trusted.
Thank you guys

Who is online

Users browsing this forum: No registered users and 91 guests