This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flash memory clarifications

Hi ,

I have some data recived in .hex format file from serial port and i need to store this data in flash permenantly and i will access this data when ever required.

Please guide me
How can i find out where the sectors are free to write permenantly?
How to write data permenantly to flash ?
How can i access it?

My LPC utility is 2138 with 512kb memory.

regards
reddy

  • try sending your data in binary format - you can generate the right file based on your .axf file using the fromelf.exe application (see bin folder).
    you may need to employ some kind of IAP (in application programming) to get the job done - refer to your data sheet!

  • if you send the data in binary format - there is no need to parse it in the controller (something you must do if you send a .hex file)

  • "there is no need to parse it in the controller "

    True. But you do then have to be careful that everything in your serial link is fully capable of sending arbitrary binary data - so, no software flow control, no line-end translations, etc, etc.

    The Intel Hex (and Motorola S-Record) formats were specifically designed to avoid this restriction.

    Also, if you send pure binary data you should still probably add some sort of error detection - which will require some sort of "parsing"...

    And binary data transmissions are harder to debug.

  • With a pure binary transfer, there is no magic "break" character to inform the receiver or transmitter that a transfer has failed in the middle and should be aborted.

    The transmitter has to send a byte count before the data, and the receiver will just have to count bytes. Since binary data does not have a magic character, you must either invent one by byte-stuffing the data. For example saying that 0xb0 may never mean 0xb0 on its own, but must be sent as 0xb0 0xb0. That means that if 0xb0 followed by a value not 0xb0, the second byte can be a command to control the transfer.

    The other alternative with a binary transfer is to define pauses - more than x ms without receiving a byte means a block end.

    As you can see, it will nut automagically become easier to run with a binary transfer. All it will do is reduce the transfer size (unless all the bnary data happens to match that break character, in which case the binary transfer will get close to the hex transfer in number of bytes).

    The Intel or Motorola hex formats are easy to parse, and contains information to make it easy to verify that you don't drop a byte or get a garbled byte.

  • Thanks all
    And I have some more clarification

    My developement part will be storage of data in flash
    permenantly which cannot be erased by any customer and the customer can only erase by serial command which will be handled by developer internally at application level

    How to write data permenantly to flash ?

    Also, how do we ensure that tools like LPC2000 don’t erase this part of flash if somebody is doing a download?

  • Also, how do we ensure that tools like LPC2000 don’t erase this part of flash if somebody is doing a download?

    if you setup uVision to "erase sectors" (see "Flash Download Setup" menu), only the sector required for your application will be clear during download. so it the ROM memory regions of differnet binary do not overlap - nothing can go wrong (this is ow a bootloader can be flashed without damaging the application, for example).

    How to write data permenantly to flash ?

    read the chapter about IAP in your device's user manual.

  • " if you setup uVision to "erase sectors" (see "Flash Download Setup" menu), only the sector required for your application will be clear during download. so it the ROM memory regions of differnet binary do not overlap - nothing can go wrong (this is ow a bootloader can be flashed without damaging the application, for example)."

    apart from configuring the "erase sectors" is there any other options to over come this on LPC2000

    read the chapter about IAP in your device's user manual.
    my manual talks about the normal storage to flash but i am looking for permenant storage of data in flash which may grow...in size after a certain peroid and also which sectors will be good for doing this operations

  • Michael what i understood from your last reply is

    I need to store data in flash with known sectors and config the erase sectors without this(permenant data storage) sectors.
    for example 0-12 sectors contains app and 13-14 will be my permenant data and this should solve my permenant storage problem.

    If i am wrong please correct me

  • Please read IAP (In application programming) chapter programming carefully.after that see sample code of IAP,many code are avalable on web.
    dont go in another loop.

    regards
    Shyam T.
    pune India

  • after reading to IAP commands then only i came up with questions and please go through my last reply to michael one's.

  • Hi,
    I am not knowing much abt IAP.but I have some code of IAP.
    give me your mail ID i will send that code.

    regards
    shyam T