Other Parts Discussed in Thread: C2000WARE
Hi All,
Current project needs sw reset feature. Previous iteration (microchip MCU) used a GPIO pin to pull its own reset pin low. This approach hasn't worked with the 28020. First off the GPIO pin is low at startup, so the MCU never comes out of reset. Placing an inverter in series allows boot, but when trying to assert the pin high, it starts to rise then hangs at milliVolts.
Now I'd like to use the WDT feature to cause a reset. I've read a couple of threads that refer to setting the WDCR to an illegal state. Adding a line that does just that results in code going off into the weeds. Stepping through the code, I see in the disassembly window that the program has halted on an estop, but I'm not sure how it gets there.
Here's the snippet of code that causes the error:
if(val1 == 9) { if(resetFlag_CPU) { resetFlag_CPU = 0; EALLOW; DINT; myWDog->WDCR = 0x17; // 0X17 Keeps div by in lower 3 bits and adds faulty check bit EINT; EDIS; } }
With line 10 (above) commented out, code works fine. When it's not commented out, the code executes seemingly as expected, the function it's running in completes and returns, but that's when it runs to estop.
It's my intent to reset the processor and restart code at the top of main().
Can anyone give me some direction?
Thanks,
robin