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.

timing frequency for writing to information flash msp430f4783

Other Parts Discussed in Thread: MSP430F4783

Hi,

 

I am working on a design in which I would like to store a few variables in to

information flash, for now I am trying to get it working with segment c.

The microcontroller used is a msp430f4783 with a 32kHz and a 4MHz crystal

connected. The frequencies of the crystals are good, checked both with scope

and by using a logic analyzer connected to LEDs controlled by the basic timer

and timer A. The FLL is set to give 32768Hz on ACLK, 8.388MHz on MCLK

and 4MHz on SMCLK.

The problem is that I can not write to flash with Fftg derived from SMCLK set in

my own setup for the FLL. Fftg must be between 257 and 476 kHz.

I have set the flash timing generator to use SMCLK and divide by 12 :

FCTL2 = FWKEY + FSSEL_3 + FN3 + FN1 + FN0;

(Fftg = 4 MHz / 12 = 333333 Hz)

It works strangely enough if I select ACLK as input clock :

FCTL2 = FWKEY + FSSEL_0 + 0;

(Fftg = 32768 Hz  / 1 = 32768 Hz)

The setup from msp430x47xx_flashwrite_01.c works at a calculated 349.5 kHz

with MCLK as input :

FCTL2 = FWKEY + FSSEL_1 + 2;

(Fftg = 32768 Hz * 32 / 3 = 349525 Hz)

 

The subroutine for setting up the FLL :

void oscillatoren_init(void)
{
    unsigned integer i;
 
    // maak de oscillator fout bitjes laag
//    FLL_CTL0 &= ~(LFOF | DCOF);
    // initialiseer de 32kHz oscillator lfxt1 in laag frequentie mode
    FLL_CTL0 &= ~XTS_FLL;
    // met 5pF condensatoren
    FLL_CTL0 |= XCAP5_5F;
    // wacht tot oscillator lfxt1 gestabiliseerd is
    do
    {
        IFG1 &= ~OFIFG;
        for(i = 10000; i > 0; i--)
        {
        }
    }
    while(IFG1 & OFIFG);
    // initialiseer de DCO oscillator
    // de eerste 8 maal vermenigvuldiging van lfxt1
    FLL_CTL0 |= DCOPLUS;
    // fdco = lfxt1 * FLLD_8 * SCFQ_1M = 8.388MHz
    // fdco = 32768 * 8 * 32 = 8.388MHz

    SCFI0 |= FLLD_8 | FN_2;

    SCFQCTL = SCFQ_1M;
    // selecteer dco als mclk
    FLL_CTL1 |= SELM0;
 
    // initialiseer de 4MHz oscillator xt2 in hoge frequentie mode
    FLL_CTL2 = XT2S1;
    // zet oscillator xt2 aan
    FLL_CTL1 &= ~XT2OFF;
    // selecteer xt2 smclk
    FLL_CTL1 |= SELS; 
}

 

I can not figure out what I am doing wrong here. Is there some one who

has this timing thing working at another frequency then 32 kHz or 1 MHz ?

I have selected several input and divider combinations for the flash timing

generator but none work except for the frequencies as mentioned above.

There is an errata FLL7 which as far as I can tell does not apply to my problem.

 

roelof


  • roelof't Hooft said:
    It works strangely enough if I select ACLK as input clock :
    FCTL2 = FWKEY + FSSEL_0 + 0;
    (Fftg = 32768 Hz  / 1 = 32768 Hz)

    This exceeds the maximum write time for the flash cell. When erasing, this works fine, but 'overerases' the flash. IMHO it is like erasing it several times in a row, reducing lifetime by a factor of, say, 8-10.
    When writing flash with this low clock, you may not write a full 64 byte block as the allowed maximum write time is exceeded after a few words. If you proceed, it may happen that unwritten bits become '0' too. Either immediately or after some time.
    But at first, it works...

    About the SMCLK setup, you wait until the LFXT1 has stabilized, yet you do not wait or check whether the XT2 with your 4MHz SMCLK have stabilized. Unless this is done, SMCLK may fallback to DCO which is 8MHz in your case and therefore the flash clock is far above what's allowed (and therefore likely without effect).

    I had no problems writing to flash with 4 and 8MHz system clock on teh 1611 (which has more or less the same flash controller)

     

  • Hi Jens-Michael,

     

    It does not matter for the program if it does not wait for either crystal oscillator

    to stabilize. The writing routine is only 10 seconds or more after the program

    comes out of standby mode (lpm3 + gie). I had been using the program without

    the checking for lfxt1 to stabilize till moments before I posted to this forum.

    I now have added checking for a stable xt2.

    The three 16 bit values written to information flash do not change on a regular basis,

    only if the user selects the calibration mode of the program.

    I'll try again tomorrow evening.

     

    roelof