Non-volatile data storage in PSoC 4 BLE

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

cross mob
Anonymous
Not applicable

After some quick read, I found that for non-volatile data storage, many PSoCs have the option of Emulated EEPROM.

   

However I could not find this component in a PSoC 4 BLE project.

   

Is there a reason why it is not available for PSoC 4 BLE? Like a technical conflict?

   

Aside from Emulated EEPROM, is there any other option for non-volatile data storage on PSoC 4 BLE?

   

I found another article talking about some API to write to flash, but I hope I don't have to resort to that.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

"I found another article talking about some API to write to flash, but I hope I don't have to resort to that."   This is exactly what the emulated eeprom does. Writing to flash changes some clocks and cannot be interrupted, so the normal function/program execution cannot be maintained. That is the reason why Cypress does not offer this for BLE.

   

But (now for the good news)

   

There is a system flash area defined for user access. Refer to "PSoC4 System Reference Guide" (from Creator Help menu)

   

Another approach:

   

The PSoC4 BLE Pioneer kit has got an FRam chip with i2c interface on board. This FRam can be made (due to the fast write access) immune against power losses as opposed to EEProm.

   

 

   

Bob

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

"I found another article talking about some API to write to flash, but I hope I don't have to resort to that."   This is exactly what the emulated eeprom does. Writing to flash changes some clocks and cannot be interrupted, so the normal function/program execution cannot be maintained. That is the reason why Cypress does not offer this for BLE.

   

But (now for the good news)

   

There is a system flash area defined for user access. Refer to "PSoC4 System Reference Guide" (from Creator Help menu)

   

Another approach:

   

The PSoC4 BLE Pioneer kit has got an FRam chip with i2c interface on board. This FRam can be made (due to the fast write access) immune against power losses as opposed to EEProm.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

What concerns me with using direct flash write/read is not the use of flash, but rather how flash is used. Frankly I am not experienced with memory management, and worry that my implementation could screw up the firmware and/or cause bad flash wear-out. That is why I feel like a tested implementation provided by Cypress is safer and more reliable, and hoped I could use it.

   

 

   

Another thing is that I have not understood how this user flash area is going to be different from the normal flash? In particular, should it not also interfere with BLE functionalities?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

"That is why I feel like a tested implementation provided by Cypress is safer"

   

Cypress provides you with the APIs to write to flash or to system flash. There are #defines that clearly mark where the user area starts and how large it is, so this is provided by Cypress.

   

Flash endurance from datasheet is guaranteed 100k cycles.

   

The system flash is protected from erase and afaik cannot be written with "normal" flash APIs.

   

 

   

Bob

JaDa_1584736
Level 1
Level 1
First like received

http://www.cypress.com/file/130791/download

   

Here is the link to the PSoC4_CyBoot_V5_20_Datasheet.   I hope that this works.  I will write a function check for size and to pad the extra data needed for a ROW.

   

 

   

http://www.cypress.com/blog/100-projects-100-days/project-029-supervisory-flash-psoc-4-ble

manusharian
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello,

   

In one of my post I shared a code for writing and reading lines of FLASH http://www.cypress.com/forum/psoc-4-ble/store-data-flash?page=1

   

It worked for some time but then I had some clock problems even if I used a 256KB FLASH chip and it is stated in data sheets that these chips should not have the clock problems, or any side effect problems. It turns out it have.

   

But good news Thanks to Cypress community using a technical ticket we corrected this in terms of using another function: CyBle_StoreAppData from BLE_StackHostMain.h file. In the header file you can check the description. if you replace the function FLASH_i8StoreData from my previous post with this function you are good to go. I am able to fully write the flash with BLE conenction on and until now I did not have any problems at all.

   

 

   

<code>

   


int8 FLASH_i8StoreData(uint8 *pu8Data)
{
 int8 i8Status = 1;
    uint8* pu8AuxPointer;
 if(FLASH__u32CurrentWriteRow <= FLASH__nStoreEndRow)
 {
       
        pu8AuxPointer = (uint8 *)(CY_FLASH_BASE + (CY_FLASH_SIZEOF_ROW * FLASH__u32CurrentWriteRow));
       
        while(CyBle_StoreAppData(pu8Data,pu8AuxPointer,CY_FLASH_SIZEOF_ROW,0) != CYBLE_ERROR_OK)
        {
            ;
        }
       
        FLASH__u32CurrentWriteRow++;
 }
 else
 {
  i8Status = -1;
 }
 
 return i8Status;
}
</code>

   

It is not non-volatile but maybe it helps. Using the FRAM is a good solution on a KIT but creating your own board and pun an FRAM on it is not very inexpensive.