[SOLVED] Microsecond Glitch at Startup / How to Disable IO Re-Initialization

chrismerck
Posts: 75
Joined: Tue May 29, 2018 8:00 pm

[SOLVED] Microsecond Glitch at Startup / How to Disable IO Re-Initialization

Postby chrismerck » Fri Oct 16, 2020 12:57 am

BRIEF: How to disable GPIO re-initialization at boot time?

DETAIL:

* We abuse the HSPI bus to output a proprietary protocol on IO pins.
* The protocol requires a normally high state.
* The ESP32 occasionally needs to reboot.
* We want the IO pin to remain in a high state throughout the reboot and re-initialization.
* We observe a 1 microsecond negative pulse during reboot. (See oscilloscope capture below)
* Judging from the slow skew on the rising edge of the pulse, I believe the pin is being set to an INPUT with PULLUP. It then later gets configured for HSPI use without any further glitch occurring.
* Unfortunately, this glitch causes malfunction of the hardware on the other end of this protocol, which we cannot control.
* Therefore, we seek a way to eliminate this negative pulse occurring on reboot.
* I guess that there is some initialization code where ESP-IDF sets all IO pins to input with pull-up. I would want to disable that behavior. Hopefully this can be done from within the IDF. I.e., that it is not an immutable (ROM) part of the boot process.

Any suggestion on avoiding this sort of IO glitch on reboot is much appreciated.

Cheers from Scenic Northern New Jersey,
-Chris
96036787-f49cc300-0e32-11eb-90b8-17fbf38c2317.png
96036787-f49cc300-0e32-11eb-90b8-17fbf38c2317.png (18.69 KiB) Viewed 4265 times
Last edited by chrismerck on Wed Oct 21, 2020 4:24 pm, edited 1 time in total.

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

Re: Microsecond Glitch at Startup / How to Disable IO Re-Initialization

Postby ESP_Sprite » Fri Oct 16, 2020 1:14 am

How are you rebooting the ESP32? What IO pin are you using?

chrismerck
Posts: 75
Joined: Tue May 29, 2018 8:00 pm

Re: Microsecond Glitch at Startup / How to Disable IO Re-Initialization

Postby chrismerck » Fri Oct 16, 2020 12:19 pm

GPIO17 and GPIO18. Above capture was of GPIO18.

We are software-rebooting the ESP32 like this:

Code: Select all

void Osal_Reboot()
{
  SysUser("Rebooting NOW!");
  Osal_Sleep_Ms(100);
  /* Leave the RTC slow memory powered during deep sleep.
     Without this, we get corruption and bootloops on PBB. */
  esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
  /* We do not use esp_restart() because that would cause RTC mem to be init */
  /* WARNING: ESP-IDF docs warn that we should shutdown WiFi + BLE prior to
     calling esp_deep_sleep. However, we are not doing that... */
  esp_deep_sleep(1000 /* 1 ms */);
  /* never reaches here */
  while (1); /* just in case */
}

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

Re: Microsecond Glitch at Startup / How to Disable IO Re-Initialization

Postby ESP_Sprite » Sat Oct 17, 2020 2:44 am

Possibly gpio_hold_en(pin); and gpio_deep_sleep_hold_en(); do what you want.

chrismerck
Posts: 75
Joined: Tue May 29, 2018 8:00 pm

[SOLVED] Re: Microsecond Glitch at Startup / How to Disable IO Re-Initialization

Postby chrismerck » Wed Oct 21, 2020 4:24 pm

Thank you, that is exactly what I was looking for!

(However, I note that it turns out that the 1 uS glitch I showed was being driven by another part on the board, not the ESP32.)

Who is online

Users browsing this forum: Bing [Bot], Google Adsense [Bot] and 141 guests