AnsweredAssumed Answered

[KEAZN64] Hardfault exception is occurred due to WDOG

Question asked by Mohammed Aboelnasr on Aug 27, 2018
Latest reply on Aug 28, 2018 by Alice_Yang

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.

Outcomes