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.

MSP430F5510 flash write problem?

Other Parts Discussed in Thread: MSP430F5510

Hi All,

I have been working on MSP430F5510 to write data to FLash memory of MSP430F5510. The code is attachec below.

I am running the cpu @  25MHZ.

Flash write code section is below.

void write_Flash1()
   {
	P_int    = (int*)0xB500; 
        bGIE     = (__get_SR_register() & GIE);    //save interrupt status
        _disable_interrupts();	

 	LED_on(); 	_delay_cycles(10000); 	      LED_off();

       //Erase the segment befor write
	FCTL3    = FWKEY;                          //Clear the lock bit
	FCTL1    = FWKEY + ERASE;                  //Set the Erase bit
	*P_int   = 0;                              //Dummy write, to erase the segment

       //Write the data to the segment
        FCTL1    = FWKEY + WRT;                  //Set WRT bit for write operation
     	*P_int++ = 1234;                         //Write the block to flash

        FCTL1    =  FWKEY;                       //Clear WRT bit
        FCTL3    = FWKEY + LOCK;                 //Set LOCK bit

 	LED_on(); 	 	_delay_cycles(10000);	 	LED_off();
        __bis_SR_register(bGIE);                //restore interrupt status
	_enable_interrupts();
   }

1. I have scoped the time taken to write, and it is what troubling me. It took almost 25 milli seconds wite a byte. I might be reading the data sheet wrong, does that take only <100micro seconds to write?.


  2.If you look at the screenshot of scope, the first pulse  is before setting FCTL3 register. and the second spike is after writing and locking the flash, the pulse duration is different eventough I have the same delay cycles (_delay_cycles(10000);) Can some one point out the issue and help me please.

 

  • Hi sri-sri!

    What is the frequency of your flash controller?

    Dennis
  • sri-sri said:

    1. I have scoped the time taken to write, and it is what troubling me. It took almost 25 milli seconds wite a byte. I might be reading the data sheet wrong, does that take only <100micro seconds to write?.

    Writing is fast, especially smart block write (200 KByte/s). In your measurement is included erase (23 - 32 ms per datasheet).

    For period measurement change pin state from low to high at start, and from high to low at end, without delay cycles.

    Also, for logic analyzer can be used MSP430F5510 http://forum.43oh.com/topic/3909-msp430f550x-based-logic-analyzer/

  • Hi Dennis,

    Thank you for throwing some light over the problem. I have checked the family user guide, but there is no way to configure Flash timing generator. FCTL2 is not implemented in this family of devices. I am supposing that Flash timing generator is over MCLK.

    My biggest bother that. In the screenshot, the duration of delay cycles is different.I am afraid that clock setting is reverting back back after flash operation. Can you please guide me more.

    Thank you.

  • sri-sri said:
    I have checked the family user guide, but there is no way to configure Flash timing generator.

    You're right. The flash controller seems to be independent and the timings are hardwired into the device. No dependency on tFTG (flash timing generator frequency) like in other devices.

  • sri-sri said:

    Thank you for throwing some light over the problem. I have checked the family user guide, but there is no way to configure Flash timing generator. FCTL2 is not implemented in this family of devices. I am supposing that Flash timing generator is over MCLK.

    Flash clock in 5xx/6xx family is generated by internal MODOSC (MODCLK) and flashing in your example is not related to MCLK on any way.

    I already gave you correct answer to your question (erase take 25 ms).

  • Hi Zrono Soli,

    Yes you were right. I have scoped the erase and write operation separately and got the figures rightly. BUt I still cant able to figureout why the delay cycles function is behaving odly here??
    Thank you so much for your help.

    Cheers

**Attention** This is a public forum