Flash Memory programming of individual locations

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

cross mob
Anonymous
Not applicable
        I'm not looking for a boot loader. My question is if there is a way to program variables once flash memory has been programmed. eg a variable that would not go away when powered off.   
0 Likes
5 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Take a look at this -

   

 

   

    

   

          http://www.element14.com/community/thread/24155/l/psoc-4-pioneer-kit-community-project014-what-was-t...

   

 

   

Regards, Dana.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Another way to save your data in EEPROM as shown here

   

http://www.cypress.com/?app=forum&id=2492&rID=105370

   

 

   

odissey1

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

Your problem has to be solved in different steps

   

 

   

Putting a variable into flash instead of sram

   

static const uint16 MyVar = 0x20c0ffee; // This can be done with s struct to get more space

   

 Initialization is required

   

 

   

Retrieving the data from flash:

   

Due to compiler optimization an assignment like

   

NewVar = MyVar;

   

Will assign 0x20c0ffee to Newvar, even when its value was re-programmed, so use memcpy() instead

   

 

   

Programming new values using the em_EEProm component

   

Result = Em_EEPROM_Write(&RamVar,&MyVar, sizeof(MyVar));  // Program the value of RamVar into flash, setting MyVar

   

The above needs some type-castings to uint8[]* to avoid warnings.

   

 

   

Hope that helps.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Note if doing a PSOC 4 BLE design, the eeprom component not

   

currently implemented. But the basic FLASH write techniques

   

can still be used.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 I'm using the 

   

 Pioneer development board so I had to use the flash method. Works good.

   

Thanks.

0 Likes