Hi All,
Not exactly a mspgcc question, but hoping someone on the list can help.
I am trying to write some functions to store away data in Flash using the
msp430 ISP sequence.
Following the datasheet, I have come up with the following:
void FlashErase_SegmentD(void) {
FCTL2 |= FWKEY + FSSEL1 + FN5; // ensure 257khz < SMCLK/32 < 476khz TODO
check this!
FCTL3 |= FWKEY; // Clear lock
FCTL1 |= FWKEY + ERASE; // Enable segment erase
*((uint16_t*)0x1002) = 0; // Dummy write to a word in flash segment D
FCTL3 |= FWKEY + LOCK; // Done, set lock
}
void FlashWrite_SegmentD(uint16_t* address, uint16_t data ) {
FCTL2 |= FWKEY + FSSEL1 + FN5; // ensure 257khz < SMCLK/32 < 476khz TODO
check this!
FCTL3 |= FWKEY; // Clear lock
FCTL1 |= FWKEY + WRT; // Enable write
*address = data; // Write word.
FCTL3 |= FWKEY + LOCK; // Done, set lock
}
What I am seeing is the MSP430 hang on either function ..
I am using the internal DCO at a calibrated 16Mhz. I know I am slightly out
of spec using a 32 divider (500Khz), but it should still work.
I am using mspgcc-gdb from within eclipse while testing this .. maybe the
stopping of the CPU during flash programming is upsetting the debugger?
I will try running without the debugger, but in the meantime would like some
feedback ..
Many Thanks,
Bernie