IAP

I am writing to flash memory of LPC2136.

Do I need to erase the segment before writing

Because i wrote garbage when i write to Flash after doing segment preparation only.

every thing fine If i do in following way
1.)prepare the segments
2.)erase the segments
3.)prepare the segments
4.)write to segments

Is there any thing wrong or this the only method to write to flash.

my worries is whether each time do i need to erase 32kb segment to write. so i need a copy of this 32kb in the ram.

Regards
murale

Parents
  • "Do I need to erase the segment before writing"

    You need to refer to the Datasheet for the answer to that!

    At the physical hardware level within the chip, you cannot write a '1' to a flash memory bit: Erasing sets bits to '1'; you then program '0' into all the bits that need to be '0'.

    However, some chips have clever logic that automatically does an erase-before-write, giving the appearance that you can write '1's to the flash. Again, you need to refer to the Datasheet to find out if this is the case for your particular chip.

    "every thing fine If i do in following way
    1.)prepare the segments
    2.)erase the segments
    3.)prepare the segments
    4.)write to segments"


    This looks very much like you have just answered your own question!

    "this the only method to write to flash."

    Again: see the Datasheet.

    "my worries is whether each time do i need to erase 32kb segment to write. so i need a copy of this 32kb in the ram."

    Yes, that is the usual problem with trying to update data in Flash...!! ;-)

Reply
  • "Do I need to erase the segment before writing"

    You need to refer to the Datasheet for the answer to that!

    At the physical hardware level within the chip, you cannot write a '1' to a flash memory bit: Erasing sets bits to '1'; you then program '0' into all the bits that need to be '0'.

    However, some chips have clever logic that automatically does an erase-before-write, giving the appearance that you can write '1's to the flash. Again, you need to refer to the Datasheet to find out if this is the case for your particular chip.

    "every thing fine If i do in following way
    1.)prepare the segments
    2.)erase the segments
    3.)prepare the segments
    4.)write to segments"


    This looks very much like you have just answered your own question!

    "this the only method to write to flash."

    Again: see the Datasheet.

    "my worries is whether each time do i need to erase 32kb segment to write. so i need a copy of this 32kb in the ram."

    Yes, that is the usual problem with trying to update data in Flash...!! ;-)

Children
More questions in this forum