8 Replies Latest reply on Sep 23, 2016 2:59 AM by n.congvu_1902076

    How can I use Emulated EEPROM with psoc4 ble?

    user_492674991

      Hello.

         

      I'm trying to store array data to hole flash memory but I'v noticed it has some problem.

         

      If i don't check a firmware mem area and store data address in flash memory, they will overlapped each things.

         

      I'v searched some posts about how to store the data to flash or other place in posc.

         

      And I found Emulated EEPROM that emulates an EEPROM device in the flash memory.

         

      So I'v tried it my project but I could not find Emulated EEPROM Component on Psoc Creator using PSOC4 BLE.

         

      I found the component when I make proejct with Psoc4. 

         

      Does Psoc4 BLE not supported Emulated EEPROM Component?

         

       

         

      Thanks.

        • 1. Re: How can I use Emulated EEPROM with psoc4 ble?
          user_1377889

          The emEEProm component needs to change some of the PSoC4 BLE clocks to function properly, so it was removed from the PSoC4 components.

             

          There are some #defines for the flash arrays, sizes and locations, so best will be to use some of the upmost areas to store a row of user data. The "System Reference Guide" (from Creator's Help-menu) will show a bit more.

             

           

             

          Bob

          • 2. Re: How can I use Emulated EEPROM with psoc4 ble?
            changkun74_1511401

            If you want to write data in the flash, you need to read the following note in the BLE component datasheet:

               

            For BLE devices with 128 K of Flash memory, the Flash write modifies the IMO of the chip to 48 MHz temporarily during the write cycle. Therefore, you should only perform the bonding data Flash storage while the BLE devices are disconnected, because the change in IMO will disrupt the communication. Likewise, you should either temporarily halt all peripherals running off of the IMO or compensate for the brief frequency change during the Flash write cycle.
             If BLE device with 128 K of Flash memory, is configured to run at 48 MHz, then the IMO does not change and does not affect other peripherals. However, the Flash write is a blocking call and may disrupt the BLE communication. Therefore, it is advisable to perform the Flash write while the devices are disconnected.

               

             

               

            I did some test on the PRoC BLE (CYBL10563-56LQXI).

               

            1) Copy the Em_EEPROM.c and .h from the example code of CE95313 to my project. If my project does not call the CyBle_Start(), the Em_EEPROM_Write() can store data into the flash. But if the project calls the  CyBle_Start(),  Em_EEPROM_Write() cannot store data into the flash. The return code is still SUCCESS.

               

            2) Calling CyBle_StoreAppData() also can store data into the flash. (My chip has 128K flash, so I set the IMO to 48MHz in my project.)

               


             

            • 3. Re: How can I use Emulated EEPROM with psoc4 ble?
              abdullah.cinar_1528391

              Hi changkun,

                 

               

                 

              I had the same problem with you. If i call CyBle_Start() in the project, Em_EEPROM_Write() cannot store data into the flash. The return code is still SUCCESS.

                 

              However i used CyBle_StoreAppData() API and that worked very well. I didn't know this function before, thank you for that answer :)

              • 4. Re: How can I use Emulated EEPROM with psoc4 ble?
                n.congvu_1902076

                Hi changkun,

                   

                You mean that we no need port Em_EEPROM.c and .h from other example ? And how can I read back the data in flash.

                   

                Thanks

                • 6. Re: How can I use Emulated EEPROM with psoc4 ble?
                  n.congvu_1902076

                  Hi Bob, 

                     

                  No need for an API to read back, just use the address? I'm not clear about this. 

                     

                  Can you give me an example for my purpose: I want to write 3 bytes to 0x1F000. How can I write and how can I read back?

                     

                  Thanks

                  • 7. Re: How can I use Emulated EEPROM with psoc4 ble?
                    user_1377889

                    Reading back is quite easy:

                       

                    uint8 * Mydata = 0x1f000000; //  32bit pointer. Address depends on device/flash amount

                       

                    TestByte = *MyData+27;

                       

                     

                       

                    Writing will need to calculate the flash row number which depends on the row size and the flash size. You should use the upper flash area to leave your program code untouched.

                       

                    You cannot write 3 bytes to flash, minimum is a flash row. Way out is to read the row into a buffer, change the values of your 3 bytes and write back the complete row.

                       

                    Have a look into the "System Reference Guide" cy_boot, chapter 8 for flash related consts and APIs.

                       

                     

                       

                    Bob

                    • 8. Re: How can I use Emulated EEPROM with psoc4 ble?
                      n.congvu_1902076

                      Hi Bob,

                         

                      Thank for your answer. I can do it now with WriteUserSFlash like this project : Project #029: Supervisory Flash on PSoC 4 BLE