Write Flash of CY8C4246LTI-M445

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Dear All,

   

Im trying to write and read Flash. But it looks only reading works.

   

I have

   

/* Flash constants */
#define FLASH_ROW_SIZE_BYTES    CY_FLASH_SIZEOF_ROW
#define FLASH_ALIGNED __attribute__ ((aligned (FLASH_ROW_SIZE_BYTES)))

   

static const uint8 FLASH_ALIGNED flashRowDataFLASH[FLASH_ROW_SIZE_BYTES]= {2}

   

/* Flash data write constants */
#define FLASH_DATA_BASE_ADDRESS_BYTE    (uint32) (&flashRowDataFLASH)
#define FLASH_DATA_BASE_ADDRESS_ROW     FLASH_DATA_BASE_ADDRESS_BYTE / FLASH_ROW_SIZE_BYTES

   

Read as:

   

a = flashRowDataFLASH[0];   and get the value 2

   

For write:

   

uint8 eepromArray[CY_FLASH_SIZEOF_ROW];

   

eepromArray[0] = 5;

   

uint8 flashWriteResult;
    
flashWriteResult = CySysFlashWriteRow(FLASH_DATA_BASE_ADDRESS_ROW, eepromArray);

   

But after a power off-on and read the value 2 is read again not 5 as expected.

   

Could someone tell me please what Im doing wrong ?

   

Thanks

   

Zoltan

0 Likes
5 Replies