EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

flash write

Started by "paddu.koti" September 29, 2008
Hi,

I need to write some data into the MSP430 flash using In System
Programming(ISP) but,when writing to the flash is it necessary to erase
entire memory segment before writing,I dont want to use a entire memory
segment,I just want to write/rewrite data into the free memory and also
access it frequently.

Does anybody has sample code for ISP,in all the sample codes provided
by TI ,the memory segment is erased before writing.

Thankyou....

Beginning Microcontrollers with the MSP430

Sorry. You have to erase the whole segment. That's how flash works.

Ian

2008/9/29 paddu.koti

> Hi,
>
> I need to write some data into the MSP430 flash using In System
> Programming(ISP) but,when writing to the flash is it necessary to erase
> entire memory segment before writing,I dont want to use a entire memory
> segment,I just want to write/rewrite data into the free memory and also
> access it frequently.
>
> Does anybody has sample code for ISP,in all the sample codes provided
> by TI ,the memory segment is erased before writing.
>
> Thankyou....
>
Thankyou Ian,

Does it mean I have to erase complete segment just to write few data into the flash,
isn't it possible to store a data at a particular location without erasing the memory?

Thankyou....

----- Original Message ----
From: Ian Okey
To: m...
Sent: Monday, September 29, 2008 9:59:03 PM
Subject: Re: [msp430] flash write
Sorry. You have to erase the whole segment. That's how flash works.

Ian

2008/9/29 paddu.koti

> Hi,
>
> I need to write some data into the MSP430 flash using In System
> Programming( ISP) but,when writing to the flash is it necessary to erase
> entire memory segment before writing,I dont want to use a entire memory
> segment,I just want to write/rewrite data into the free memory and also
> access it frequently.
>
> Does anybody has sample code for ISP,in all the sample codes provided
> by TI ,the memory segment is erased before writing.
>
> Thankyou....
> ------------ --------- --------- ------
No. In simple terms, if you want to keep any of the data in the sector you
have to read the sector out into RAM, change the elements that you want to
update and then write the whole lot back. Remember that the flash sector
has an erase/rewrite life of typically 10000 operations (read the data sheet
for the device that you are using).

Ian

2008/9/29 Paddu Koti

> Thankyou Ian,
>
> Does it mean I have to erase complete segment just to write few data into
> the flash,
> isn't it possible to store a data at a particular location without erasing
> the memory?
>
> Thankyou....
>
> ----- Original Message ----
> From: Ian Okey
> To: m...
> Sent: Monday, September 29, 2008 9:59:03 PM
> Subject: Re: [msp430] flash write
> Sorry. You have to erase the whole segment. That's how flash works.
>
> Ian
>
> 2008/9/29 paddu.koti > Hi,
> >
> > I need to write some data into the MSP430 flash using In System
> > Programming( ISP) but,when writing to the flash is it necessary to erase
> > entire memory segment before writing,I dont want to use a entire memory
> > segment,I just want to write/rewrite data into the free memory and also
> > access it frequently.
> >
> > Does anybody has sample code for ISP,in all the sample codes provided
> > by TI ,the memory segment is erased before writing.
> >
> > Thankyou....
> >
> >
> > ------------ --------- --------- ------
> >
> >
> >
> >
I uploaded some flash write routines to the files section a month or two
ago. You might want to have a look.
You can write to a section of flash successfully IF that section has
been previously erased and not written since. To store configuration
data, I typically divide a segment of info memory into 16-byte blocks
then write each one sequentially with new data. One of the entries in
the block is a status byte (FF=unused, 01=in use, 00=old data). When
the segment is full, I FIRST write the new data to the first block in
the next segment, THEN after confirming it wrote OK, erase the 1st
segment. When the second segment is full, I switch back to the first.
Hope this helps.

Regards
-Bill Knight
R O SoftWare
paddu.koti wrote:
> Hi,
>
> I need to write some data into the MSP430 flash using In System
> Programming(ISP) but,when writing to the flash is it necessary to erase
> entire memory segment before writing,I dont want to use a entire memory
> segment,I just want to write/rewrite data into the free memory and also
> access it frequently.
>
> Does anybody has sample code for ISP,in all the sample codes provided
> by TI ,the memory segment is erased before writing.
>
> Thankyou....

Hi Bill Knight ,

Thankyou for the information.
----- Original Message ----
From: Bill Knight
To: m...
Sent: Tuesday, September 30, 2008 10:00:02 AM
Subject: Re: [msp430] flash write
I uploaded some flash write routines to the files section a month or two
ago. You might want to have a look.
You can write to a section of flash successfully IF that section has
been previously erased and not written since. To store configuration
data, I typically divide a segment of info memory into 16-byte blocks
then write each one sequentially with new data. One of the entries in
the block is a status byte (FF=unused, 01=in use, 00=old data). When
the segment is full, I FIRST write the new data to the first block in
the next segment, THEN after confirming it wrote OK, erase the 1st
segment. When the second segment is full, I switch back to the first.
Hope this helps.

Regards
-Bill Knight
R O SoftWare

paddu.koti wrote:
> Hi,
>
> I need to write some data into the MSP430 flash using In System
> Programming( ISP) but,when writing to the flash is it necessary to erase
> entire memory segment before writing,I dont want to use a entire memory
> segment,I just want to write/rewrite data into the free memory and also
> access it frequently.
>
> Does anybody has sample code for ISP,in all the sample codes provided
> by TI ,the memory segment is erased before writing..
>
> Thankyou....



The 2024 Embedded Online Conference