ESP32-P4 Functional Eval Kit and GPIO > 36 (Solved)

microfoundry
Posts: 4
Joined: Tue Dec 19, 2023 3:06 pm

ESP32-P4 Functional Eval Kit and GPIO > 36 (Solved)

Postby microfoundry » Sun Apr 20, 2025 6:10 pm

Greetings - there's a comment in the pins_arduino.h file for the esp32p4 board that states:

Code: Select all

 // Use GPIOs 36 or lower on the P4 DevKit to avoid LDO power issues with high numbered GPIOs.
What's up with that? Is it an issue with the ESP32-P4 chip itself? Or a design issue with the Functional Eval Kit? And are there any workarounds?

-TGP
Last edited by microfoundry on Mon Apr 21, 2025 5:23 am, edited 1 time in total.

microfoundry
Posts: 4
Joined: Tue Dec 19, 2023 3:06 pm

Re: ESP32-P4 Functional Eval Kit and GPIO > 36 (Solved)

Postby microfoundry » Mon Apr 21, 2025 5:20 am

I figured it out after doing some digging. Seems the ESP32-P4 has 4 channels of LDOs. And with the Esp32 Arduino Core I'm currently on (v3.2.0), the 3rd and 4th LDOs are not initialized by default.

Code: Select all

ESP LDO Channel State:
Index ID    ref_cnt    voltage_mv   adjustable
0     1     1          3300         no   
1     2     1          1900         no   
2     -1    0          0            yes  
3     -1    0          0            yes  

Here's a simple sketch to output and initialize the LDOs:

Code: Select all

#include "esp_ldo_regulator.h"

esp_ldo_channel_handle_t ldo2 = NULL;
esp_ldo_channel_handle_t ldo3 = NULL;


void setup() {
  Serial.begin(115200);
  delay(1000);

  esp_ldo_dump(stdout);

    // Create configuration for LDO index 2
  esp_ldo_channel_config_t config2 = {
    .chan_id = 3,  // discovered by trial and error
    .voltage_mv = 3300,
    .flags = {
      .adjustable = 1,
      .owned_by_hw = 0,
      .bypass = 0
    }
  };

  // Create configuration for LDO index 3
  esp_ldo_channel_config_t config3 = {
    .chan_id = 4,  // discovered by trial and error
    .voltage_mv = 3300,
    .flags = {
      .adjustable = 1,
      .owned_by_hw = 0,
      .bypass = 0
    }
  };

  // Try to acquire both channels
  if (esp_ldo_acquire_channel(&config2, &ldo2) == ESP_OK) {
    Serial.println("LDO index 2 acquired");
  } else {
    Serial.println("Failed to acquire LDO index 2");
  }

  if (esp_ldo_acquire_channel(&config3, &ldo3) == ESP_OK) {
    Serial.println("LDO index 3 acquired");
  } else {
    Serial.println("Failed to acquire LDO index 3");
  }

  // Adjust voltage if you want to set it again (redundant if already set above)
  if (ldo2) {
    esp_ldo_channel_adjust_voltage(ldo2, 3300);
    Serial.println("LDO index 2 voltage adjusted");
  }

  if (ldo3) {
    esp_ldo_channel_adjust_voltage(ldo3, 3300);
    Serial.println("LDO index 3 voltage adjusted");
  }

  // Optionally: dump to see results
  esp_ldo_dump(stdout);
}

void loop(){}

And you should receive this:

Code: Select all

LDO index 2 acquired
LDO index 3 acquired
LDO index 2 voltage adjusted
LDO index 3 voltage adjusted

ESP LDO Channel State:
Index ID    ref_cnt    voltage_mv   adjustable
0     1     1          3300         no   
1     2     1          1900         no   
2     3     1          3300         yes  
3     4     1          3300         yes  
Best regards,

microfoundry
Last edited by microfoundry on Mon Apr 21, 2025 5:23 am, edited 1 time in total.

**txf**
Posts: 13
Joined: Thu Apr 21, 2022 3:03 pm

Re: ESP32-P4 Functional Eval Kit and GPIO > 36 (Solved)

Postby **txf** » Wed May 07, 2025 8:11 am

I'm currently having the same issue, Does configuring the LDOs actually make the GPIOs work?

I'm using ESP-IDF and a custom P4 board and this is the default state I get from esp_ldo_dump():

Code: Select all

ESP LDO Channel State:
Index ID    ref_cnt    voltage_mv   adjustable
0     1     1          3300         no   
1     -1    0          0            yes  
2     -1    0          0            yes  
3     -1    0          0            yes 

troyhacks
Posts: 1
Joined: Sat Aug 30, 2025 6:13 pm

Re: ESP32-P4 Functional Eval Kit and GPIO > 36 (Solved)

Postby troyhacks » Sat Aug 30, 2025 6:18 pm

The answer is "yes, it does!"

I was experimenting with Parallel IO (aka PARLIO) and couldn't figure out why GPIO47 and GPIO48 weren't working.

After the code was added, they sprung to life.

Thanks, @microfoundry !

Who is online

Users browsing this forum: YisouSpider and 4 guests