This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2422: DCO Factory or Software Trim & FRAM Write

Part Number: MSP430FR2422

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
}

  • FRAM is not flash and nothing special is required to write to it. There is no erase system. Various devices have varying types of memory protection that can write protect regions of FRAM so read the documentation to see what applies.

  • Thanks for responding David.  Yes, now I see FRAM is not flash and I had the wrong code example.  I have found 3 code examples for the 2422 device which are helpful.  I see there is an FRAM Utility Library that can be used.  I'm disappointed in the documentation in the Family User's Guide for these parts though.  The section FRAM Controller starting on page 301 doesn't really discuss at all using the FRAM as nonvolatile storage.  So, I found 3 things that are helpful but I would say if you're not going to use the FRAM Utility Library the documentation is sparse at best.  Am I missing some other documents?  Thanks, Brett

  • 1. factory calibration value in TLV is only for max frequency 16MHz. For software trim you can refer to it

    https://www.ti.com/lit/an/slaa992/slaa992.pdf

    2. FRAM write you could refer to the example code

    dev.ti.com/.../node

  • Thanks Allen, the application guide you suggest for the DCO trim is fantastic! I get it now.  That first paragraph in the User's Guide under factory trim is very awkward and confusing.  I did find the FRAM write code example as well as the 2 others in that folder.  I see SLAA628 explains things in more detail.  I wonder if #pragma PERSISTENT can be used for a structure?  I'll have to read more and give it a try.  Thanks again Allen!

**Attention** This is a public forum