In the watchdog handler, you can go read the I2c EEPROM and write it back with your incremented value.If you keep a variable in the RAM, then you will loos its value on reset. Or if you have any external device other than FX3, you can indicate it to the, using a GPIO toggle
Thank you for your input.
I am going to store my counter in the I2C EEPROM. This part is clear. The problem is than I can not change the default watchdog interrupt handler, nor can I find the source code for the default watchdog interrupt handler in order to inject my code there.
I found CyU3PWDTIntHandler in cyu3vic.c.
However, only the watchdog timer counter is reloaded there. Cypress is reset somewhere else. I tried to put some test code in CyU3PWDTIntHandler, but it does not run. I think a precompiled version of cyu3vic.c. from the SDK is linked when building the project.
I tried another way to cope with my problem:
CY_U3P_VIC_VEC_ADDRESS = MyFx3IntHandler;
This does not work neither, because the default watchdog timer interrupt is used in the RTOS for other tasks, too. The result is a crashed program.
I think that watchdog "reset" occured by H/W when watchdog counter expire.
Watchdog counter expire is heppened if watchdog counter reload handler
is not called because of the FX3 device (micon) hang etc..
So it's impossible to do any process at watchdog reset event, I think.
I found the PP_INT register on FX3 Programmers Manual(DOC# 001-64707).
It have WDT_RESET bit.
This bit is "Indicates system woke up from a watchdog timer induced hard reset".
You might be able to use this bit for your purpose.
thank you very much for your reply!
I think your are right in your assumption about the watchdog mechanism.
I did try to look at the WDT_RESET bit, but sadly it is always 0.
May be the default settings for the watchdog do not provide hard reset and this is the reason why WDT_RESET does not change its state after watchdog event.
Does anyone know if the watchdog power managment settings can be overriden?
I refuse to believe that in such capable device as the FX3 such simple task can not be easily implemented.
Any help will be greatly appreciated!