GPIO0 PWM Peak to Peak Voltage
Posted: Mon Jul 21, 2025 7:23 pm
I have some ESP-WROOM-32 modules and I noticed that the PWM voltage on GPIO0 does not actually go to 0V. PWM on other pins behaves as expected. Here is a pinout of the ESP modules:
I attached the negative oscilloscope probe to the ground pin on the outside row of the right side GPIO header. The positive probe was attached to GPIO0.
And here is the oscilloscope result:
Lastly, here is the code I'm using to generate the PWM. I'm using the Arduino IDE serial interface to adjust the PWM on two different pins (Channel 1 - GPIO2 & Channel 2 - GPIO0):
I think I can only attach three files, so I will reply with the oscilloscope result of Channel 1 (GPIO2) to show that it is normal.
I attached the negative oscilloscope probe to the ground pin on the outside row of the right side GPIO header. The positive probe was attached to GPIO0.
And here is the oscilloscope result:
Lastly, here is the code I'm using to generate the PWM. I'm using the Arduino IDE serial interface to adjust the PWM on two different pins (Channel 1 - GPIO2 & Channel 2 - GPIO0):
Code: Select all
const byte numChars = 6;
char receivedChars[numChars];
char pwm[4];
const byte ch1pwm = 2;
const byte ch2pwm = 0;
boolean newData = false;
byte recSize = 0;
void setup() {
// set up pins
pinMode(ch1pwm, OUTPUT);
pinMode(ch2pwm, OUTPUT);
// begin serial
Serial.begin(115200);
}
void loop() {
static byte ndx = 0;
char endMarker = '\n';
char rc;
while (Serial.available() > 0 && !newData) {
rc = Serial.read();
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
recSize = ndx - 1;
ndx = 0;
newData = true;
}
}
if (newData) {
newData = false;
if (recSize > 1) {
strncpy(pwm, receivedChars + 1, recSize - 1);
pwm[recSize - 1] = '\0';
if (receivedChars[0] == '1') {
Serial.print("Channel 1: ");
Serial.println(pwm);
analogWrite(ch1pwm, atoi(pwm));
}
if (receivedChars[0] == '2') {
Serial.print("Channel 2: ");
Serial.println(pwm);
analogWrite(ch2pwm, atoi(pwm));
}
}
}
}I think I can only attach three files, so I will reply with the oscilloscope result of Channel 1 (GPIO2) to show that it is normal.