EmbeddedRelated.com
Forums
Memfault Beyond the Launch

write data to flash lpc2148

Started by stijn_de_beugher May 6, 2009
Hi,

I'm working on a project with a lpc 2148. I've written a program which reads from the serial port a text file. I save the characters of this file in an array: buff[2000].

Now I'd like to write this array to the flash of the lpc2148. But I've a few questions about this operation.
- Is it possible to overwrite the bootloader of the lpc2148? When I write accidently to the wrong sector, I hope the bootloader is protected so I don't overwrite it.
- Is it possible to overwrite the .hex file of my program?
- does anyone has experience with this, or does anyone has an example of this?

Thank you very much.

An Engineer's Guide to the LPC2100 Series

You can find examples of using IAP in the LPC2148 demo code at
http://jcwren.com/arm
I would advise against what you're attempting if you plan on doing many
writes. The on-chip flash is not intended to be used the way you'd use a
compact flash or MMC/SD card.

The boot loader is in ROM, so you can't overwrite it. Somehow I think it
would be next to impossible to overwrite the .hex file of your program,
since that's on your PC. If, however, you meant the program that you loaded
onto the LPC2148, yes, that's possible.

--jc

On Wed, May 6, 2009 at 2:39 AM, stijn_de_beugher > wrote:

> Hi,
>
> I'm working on a project with a lpc 2148. I've written a program which
> reads from the serial port a text file. I save the characters of this file
> in an array: buff[2000].
>
> Now I'd like to write this array to the flash of the lpc2148. But I've a
> few questions about this operation.
> - Is it possible to overwrite the bootloader of the lpc2148? When I write
> accidently to the wrong sector, I hope the bootloader is protected so I
> don't overwrite it.
> - Is it possible to overwrite the .hex file of my program?
> - does anyone has experience with this, or does anyone has an example of
> this?
>
> Thank you very much.
>
>
>


--- In l..., "J.C. Wren" wrote:
>
> You can find examples of using IAP in the LPC2148 demo code at
> http://jcwren.com/arm
> I would advise against what you're attempting if you plan on doing many
> writes. The on-chip flash is not intended to be used the way you'd use a
> compact flash or MMC/SD card.
>
> The boot loader is in ROM, so you can't overwrite it. Somehow I think it
> would be next to impossible to overwrite the .hex file of your program,
> since that's on your PC. If, however, you meant the program that you loaded
> onto the LPC2148, yes, that's possible.
>
> --jc
>
Hi,

Thank you very much for your answer.

I meant indeed the program that I loaded onto the LPC2148. Is there a possibility to protect this from overwriting?

Writing to the flash will happen once or twice a month I think, I don't think this is to much...

Thank you for the example from http://jcwren.com/arm, it's very useful.

Stijn

I'm not near a datasheet, and I can't remember if you can protect various
flash regions or not. The datasheet will tell you this, however.

If you're writing very infrequently, you should be OK. You may want to
consider a strategy of maintaining how often you write blocks, and rotating
them periodically. Also consider doing a read after write verify, and some
sort of checksumming/CRC and bad block management.

--jc

On Wed, May 6, 2009 at 8:12 AM, stijn_de_beugher > wrote:

> --- In l... , "J.C. Wren"
> wrote:
> >
> > You can find examples of using IAP in the LPC2148 demo code at
> > http://jcwren.com/arm
> > I would advise against what you're attempting if you plan on doing many
> > writes. The on-chip flash is not intended to be used the way you'd use a
> > compact flash or MMC/SD card.
> >
> > The boot loader is in ROM, so you can't overwrite it. Somehow I think it
> > would be next to impossible to overwrite the .hex file of your program,
> > since that's on your PC. If, however, you meant the program that you
> loaded
> > onto the LPC2148, yes, that's possible.
> >
> > --jc
> >
> Hi,
>
> Thank you very much for your answer.
>
> I meant indeed the program that I loaded onto the LPC2148. Is there a
> possibility to protect this from overwriting?
>
> Writing to the flash will happen once or twice a month I think, I don't
> think this is to much...
>
> Thank you for the example from http://jcwren.com/arm, it's very useful.
>
> Stijn
>
>
>



Memfault Beyond the Launch