You are here

Cypress FX3 customizing watchdog interrupt handler | Cypress Semiconductor

Cypress FX3 customizing watchdog interrupt handler

Summary: 5 Replies, Latest post by Georgi Georgiev on 27 Nov 2016 11:51 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
Georgi Georgiev's picture
User
4 posts

I need to increment an eeprom counter when a watchdog reset event occurs. I am aware that I can use a static variable in ram memory. But in that case i would not be able to distinguish between a true watchdog reset and a hardware reset (hardware reset button press event). 

Is there a way to reimplement the default watchdog interrupt handler?
Or may be there is even simpler approach to that very problem?

Thank you in advance.

nisa's picture
Cypress Employee
85 posts

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

Georgi Georgiev's picture
User
4 posts

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[4]   = 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.

Hi,

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.

Regards,

H.Murakami

Georgi Georgiev's picture
User
4 posts

Hi!

Mr. Murakami,
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.

Regards,
Georgi Georgiev

Georgi Georgiev's picture
User
4 posts

Any help will be greatly appreciated!
 

Log in to post new comments.