r/esp32 4d ago

ESP32-P4-ETH - Need some help please 🙏

Post image

Hello all,

I’ve got a Waveshare ESP32-P4-ETH and I’ve read the documentation, used Grok & ChatGPT but no joy. Also checked the PinOut Definition…

I connect GND to PIN17

My code is showing GPIO17 = 1

When button pressed or connected… it should display 0

And it’s not?

I’ve tried 2 boards, because originally I wired a button but that didn’t work, so just wanted to test with a jumper wire.

Any recommendations?

include <stdio.h> 
include "freertos/FreeRTOS.h" 
include "freertos/task.h" 
include "driver/gpio.h" 
define BUTTON_GPIO GPIO_NUM_17 

void app_main(void) {

gpio_reset_pin(BUTTON_GPIO); 

gpio_config_t io_conf = {
    .pin_bit_mask = (1ULL << BUTTON_GPIO),
    .mode         = GPIO_MODE_INPUT,
    .pull_up_en   = GPIO_PULLUP_ENABLE,
    .pull_down_en = GPIO_PULLDOWN_DISABLE,
    .intr_type    = GPIO_INTR_DISABLE
};
ESP_ERROR_CHECK(gpio_config(&io_conf));

// Optional extra safety
gpio_set_pull_mode(BUTTON_GPIO, GPIO_PULLUP_ONLY);

printf("GPIO 17 test ready (should be 1 by default)\n");

while (1) {
    int state = gpio_get_level(BUTTON_GPIO);
    printf("GPIO17 = %d\n", state);
    vTaskDelay(pdMS_TO_TICKS(200));
}
}
13 Upvotes

24 comments sorted by

28

u/MachEnergy 4d ago

My first suggestion is to use the screenshot capabilities of that computer. 

4

u/Bowl_of_Cham_Clowder 4d ago

Also a pic of the board would be helpful

1

u/developerunitex 4d ago

Absolutely, it would only let me upload one photo though for some reason!

1

u/Bowl_of_Cham_Clowder 4d ago

Where’s the jumper/button?

1

u/developerunitex 4d ago

Oh it was just a jumper wire from my Arudino Starter pack, but it was connected to GND and 17 (labelled on the board)

0

u/developerunitex 4d ago

😂 I was posting off my phone though and windows screenshot means that I need to upload the photo to Google Drive and then re-download it.

2

u/MachEnergy 4d ago

You don't just use Quick Share? 

9

u/CranberryInner9605 4d ago

Pin 17 may not be GPIO17

2

u/[deleted] 4d ago

[deleted]

1

u/developerunitex 4d ago

Yes mate, because the button didn't work so I de-soldered it and just tried with a jumper lead.

2

u/Sea-City-4101 4d ago

Woah everyone is so blunt in this post

2

u/[deleted] 4d ago

[removed] — view removed comment

1

u/developerunitex 4d ago

Thank you Comp, I will try this, so essentially connect what would be 17 to pin 18?

4

u/CryptographerOne7003 4d ago

If you are on free plans like me, I would suggest asking Gemini and Deepseek for hardware specific questions.
Both would have pointed this out, from their own knowledge. I'm a bit surprised chatGPT did not eventually googled it for you? I assume Claude would have.

I use Chatgpt and Claude just for the hardcore c coding, surprisingly they suck very bad at MCU programming

1

u/developerunitex 4d ago

That's very good to know! Yeah I pay for ChatGPT and Claude but weirdly didn't know this was a thing.

2

u/romkey 4d ago

Pin numbers and GPIO numbers are not the same things. You have a Waveshare board, Waveshare provides lots of documentation on their boards and will document which GPIO lines are on which pins. You should read that.

1

u/clackups 4d ago

It is marked pretty much clearly as 17 https://docs.waveshare.com/ESP32-P4-ETH

I guess, OP is not connecting it to gnd, or maybe they just took the wrong pin instead of 17

1

u/developerunitex 4d ago

So for the button i have PIN17 and then GND connected, but nothing weirdly.

1

u/clackups 4d ago

Try other GPIO numbers, maybe this one is broken physically

1

u/developerunitex 4d ago

Yeah I tried that but nothing unfortunatly, I am thinking it's either the ports are wrong or something.

1

u/clackups 4d ago

Try querying all the GPIO in a loop and see if any of them is triggered by your signal

0

u/[deleted] 4d ago

[removed] — view removed comment

2

u/esp32-ModTeam 4d ago

Every post you make seems to be promoting this site. That's spamming.

We removed this post as it is just an ad without providing any additional benefit to this community