EmbeddedRelated.com
Forums

Writing to FLASH

Started by Maris Kalbergs September 28, 2006
Hello!

I am newbie in your group and i have one question.
I need to write some registers into flash memory when power supply is
half of max. At the moment i am using MSP430F123.

Do you have some idea how to write for example R10 register content into
Flash momery?

Thanks a lot.

Maris.

Beginning Microcontrollers with the MSP430

I. configure flash clock according to IC spec and freq
II. save into flash procedure:
1. copy block of flash into ram
2. erase block of flash
3. update variables
4. save to flash
III. drink some beer:)

all algorithms and examples are in manuals from TI!
first of all read the manual!
Warning, to the FLASH you can write only if voltage is between 2.7 -
3.6V in MSP430F1...
or 2.2 - 3.6 V in MSP430F2...

J.

--- In m..., Maris Kalbergs wrote:
>
> Hello!
>
> I am newbie in your group and i have one question.
> I need to write some registers into flash memory when power supply is
> half of max. At the moment i am using MSP430F123.
>
> Do you have some idea how to write for example R10 register content into
> Flash momery?
>
> Thanks a lot.
>
> Maris.
>
May be some of you have code examples how to write into Flash?

Thanks a lot.

Maris

On Fri, 2006-09-29 at 04:56 +0000, janko20022001 wrote:
> Warning, to the FLASH you can write only if voltage is between 2.7 -
> 3.6V in MSP430F1...
> or 2.2 - 3.6 V in MSP430F2...
>
> J.
>
> --- In m..., Maris Kalbergs
> wrote:
> >
> > Hello!
> >
> > I am newbie in your group and i have one question.
> > I need to write some registers into flash memory when power supply
> is
> > half of max. At the moment i am using MSP430F123.
> >
> > Do you have some idea how to write for example R10 register content
> into
> > Flash momery?
> >
> > Thanks a lot.
> >
> > Maris.
> >
>
--- In m..., Maris Kalbergs
wrote:
>
> May be some of you have code examples how to write into Flash?
>
> Thanks a lot.
>
> Maris

in manual there is very comprehensive example! just read it!
i don't want to rewrite manual or copy my code :)
do it yourself, it's very didactic :)
Do you mean slau049 manual?

Maris

On Fri, 2006-09-29 at 11:24 +0000, Kamil wrote:
> --- In m..., Maris Kalbergs
> wrote:
> >
> > May be some of you have code examples how to write into Flash?
> >
> > Thanks a lot.
> >
> > Maris
>
> in manual there is very comprehensive example! just read it!
> i don't want to rewrite manual or copy my code :)
> do it yourself, it's very didactic :)
>
--- In m..., Maris Kalbergs
wrote:
>
> Do you mean slau049 manual?
>
> Maris
yeah, see page 5-3, 5-6 and 5-9 and read top of 5.3.2 to see why you
must copy flash into ram and erase block before write.
p.s. i've got SLAU049F 2006y
Ok i read it all but still i have problem. In examples they are storing
into flash only constants, but how to make to store content of some
register?

Maris

On Fri, 2006-09-29 at 12:34 +0000, Kamil wrote:
> p.s. i've got SLAU049F 2006y
>
(1) If your code is in assembly, accessing registers
is just as easy as, actually easier then, accessing
SRAM. If your code is C, why do you care what are in
registers? The C-compiler decides what the registers
are used for at any given moment. If you do not know
know what C-compiler is doing, and do not know how
to access registers, writing them in Flash will not
help you.

(2) You said you want to do this when the power is
going down. I think that is the worst time to start
altering Flash. You need higher then normal voltage
to erase/write Flash. And it takes a lot of current
and time to do so. If the power is already marginal,
start altering Flash will most likely not
succeed.

How about use "printf" to write everything on paper,
use a scanner to capture the image, use OCR to
convert them back to ASCII, and use "scanf" to restore
everything ;-)

--- In m..., Maris Kalbergs
wrote:
>
> Ok i read it all but still i have problem. In examples they are
storing
> into flash only constants, but how to make to store content of some
> register?
>
> Maris
>
> On Fri, 2006-09-29 at 12:34 +0000, Kamil wrote:
> > p.s. i've got SLAU049F 2006y
> >