Dear TI,
I have 2 higher level questions for general understanding.
1. After reading the User's Guide about trimming the DCO I don't quite get why I would use the Software Trim over the Factory Trim? I would prefer to use the factory method, but does it not give you precise values? The code I'm running in the launchpad uses the Software Trim to 8 Mhz. Can I not get the same 8 Mhz using the Factory Trim? In the documentation the phrase, " when the DCO range is selected on maximum valid values", is confusing to me.
2. My second question is related to saving data to nonvolatile memory, which I assume on this part, is the FRAM memory. The User's Guide and device specific data sheets don't have much to offer in this regard. I found example code that is very illustrative but was hoping to find some documentation also. So, it looks like you have to erase a 64 byte sector first before you can write to that sector? If I want to change a previously written value, do I need to erase that whole sector again? I realize your Driver Library has routines for this but I'm not sure I want to link the whole library for those routines if I just want to save a few bytes. I copied some of the example code I was looking at below.
Anyway, thank you for answering my questions.
Brett
void write_SegC(char value)
{
char *Flash_ptr; // Flash pointer
unsigned int i;
Flash_ptr = (char *)0x1040; // Initialize Flash pointer
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE; // Set Erase bit
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i = 0; i < 64; i++)
{
*Flash_ptr++ = value; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}