I ran into a simila problem on my Waveshare ESP32P4 nano
The cause is that GPIO39-GPIO48 are driven by VDD_IO_5 (see esp32p4 datasheet) and on Waveshare ESP32P4 nano VDD_IO_5 is connected to ESP_LDO_VO4 (see Waveshare ESP32P4 nano schematics).
The solution is to set LDO_VO4 to 3,3V
I did this in esp-idf according to the following example: esp-idf/examples/peripherals/lcd/mipi_dsi/main/mipi_dsi_lcd_example_main.c at master · espressif/esp-idf · GitHub
I simplified this to
#include "esp_ldo_regulator.h"
esp_ldo_channel_handle_t ldo4_handle = NULL;
esp_ldo_channel_config_t ldo_vo4 = {
.chan_id = 4,
.voltage_mv = 3300,
};
esp_err_t err = esp_ldo_acquire_channel(&ldo_vo4, &ldo4_handle);
if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to acquire LDO_CHANNEL_VO4: %s", esp_err_to_name(err));
return;
}
ESP_LOGI(TAG, "Acquired LDO_CHANNEL_VO4 and set to 3.3V");
After that the pins have 3,3V when set to high.
However I still did not manage to get TWAI working on these ports...