5 Replies Latest reply on Oct 6, 2016 11:45 AM by user_1377889

    Write Flash of CY8C4246LTI-M445

    user_459023978

      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