2 Replies Latest reply on Jan 31, 2017 8:48 AM by jeffr_71

    Saving Device Name to Flash

      I am trying to save, and read back, the device name from flash without success.  I am using this code:




      /* Flash Config */
      #define FLASH_SIZE 128


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


      static const char FLASH_DEVICE_NAME[FLASH_SIZE] = {0}; // Flash space for device name
      char device_name[FLASH_SIZE];   // User input device name


      /* Flash data write constants */




      void ReadNameInFlash()
          uint8 i;


          // Read device from Flash
          for (i = 0; i < FLASH_SIZE; i++) {
              device_name[i] = FLASH_DEVICE_NAME[i];


      void SaveNameInFlash(const uint8 device_name[])
          CySysFlashWriteRow(FLASH_DATA_BASE_ADDRESS_ROW, device_name);
         // CyBle_GapSetLocalName((const char *)device_name);




      I have commented out the CyBLE calls as the BLE stack is not initialized at this point.  The call to CySysFlashWriteRow results in a return code of CY_SYS_FLASH_SUCCESS.




      The read of flash returns all zeros....




      Thanks for the help.