AnsweredAssumed Answered

MPC5748G_EEPROM_Emulation

Question asked by chen xiubo on Sep 27, 2017

Hi,

      I'm  using  MPC5748G  Flash emulation EEPROM,  I  referenced  MPC5xxx_EEE_DRIVER(EEE_Driver_v1.3.0). From the  MPC5748GRM,  we can use  Mid address space  for emulating EEPROM:

 

Here I modified the ee_blocks.h code:

 

#ifndef _EE_BLOCKS_H_
#define _EE_BLOCKS_H_
#include "eeprom_driver/ee_emulation.h"

#define FLASH_REG_BASE 0xFFFE0000
#define LOCK0_REG_OFFSET 0x00000010
#define LOCK1_REG_OFFSET 0x00000014

#define MAIN_ARRAY_BASE 0x00FA0000 /* Base address for EE blocks */

 

/* Mid address space partition 3 :0x00FA0000--0x00FA3FFF*/
#define BLOCK0_OFFSET 0x00000000 /* Offset of low block 0 */
#define BLOCK0_SIZE 0x4000 /* 16KB size */
#define BLOCK0_MASK 0x00000010
#define BLOCK0_PARTITION (0x1<<3)
#define BLOCK0_ADD_SPACE     MID_ADDRESS_SPACE

 

/* Mid address space partition 3 :0x00FA4000--0x00FA7FFF */
#define BLOCK1_OFFSET 0x00004000
#define BLOCK1_SIZE 0x4000
#define BLOCK1_MASK 0x00000020
#define BLOCK1_PARTITION (0x1<<3)
#define BLOCK1_ADD_SPACE     MID_ADDRESS_SPACE

 

/* Mid address space partition 3 :0x00FA8000--0x00FABFFF*/
#define BLOCK2_OFFSET 0x00008000
#define BLOCK2_SIZE 0x4000
#define BLOCK2_MASK 0x00000040
#define BLOCK2_PARTITION (0x1<<3)
#define BLOCK2_ADD_SPACE      MID_ADDRESS_SPACE

/* Mid address space partition 3 :0x00FAC000--0x00FAFFFF*/
#define BLOCK3_OFFSET 0x00010000
#define BLOCK3_SIZE 0x4000
#define BLOCK3_MASK 0x00000080
#define BLOCK3_PARTITION (0x1<<3)
#define BLOCK3_ADD_SPACE     MID_ADDRESS_SPACE

 

 

#define UNLOCK_EBLOCKS CLEAR32(FLASH_REG_BASE + LOCK0_REG_OFFSET, 0x000000F0);


/* Block address bases */
#define BASE_ADDR_aL_a16K 0x00F90000
#define BASE_ADDR_aL_a32K 0xFFFFFFFF
#define BASE_ADDR_aL_a64K 0xFFFFFFFF
#define BASE_ADDR_aM_a16K 0x00F90000
#define BASE_ADDR_aM_a32K 0x00FB0000
#define BASE_ADDR_aM_a64K 0xFFFFFFFF
#define BASE_ADDR_aH_a16K 0xFFFFFFFF
#define BASE_ADDR_aH_a32K 0xFFFFFFFF
#define BASE_ADDR_aH_a64K 0xFFFFFFFF

#endif /* _EE_BLOCKS_H_ */

 

I  need  the address  from 0x00F90000 to 0x00F9FFFF  using  bootloader,  so  the address  from 0x00FA0000 to 0x00FAFFFF   I  will  use emulating EEPROM(totally 64KB).  In the app  project, here  some questions:

 

1.How to config the Linker_Files\57xx_flash.ld:

 

         flash_rchw : org = 0x00FA0000,   len = 0x4   or

         flash_rchw : org = 0x00FB0000,   len = 0x4   

         which is right?

 

2. How to config the value of BLOCK0_ADD_SPACE...BLOCK3_ADD_SPACE?

 

3. How to config the value of BASE_ADDR_aL_a16K,......BASE_ADDR_aH_a64K?

 

4. Are there any place need to modify in my project, except  for ee_blocks.h.

 

 

Original Attachment has been moved to: MPC5748G_EEPROM_Emulation.zip

Outcomes