I an integer that I want to be located in flash memory on the MSP430F1121 chip. But I have a problem making this work: #define ONBOARD_FLASH_ADDRESS 0x1080 ... uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS; *ptrToCounter FCTL2 = FWKEY + FSSEL0 + FN0; while ( FCTL3 & BUSY); FCTL3 = FWKEY; FCTL1 = FWKEY + WRT; *ptrToCounter = absoluteFlashPointer; FCTL1 = FWKEY; FCTL3 = FWKEY + LOCK; while ( ! (FCTL3 & WAIT) ); absoluteFlashPointer = *ptrToCounter; When I read back the pointers are not the same. Jardar
Writing to flash
Started by ●March 5, 2003
Reply by ●March 5, 20032003-03-05
Have a look at SLAA103, it includes C code to program flash.
Al
Jardar Johannes Maatje wrote:
>
> I an integer that I want to be located in flash memory on the
> MSP430F1121
> chip. But I have a problem making this work:
>
> #define ONBOARD_FLASH_ADDRESS 0x1080
> ...
> uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS;
> *ptrToCounter >
> FCTL2 = FWKEY + FSSEL0 + FN0;
> while ( FCTL3 & BUSY);
> FCTL3 = FWKEY;
> FCTL1 = FWKEY + WRT;
> *ptrToCounter = absoluteFlashPointer;
> FCTL1 = FWKEY;
> FCTL3 = FWKEY + LOCK;
> while ( ! (FCTL3 & WAIT) );
> absoluteFlashPointer = *ptrToCounter;
>
> When I read back the pointers are not the same.
>
> Jardar
>
>
>
>
>
> .
>
>
Reply by ●March 5, 20032003-03-05
Jardar -
An important thing to remember: you can change flash bits in only one
direction. I believe that you can only change a 1 to a 0. If you need
to go the other way, your ONLY option is to clear the whole segment!
Jim Wagner
--- Jardar Johannes Maatje <maatje@maat...> wrote:
> I an integer that I want to be located in flash
memory on the
> MSP430F1121
> chip. But I have a problem making this work:
>
>
> #define ONBOARD_FLASH_ADDRESS 0x1080
> ...
> uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS;
> *ptrToCounter >
> FCTL2 = FWKEY + FSSEL0 + FN0;
> while ( FCTL3 & BUSY);
> FCTL3 = FWKEY;
> FCTL1 = FWKEY + WRT;
> *ptrToCounter = absoluteFlashPointer;
> FCTL1 = FWKEY;
> FCTL3 = FWKEY + LOCK;
> while ( ! (FCTL3 & WAIT) );
> absoluteFlashPointer = *ptrToCounter;
>
> When I read back the pointers are not the same.
>
> Jardar
>
>
__________________________________________________
Reply by ●March 5, 20032003-03-05
Not according to SLAA130. This states that FLASH reprogramming is
possible at a byte level. ie erase/program as a cycle.
Al
James Wagner wrote:
>
> Jardar -
>
> An important thing to remember: you can change flash bits in only one
> direction. I believe that you can only change a 1 to a 0. If you need
> to go the other way, your ONLY option is to clear the whole segment!
>
> Jim Wagner
>
> --- Jardar Johannes Maatje <maatje@maat...> wrote:
> > I an integer that I want to be located in flash memory on the
> > MSP430F1121
> > chip. But I have a problem making this work:
> >
> >
> > #define ONBOARD_FLASH_ADDRESS 0x1080
> > ...
> > uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS;
> > *ptrToCounter > >
> > FCTL2 = FWKEY + FSSEL0 + FN0;
> > while ( FCTL3 & BUSY);
> > FCTL3 = FWKEY;
> > FCTL1 = FWKEY + WRT;
> > *ptrToCounter = absoluteFlashPointer;
> > FCTL1 = FWKEY;
> > FCTL3 = FWKEY + LOCK;
> > while ( ! (FCTL3 & WAIT) );
> > absoluteFlashPointer = *ptrToCounter;
> >
> > When I read back the pointers are not the same.
> >
> > Jardar
> >
> >
>
> __________________________________________________
>
>
>
>
>
>
> .
>
>
Reply by ●March 6, 20032003-03-06
No, I think you'll find that this is not a correct interpretation.
Yes,
you can write at the bye or word level, but you can only overprogram a
byte a fixed number of times before you need to erase it, *and* you can
only change bits from 1 to 0 as James wrote.
-- Paul.
> -----Original Message-----
> From: onestone [mailto:onestone@ones...]
> Sent: 06 March 2003 01:04
> To: msp430@msp4...
> Subject: Re: [msp430] Writing to flash
>
>
> Not according to SLAA130. This states that FLASH
> reprogramming is possible at a byte level. ie erase/program
> as a cycle.
>
> Al
>
> James Wagner wrote:
> >
> > Jardar -
> >
> > An important thing to remember: you can change flash bits
> in only one
> > direction. I believe that you can only change a 1 to a 0.
> If you need
> > to go the other way, your ONLY option is to clear the whole segment!
> >
> > Jim Wagner
> >
> > --- Jardar Johannes Maatje <maatje@maat...> wrote:
> > > I an integer that I want to be located in flash memory on the
> > > MSP430F1121 chip. But I have a problem making this work:
> > >
> > >
> > > #define ONBOARD_FLASH_ADDRESS 0x1080
> > > ...
> > > uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS;
> > > *ptrToCounter > > >
> > > FCTL2 = FWKEY + FSSEL0 + FN0;
> > > while ( FCTL3 & BUSY);
> > > FCTL3 = FWKEY;
> > > FCTL1 = FWKEY + WRT;
> > > *ptrToCounter = absoluteFlashPointer;
> > > FCTL1 = FWKEY;
> > > FCTL3 = FWKEY + LOCK;
> > > while ( ! (FCTL3 & WAIT) );
> > > absoluteFlashPointer = *ptrToCounter;
> > >
> > > When I read back the pointers are not the same.
> > >
> > > Jardar
> > >
> > >
> >
> > __________________________________________________
> >
> >
> >
> >
> >
> >
> > .
> >
> > ">http://docs.yahoo.com/info/terms/
>
>
>
Reply by ●March 6, 20032003-03-06
Thanks all of you, everything si fine now. Did not know that it was only
possible to set it from 1 to 0.
Jardar
> No, I think you'll find that this is not a
correct interpretation. Yes,
> you can write at the bye or word level, but you can only overprogram a
> byte a fixed number of times before you need to erase it, *and* you can
> only change bits from 1 to 0 as James wrote.
>
> -- Paul.
>
> > -----Original Message-----
> > From: onestone [mailto:onestone@ones...]
> > Sent: 06 March 2003 01:04
> > To: msp430@msp4...
> > Subject: Re: [msp430] Writing to flash
> >
> >
> > Not according to SLAA130. This states that FLASH
> > reprogramming is possible at a byte level. ie erase/program
> > as a cycle.
> >
> > Al
> >
> > James Wagner wrote:
> > >
> > > Jardar -
> > >
> > > An important thing to remember: you can change flash bits
> > in only one
> > > direction. I believe that you can only change a 1 to a 0.
> > If you need
> > > to go the other way, your ONLY option is to clear the whole
segment!
> > >
> > > Jim Wagner
> > >
> > > --- Jardar Johannes Maatje <maatje@maat...> wrote:
> > > > I an integer that I want to be located in flash memory on
the
> > > > MSP430F1121 chip. But I have a problem making this work:
> > > >
> > > >
> > > > #define ONBOARD_FLASH_ADDRESS 0x1080
> > > > ...
> > > > uint *ptrToCounter = (uint *) ONBOARD_FLASH_ADDRESS;
> > > > *ptrToCounter > > > >
> > > > FCTL2 = FWKEY + FSSEL0 + FN0;
> > > > while ( FCTL3 & BUSY);
> > > > FCTL3 = FWKEY;
> > > > FCTL1 = FWKEY + WRT;
> > > > *ptrToCounter = absoluteFlashPointer;
> > > > FCTL1 = FWKEY;
> > > > FCTL3 = FWKEY + LOCK;
> > > > while ( ! (FCTL3 & WAIT) );
> > > > absoluteFlashPointer = *ptrToCounter;
> > > >
> > > > When I read back the pointers are not the same.
> > > >
> > > > Jardar
> > > >
> > > >
> > >
> > > __________________________________________________
> > >
> > >
> > >
> > >
> > >
> > >
> > > .
> > >
> > > ">http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> .
>
>
>
> ">http://docs.yahoo.com/info/terms/
>
>