How to remove PWM signal from GPIO14?

Stomper
Posts: 16
Joined: Tue Mar 31, 2020 10:33 pm

How to remove PWM signal from GPIO14?

Postby Stomper » Thu May 12, 2022 9:12 am

Hello,

right after Boot, the PIN14 outputs a PWM signal.
But I need to use this pin as normal PushPull Output.

How can I remove the PWM signal? Nothing I found in the forum helps (gpio_reset_pin() or ledc config).

Can someone help me please?

Best regards

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to remove PWM signal from GPIO14?

Postby mbratch » Thu May 12, 2022 10:52 am

Which ESP32 are you using?

Stomper
Posts: 16
Joined: Tue Mar 31, 2020 10:33 pm

Re: How to remove PWM signal from GPIO14?

Postby Stomper » Thu May 12, 2022 11:51 am

Thanks for your reply...
I am using an

ESP32-SOLO-1

Thanks

ESP_Sprite
Posts: 9749
Joined: Thu Nov 26, 2015 4:08 am

Re: How to remove PWM signal from GPIO14?

Postby ESP_Sprite » Thu May 12, 2022 1:18 pm

Are you sure it's not an external signal?

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to remove PWM signal from GPIO14?

Postby mbratch » Thu May 12, 2022 1:37 pm

It's not normal for the ESP32 to power up with an active PWM signal on a GPIO. As ESP_Sprite suggests, if you have your ESP32 in-circuit, check for something outside the ESP32 that might be driving it.

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: How to remove PWM signal from GPIO14?

Postby Craige Hales » Thu May 12, 2022 2:54 pm

https://randomnerdtutorials.com/esp32-p ... nce-gpios/ does show a pwm signal during boot on several pins for some device. That is consistent with my experience too. I live with it; it makes an unusual 7-seg display until the boot is finished. I wish I'd rearranged the pinout to hide it.
Craige

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to remove PWM signal from GPIO14?

Postby mbratch » Thu May 12, 2022 9:03 pm

Craige Hales wrote:
Thu May 12, 2022 2:54 pm
https://randomnerdtutorials.com/esp32-p ... nce-gpios/ does show a pwm signal during boot on several pins for some device. That is consistent with my experience too. I live with it; it makes an unusual 7-seg display until the boot is finished. I wish I'd rearranged the pinout to hide it.
Thanks for the link, Craige. The article isn't totally consistent on this. In a table, they say this applies to GPIOs 0, 5, 14, and 15. Later in the text, it says it applies to GPIO 1, 3, 5, 6-11, 14, and 15. I hadn't seen that before. Seems like odd behavior. I wonder if there's a specific reason for it. I use the ESP32 Pico Devkit and the documentation doesn't mention it. Nor have I spotted it in the ESP32 Technical Reference (although it might be there, stated in a way I did see).
Last edited by mbratch on Mon May 16, 2022 5:29 pm, edited 2 times in total.

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to remove PWM signal from GPIO14?

Postby mbratch » Mon May 16, 2022 1:04 am

I was very curious about this so I decided to do some detailed testing of some of the I/O ports on my ESP32 Pico Devkit (which uses the ESP32-PICO-D4) and see how they behaved at boot-up. The GPIO ports on my ESP32 don't behave much at all like described in the linked article. I didn't test every GPIO, but I tried a sample variety, a couple of which were mentioned specifically in the article as high or outputting PWM at boot.

Below is a trace I captured using a digital scope. GPIO 32, 26, and 14 are connected to LEDs in my circuit, but GPIO 15 is open. Here are some observations from the trace:

Image (Click here if image doesn't appear).
  • The ~160ms at the start is where I'm pressing the reset button on the ESP32 board. While the button is pressed (EN is pulled low on the board pinout, which is ESP32 CHIP_PU pin),
  • None of the ports measured showed PWM output after boot. This was confirmed by zooming into the trace down to 5us division.
  • After boot and when the application gets control, it initializes eight of the GPIOs for LED control. All eight of these are initialized exactly the same way. Three of these are GPIOs 14, 26, and 32. The initialization process takes about 600ms and, during this time, a couple of the ports would output a low voltage level (~2Vdc). This doesn't happen on every port and it's unclear on what ports in general it would occur on. It did occur on GPIO 14, which was one of the ports cited in the article as outputting either high or PWB after boot (neither of which this port did on my ESP32).
  • After the 600ms initialization period, the code turns all of the LEDs for 1 second and then turns them off, which can be seen in the trace.
I also tried a couple of ports on an ESP32-WROOM-32 with same results, but it was just a couple of them.

My conclusion is that the article may be incorrect about certain ports outputting PWM, specifically, after boot. I did observe some ports default to high (3.3v) output after boot (maybe about half of them). In addition, some ports (not all) will output ~2Vdc when the CPU is held in reset and during PWM configuration. Again, I did not observe any PWM specific signals emitting from any of the ports during boot.

Regarding the original question in this thread, I would like to know how it was determined that some ports are outputting PWB at boot. Or is it just the 600ms low voltage signal that I'm seeing as well?

Stomper
Posts: 16
Joined: Tue Mar 31, 2020 10:33 pm

Re: How to remove PWM signal from GPIO14?

Postby Stomper » Thu May 19, 2022 10:03 am

Thanks for all the efforts.

I found, that the Solo Crashes because of mem issues and core issues.
I set Single Core operation in RTOS and reduced heap size for tasks.

Now it is working as expected!

Best regards

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: How to remove PWM signal from GPIO14?

Postby Craige Hales » Fri May 20, 2022 1:47 am

Thanks @mbratch!

I studied some more and now understand my case. The document "ESP32 Series Datasheet" page 62, appendix A, "IO Mux" describes pins after reset, some not enabled, some Input enabled, and if input enabled with a weak pull up, pull down, or neither.
The weak pull up and weak pull down is sufficient to interact with the 7-segment matrix (4 digits, 7segs+decimal) until my code gets around to setting the GPIOs. Now that I understand, it would have been easy to swap some GPIOs around, during the board design. I might still initialize them sooner. (Yes. An input port, with an internal pull down will sink some current, or a pull up will source some current. Also looks like a zero or one.)

The data sheet actually has two columns, "at reset" and "after reset". For example, GPIO 13 floats while the reset button is pressed, then goes low.

I'll guess the incorrect attribution to PWM is because driving an LED with a wpu/wpd produces a dim PWM-like effect. Looking at it with a scope and an LED load shows a DC level somewhere between. But not a PWM signal.
Craige

Who is online

Users browsing this forum: Google [Bot] and 104 guests