Watchdog kicks in for 22F

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

Watchdog kicks in for 22F

Jump to solution
800 Views
cwati
Contributor III

Hi there,

I've got a working code running happily on Freedom eval stack.  Now the production board comes in, and the same software doesn't run anymore.
The only difference in the board is Eval board has 512 memory and the production is using 256 (MK22FN256xxx12).

I've made changes to the include paths/ files etc to use 256 instead of 512

I could trace the code and blinks some LEDs, however, then the watchdog kicks in.

I got stopped at Watchdog_IRQHandler.

Thread [1] <main> (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
Watchdog_IRQHandler() at startup_MK22F25612.S:356 0x518
<signal handler called>() at 0xfffffff9
hardware_init() at hardware_init.c:37 0x9a7c
main() at main.c:478 0xa2f2

I notice that we do go through the SystemInit (in system_MK22F25612.c) and the disabling of the watchdog.  But for most of my experiment, I did not stop there to make sure that I don't interfere with the startup timing within which we have to disable the watchdog.

So, how do I:
1. know that WDOG is already disabled?
In main, I could see watchdog registers as follows.  It seems like WDOG is already disabled in CTRLH.

0x1d2           CTRLH

0x1           CTRLL

0x4c           TOVALH

0x4b4c      TOVALL

0x0      WINH

0x10      WINL

0xb480      REFRESH

0xd928      UNLOCK

0x0      TMROUTH

0x0      TMROUTL

0x0      RSTCNT

0x400      PRESC

2. Is it possible that in this production board I don't get to SystemInit fast enough, ie failed to disable the watchdog after time has expired?
Is there a way to check how many bus cycles have passed before I reach it?
Or, this doesn't make sense? I didn't really change the code coming from Freescale.

Any help/insights in very appreciated.


Oh another thing is, I was going to check if EWM is enabled by accident.  But we're not interested in enabling any watchdog so I doubt there'd be any "accident" like that.  But when I try to read that register, guess what, watchdog kicks in.  Here was how I tried to read it.  But even in eval board this happens, so I guess I'm not supposed to touch it anyways.

        tmp[0]= EWM_CTRL;

        tmp[1]= EWM_SERV;

        tmp[2]= EWM_CMPL;

        tmp[3]= EWM_CMPH;

        tmp[4]= EWM_CLKPRESCALER;

Thanks,

Cecylia

0 Kudos
1 Solution
524 Views
cwati
Contributor III

Never minddd


Turns out the SPI changes, from SPI1 to SPI0.  And, we forgot to change the interrupts for the SPI from PTD to PTC oh well.
So it's more like unhandled interrupt, not sure why it popped out as watchdog interrupt in the first place =)

void PORTD_IRQHandler(void)

{

    GPIO_DRV_ClearPinIntFlag(mpu9250_int_pin.pinName);

    data_avail = true;

}

void SPI1_IRQHandler(void)    /* sensor module uses SPI1 for invensense */

{

    DSPI_DRV_IRQHandler(HW_SPI1);

}

View solution in original post

0 Kudos
1 Reply
525 Views
cwati
Contributor III

Never minddd


Turns out the SPI changes, from SPI1 to SPI0.  And, we forgot to change the interrupts for the SPI from PTD to PTC oh well.
So it's more like unhandled interrupt, not sure why it popped out as watchdog interrupt in the first place =)

void PORTD_IRQHandler(void)

{

    GPIO_DRV_ClearPinIntFlag(mpu9250_int_pin.pinName);

    data_avail = true;

}

void SPI1_IRQHandler(void)    /* sensor module uses SPI1 for invensense */

{

    DSPI_DRV_IRQHandler(HW_SPI1);

}

0 Kudos