I'm using an MSP430 chip with 10K of RAM. If I go above 5k of RAM usage, it's never capable of making it to main(). The init code calls __data20_memzero
to clear out the used RAM space.
It look like it increments through memory and clears bytes till R14=R12. R14 is 0x34B4. But the max value of R12 is 0x2c86 before it reboots and starts over again. I manually turned off the watchdog through the debugger, and it started running just fine. I can't see this as being normal. Any idea how to get around this problem?
Just after posting this, I found this application note
http://supp.iar.com/Support/?note=37778&from=search+result
If the application has much (over 4k) of global initialized data, then the initialization within cstartup will not be finished before the watchdog times out (and the device is reset).
and
The solution
The Watchdog timer must be turned off before the initialization phase. This should preferably be done in __low_level_init.
The steps (for F1610, F1611 or F1612)
Copy of the file "low_level_init.c" (from ...\430\src\lib\) to your project directory.
Add the copied "low_level_init.c" file to your project.
Edit your copy of the "low_level_init.c" file
In the file you need to add, either...
#include <msp430x16x.h>
...or add...
#include <io430x16x.h>
You should add, in the __low_level_init() function.
WDTCTL = WDTPW + WDTHOLD;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With