You are here

Non-volatile data storage in PSoC 4 BLE | Cypress Semiconductor

Non-volatile data storage in PSoC 4 BLE

Summary: 5 Replies, Latest post by Marian-Emanuel Ionascu on 03 Nov 2016 03:52 AM PDT
Verified Answers: 4
Last post
Log in to post new comments.
htvo3_1410116's picture
User
5 posts

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.

user_1377889's picture
User
9625 posts

"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

htvo3_1410116's picture
User
5 posts

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?

user_1377889's picture
User
9625 posts

"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

jim.pres_1584736's picture
User
7 posts

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-supervisor...

ionascu.marianemanuel_1654946's picture
User
36 posts

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.

Log in to post new comments.