Watchdog timer. Reset device after irq_handler

Hi, I have a watchdog timer working and I would like to do some stuff if the watchdog barks before reseting the BW16. If I don’t configure an irq handler the device resets perfectly, but if I set an irq handler, the handler executes, but the device doesn’t reset.

How can I force a device reset?? Is there any api call to reset the BW16?

Thx!!

One solution is you have to call sys_reset inside watchdog irq.

void my_watchdog_irq_handler(uint32_t id) {
    sys_reset();
}

Thx for your prompt answer. which include do I need for this function??

error: ‘sys_reset’ was not declared in this scope
sys_reset();

I’ve found this workround (but your’s is nicer! :slight_smile: )

void my_watchdog_irq_handler(uint32_t id) {

… do stuff …

wdt.StopWatchdog();
wdt.InitWatchdogIRQ(NULL, 0);
wdt.InitWatchdog(50);
wdt.StartWatchdog();  // enable watchdog timer

@Chano
Seem you are using Arduino platform right ?
I’m not sure for Arduino platform, but for standard SDK platform we must include “sys_api.h”.

Yes, I’m using Arduino platform, I’m porting an ESP32 code to RTL8720. I could have re-write it to the Official SDK but I didn’t find a reason for it. is there something relevant in the official SDK that I should consider??

And, thx, sys_api.h works in the arduino Platform

Thx again!!!
Regards

@Chano
I also don’t know what exactly difference between official standard SDK platform and Arduino platform.
One thing that I know is for product development it is recommended to use standard SDK platform.
if your project going well with Arduino platform no need to change it I think.

@ruanjanc ,

To clarify your question above, Ameba Arduino platform was ported based on standard sdk.

Thank you.

@dakamaster
Thank you for your clarify. Is Ameba Arduino platform able to use for products development ?

Thanks.

Could you please specify what kind of product you would like to develop?

Alternatively, you may refer to Ameba ARDUINO – Realtek IoT/Wi-Fi MCU Solutions for more information about Ameba(D) Arduino SDK.

Thanks