esp_restart() from esp_timer callback doesn't work in 3.1.3

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

esp_restart() from esp_timer callback doesn't work in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 3:51 pm

esp_restart() is not working for me all of a sudden. The call doesn't seem to have any effect.

It seems the only relevant thing I changed recently was upgrade from ESP-IDF 3.1.1 to 3.1.3.

Anyone else experience this? How should I begin to troubleshoot?

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: esp_restart() broken in 3.1.3

Postby Ritesh » Tue Mar 05, 2019 4:36 pm

phatpaul wrote:
Tue Mar 05, 2019 3:51 pm
esp_restart() is not working for me all of a sudden. The call doesn't seem to have any effect.

It seems the only relevant thing I changed recently was upgrade from ESP-IDF 3.1.1 to 3.1.3.

Anyone else experience this? How should I begin to troubleshoot?
What is the return type of that call esp_return()?
Regards,
Ritesh Prajapati

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: esp_restart() broken in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 4:43 pm

Code: Select all

/**
  * @brief  Restart PRO and APP CPUs.
  *
  * This function can be called both from PRO and APP CPUs.
  * After successful restart, CPU reset reason will be SW_CPU_RESET.
  * Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset.
  * This function does not return.
  */
void esp_restart(void) __attribute__ ((noreturn));
There is no return from that function!

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: esp_restart() broken in 3.1.3

Postby Ritesh » Tue Mar 05, 2019 4:47 pm

phatpaul wrote:
Tue Mar 05, 2019 4:43 pm

Code: Select all

/**
  * @brief  Restart PRO and APP CPUs.
  *
  * This function can be called both from PRO and APP CPUs.
  * After successful restart, CPU reset reason will be SW_CPU_RESET.
  * Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset.
  * This function does not return.
  */
void esp_restart(void) __attribute__ ((noreturn));
There is no return from that function!
Ok. So, That IDF version is stable or development master branch?
Regards,
Ritesh Prajapati

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: esp_restart() broken in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 4:50 pm

FYI some maybe relavent info.
I added a printf after the esp_restart() call, and it does NOT execute. (I do not see "Should not get here!...\n" on the console.)

But other parts of my application are still running - BLE, WiFi, and probalby other tasks are still running...

Here's the reset code:

Code: Select all

static void resetBtnTimerCb(void *arg) {
...
printf("Restarting system...\n");
esp_restart();
printf("Should not get here!...\n");
And that resetBtnTimerCb is called by a esp_timer:

Code: Select all

	/* Create a periodic timer which will run every 0.1s */
	const esp_timer_create_args_t periodic_timer_args = {
			.callback = &resetBtnTimerCb,
			/* name is optional, but may help identify the timer when debugging */
			.name = "periodic"
	};
	esp_timer_handle_t periodic_timer;
	ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
	/* The timer has been created but is not running yet */

	/* Start the timers */
	ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, RST_BTN_SAMPLE_MS*1000));
	ESP_LOGI(TAG, "Started resetBtn timer, time since boot: %lld us", esp_timer_get_time());

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: esp_restart() broken in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 4:56 pm

I'm on release/v3.1 branch.
Most recent commit that I pulled was 57118e2f10a79af0627ed56d42d24584cd4033d8
(It is several commits after the 3.1.3 tag.)

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: esp_restart() broken in 3.1.3

Postby Ritesh » Tue Mar 05, 2019 4:57 pm

phatpaul wrote:
Tue Mar 05, 2019 4:50 pm
FYI some maybe relavent info.
I added a printf after the esp_restart() call, and it does NOT execute. (I do not see "Should not get here!...\n" on the console.)

But other parts of my application are still running - BLE, WiFi, and probalby other tasks are still running...

Here's the reset code:

Code: Select all

static void resetBtnTimerCb(void *arg) {
...
printf("Restarting system...\n");
esp_restart();
printf("Should not get here!...\n");
And that resetBtnTimerCb is called by a esp_timer:

Code: Select all

	/* Create a periodic timer which will run every 0.1s */
	const esp_timer_create_args_t periodic_timer_args = {
			.callback = &resetBtnTimerCb,
			/* name is optional, but may help identify the timer when debugging */
			.name = "periodic"
	};
	esp_timer_handle_t periodic_timer;
	ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
	/* The timer has been created but is not running yet */

	/* Start the timers */
	ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, RST_BTN_SAMPLE_MS*1000));
	ESP_LOGI(TAG, "Started resetBtn timer, time since boot: %lld us", esp_timer_get_time());
Which ESP32 Hardware you are using? Did you try with other ESP32 board as well if possible?

Also did you try with older release like 3.2 stable?
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: esp_restart() broken in 3.1.3

Postby Ritesh » Tue Mar 05, 2019 4:58 pm

phatpaul wrote:
Tue Mar 05, 2019 4:56 pm
I'm on release/v3.1 branch.
Most recent commit that I pulled was 57118e2f10a79af0627ed56d42d24584cd4033d8
(It is several commits after the 3.1.3 tag.)
Did you check same issue into master development branch?
Regards,
Ritesh Prajapati

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: esp_restart() broken in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 6:33 pm

Ritesh, I don't think 3.2 is stable, based on the first sticky post on this forum - says 3.1.3 is latest stable of ESP-IDF.

OK I checked it on:
- tag 3.1.3 - not working
- tag 3.1.2 - not working
- tag 3.1.1 - working!

My hardware is ESP32-WROVER (16M FLASH + 4M RAM) on a custom board.

Looks like I should open a bug on github?

phatpaul
Posts: 110
Joined: Fri Aug 24, 2018 1:14 pm

Re: esp_restart() broken in 3.1.3

Postby phatpaul » Tue Mar 05, 2019 10:28 pm

I upgraded to release/3.2 branch
(It wouldn't compile -- I had to upgrade my entire msys2 from https://dl.espressif.com/dl/esp32_win32 ... 181001.zip )

The esp_restart() is still not working for me in 3.2.
(It works in 3.1.1)

Any other ideas?

Who is online

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