MC9S08SH8 - How to save data in Flash Memory

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S08SH8 - How to save data in Flash Memory

19,801件の閲覧回数
cremonezi
Contributor I

Hi,

 

I'd like to save some data of my application in the flash memory of MC9S08SH8.

 

The user of application should be able to choose a new value while the application is running and the application should be able to keep this data in the non-volatile memory.

 

Is there any example of how to save data in the flash memory (as an EEPROM)?

 

Thank you, in advance.

ラベル(1)
0 件の賞賛
1 返信

292件の閲覧回数
bigmac
Specialist III

Hello,

 

If you search this forum, you should find numerous examples of programming non-volatile data to a flash block, from within an application.  This is a very frequent request.  The datasheet for the device details the erase amd programming algorithms used, and provides flow diagrams.

 

Some basics to keep in mind -

  1. The minimum block size for erasure is 512 bytes.
  2. Flash memory within the same flash array is inaccessible during the erasure or byte programming process, so the code for these operations must be transferred to RAM, and run from there.  The device you are using, along with most other HCS08 devices, has only a single flash array.
  3. The RAM based code may be either pushed onto the stack, or alternatively occupy a fixed block of RAM.  The size of the block is quite variable, depending on the specific implemtation.  For the 'SH8 device, the minimum is about 20 bytes of code.
  4. Interrupts need to be globally disabled during the erasure or byte programming process.

 

Regards,

Mac

 

0 件の賞賛