Page 1 of 2
esp_restart() from esp_timer callback doesn't work in 3.1.3
Posted: Tue Mar 05, 2019 3:51 pm
by phatpaul
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?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:36 pm
by Ritesh
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()?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:43 pm
by phatpaul
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!
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:47 pm
by Ritesh
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?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:50 pm
by phatpaul
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());
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:56 pm
by phatpaul
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.)
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:57 pm
by Ritesh
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?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 4:58 pm
by Ritesh
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?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 6:33 pm
by phatpaul
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?
Re: esp_restart() broken in 3.1.3
Posted: Tue Mar 05, 2019 10:28 pm
by phatpaul
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?