Hi,
I am trying to run a simple demo app writing to the FRAM on a MSP430FR5969. I'm using Code Composer Studio 5.5.0.00077 (freshly downloaded this morning) and an MSP-FET430UIF (received from Digikey last Friday). The target board is a MSP-TS430RGZ48C "rev 1.2", with date code "39/2012" marked on the packaging it came in. I am debugging using Spy-Bi-Wire mode and power is supplied by the FET. The power rails are clean and show no obvious problems on a scope.
The first thing I did was run the msp430fr59xx_1 ("Blink LED") example. The very first debug session, CCS uploaded a new firmware to the FET, and after a subsequent plugcycling, reliably connects to the debugger, uploads the binary and suspends at main(). When run, the LED on the target board blinks as expected. So far so good.
However, when I run the msp430fr59xx_framwrite ("Long word writes to FRAM") example, the code gets uploaded, but the debugger does not halt at main(), at least according to the text on the screen (which reports "Running"). However, nothing appears to happen at the target board (it should blink the same LED while writing dummy data to FRAM). Attempting to pause or stop the "running" program results in the following error message:
MSP430: Trouble Halting Target CPU: Internal error
This behavior is repeatable. The blink example runs, halts and does everything it should; the FRAM demo doesn't seem to do anything at all (but the GUI reports "running").
Now, here's where it gets weird. If I copy-paste the FRAM-specific code from the FRAM demo into the blink demo, it starts to exhibit the same failure. So far, I've narrowed the behavior to the 2 lines commented out below. If I uncomment either of these lines, debugging fails (compilation proceeds OK and generates no errors/warnings in both cases).
The code size reported by CCS is as follows, respectively:
MSP430: Loading complete. Code Size - Text: 190 bytes Data: 52 bytes.
MSP430: Loading complete. Code Size - Text: 258 bytes Data: 70 bytes.
So I don't believe it is getting anywhere near the (16K?) code size restriction of the free CCS license.
Any ideas what is going on?
#include <msp430.h>
unsigned long *FRAM_write_ptr;
unsigned long data = 0;
#define FRAM_TEST_START 0xD000
void FRAMWrite(unsigned long data)
{
*FRAM_write_ptr = data;
}
unsigned long FRAMRead(void)
{
data = *FRAM_write_ptr;
return data;
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
// Configure GPIO
P1OUT &= ~0x01; // Clear P1.0 output latch for a defined power-on state
P1DIR |= 0x01; // Set P1.0 to output direction
PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
//FRAM_write_ptr = (unsigned long *)FRAM_TEST_START;
//FRAMWrite(data); // write 1 long
while(1)
{
P1OUT ^= BIT0; // Toggle LED
__delay_cycles(100000);
}
}