[KEAZN64] Hardfault exception is occurred due to WDOG

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[KEAZN64] Hardfault exception is occurred due to WDOG

651 Views
mohammedaboelna
Contributor III

Hello,

I have a very strange behavior using cortex M0.

I am trying to set pin before executing unlocking mechanism of WDOG but the result was core exception "Hardfault".

The strange point is that setting certain pins have this behavior while other pins don't.

Here is my piece of code with setting the pins that cause the core exception and the other pins that don't cause.

/* Scenario causing the core exception */

GPIOA_PSOR |= (1<<PTB0);

WDOG_CNT = 0x20C5; /* write the 1st unlock word */
WDOG_CNT = 0x28D9; /* write the 2nd unlock word */

WDOG_TOVALH = 0x03; // 15ms
WDOG_TOVALL = 0xAA;

/* Scenario NOT causing the core exception */

GPIOA_PSOR |= (1<<PTA6);

WDOG_CNT = 0x20C5; /* write the 1st unlock word */
WDOG_CNT = 0x28D9; /* write the 2nd unlock word */

WDOG_TOVALH = 0x03; // 15ms
WDOG_TOVALL = 0xAA;

My proposal that there is something wrong happens in the unlocking mechanism when setting pin PTB0 before.

because I tried to get this line "GPIOA_PSOR |= (1<<PTB0);" after the watchdog re-configuration as follows;

WDOG_CNT = 0x20C5; /* write the 1st unlock word */
WDOG_CNT = 0x28D9; /* write the 2nd unlock word */

WDOG_TOVALH = 0x03; // 15ms
WDOG_TOVALL = 0xAA;

GPIOA_PSOR |= (1<<PTB0);

AND there was no problem in the above piece of code !!.

Any help please.

Thank you in advance.

0 Kudos
1 Reply

550 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mohammed Aboelnasr ,

 I test the piece of your code on my side,  it can work well :

pastedImage_1.png

Which IDE do you used ?  Maybe there is some other problme ,You can share the whole project .

Hope it helps,


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos