MK66FX - WDOG do not work

cancel
Showing results for 
Search instead for 
Did you mean: 

MK66FX - WDOG do not work

Jump to solution
416 Views
AlessioS
Contributor I

Hi,

i have a board based on MK66FX1M0 uC , i have configured WDOG but when i try to reset the internal counter nothing seems to change, can someone help me?

 

My code : 

/**
* @file test_mk66fx.c
* @brief Application entry point.
*/
#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "MK66F18.h"

/* TODO: insert other include files here. */
#include "fsl_gpio.h"
#include "fsl_wdog.h"

/* Define I/O PIN*/

#define BOOT_LED 28U // pin 28 of GPIOE - NOTE : InitBootPins() switch on the led


/* TODO: insert other definitions and declarations here. */
void setup(void);
void loop(void);

/*
* @brief Application entry point.
*/
int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
//dopo la fase di setuo scheda spegne il led
GPIO_PinWrite(GPIOE,BOOT_LED,1); // switch off led - The led is switched on with InitBootPins()
setup();
WDOG_Refresh(WDOG_PERIPHERAL); // Reset The whatcdog
/* Enter an infinite loop*/
while(1) {
loop();
WDOG_Refresh(WDOG_PERIPHERAL);
}
return 0 ;
}

void setup(void){
}

void loop(void){

}

 
Peripherals configuration : 
 
WDOGCONFIG
 
0 Kudos
1 Solution
368 Views
nxf58904
NXP TechSupport
NXP TechSupport

Hi,

Please add the statement as follow shows,

while (GetTimerOutputValue(wdog_base) < (WDOG_config.timeoutValue >> 3U))
{
}

 

I have recur your issue and fix after add this statement.

 

 

Have a great day,
TIC

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

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

View solution in original post

0 Kudos
5 Replies
369 Views
nxf58904
NXP TechSupport
NXP TechSupport

Hi,

Please add the statement as follow shows,

while (GetTimerOutputValue(wdog_base) < (WDOG_config.timeoutValue >> 3U))
{
}

 

I have recur your issue and fix after add this statement.

 

 

Have a great day,
TIC

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

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

View solution in original post

0 Kudos
223 Views
ahmedhrabi
Contributor III

HI  @nxf58904

Have you any explications, why we have to wait (WDOG_config.timeoutValue >> 3U), which is about the the timeout value/8, to can refresh again the Wdog. This delay is too long (for a Wdg timeout of 500 ms per example we have a delay of 500 ms >> 3U = 62 ms to wait before refreshing again !!) . 

I noticed that in my project i have the same issue, if i refresh the wdg before the WDOG_config.timeoutValue >> 3U delay, the Wdog reset automatically the chip. 

Regards. 

 

0 Kudos
353 Views
AlessioS
Contributor I

Hi,
I have try the code and now it work god.
My final code is :

 

void WDOG_RESET(){
WDOG_Refresh(WDOG_PERIPHERAL); // Reset The whatcdog
while (GetTimerOutputValue(WDOG_PERIPHERAL) < (WDOG_config.timeoutValue >> 3U))
{
}
}

static inline uint32_t GetTimerOutputValue(WDOG_Type *base)
{
return (uint32_t)((((uint32_t)base->TMROUTH) << 16U) | (base->TMROUTL));
}

0 Kudos
396 Views
AlessioS
Contributor I

Yes when i try to refresh the watch dog counter it will continue to work and the onboard led will blink

0 Kudos
402 Views
nxf58904
NXP TechSupport
NXP TechSupport

Hi,

You mean nothing had changed when you reset the counter,what you mean is that you reset the counter but the cnt didn't reset?

When you refresh the counter , the watch dog will continue to work. Only when the watch dog was time out,it will reset the Mcu.

 

 

Have a great day,
TIC

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

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos