Download User SFlash Write.pdf

PSoC 4 BLE – User SFlash Write
PSoC 4 BLE and PRoC BLE devices have 512 bytes of user configurable supervisory flash (SFlash) that is retained across
normal programming cycle. This example project demonstrates how to write and read to this user SFlash locations from
PSoC 4 BLE and PRoC BLE devices have two types of non volatile memory:
User code flash used for storing the application program to be executed
Supervisory flash (SFlash) that is used for storing flash protection details, device trim settings, chip level protection
In addition to features mentioned above, SFlash in PSoC 4 BLE and PRoC BLE devices also contains 4 user configurable
rows that the application can use for storing Bluetooth device address, application specific data or manufacturing specific
information (device serial number, application sensor calibration data etc.). This user configurable SFlash has the advantage
that data stored in SFlash is not erased during normal device programming cycle or during a firmware upgrade using wired or
over the air (OTA) bootloading.
The organization of user configurable SFlash in PSoC 4 BLE and PRoC BLE family of devices with 128KB user code flash
size is as shown in Figure 1.
Figure 1: PSoC 4 BLE Device SFlash Organization and Address
PSoC 4 BLE - User SFlash Write
The user configurable SFlash can be accessed either through the SWD programming interface or from CPU using firmware.
These SFlash locations are mapped directly to the CPU’s address space. Therefore, the user firmware or external
programmer can read its content directly from the given row address. Writing to user configurable SFlash from the SWD
interface is explained in detail in the BLE device family programming specification and a C# utility is provided along with PSoC
Programmer (located at C:\Program Files (x86)\Cypress\Programmer\Examples\Misc\PSoC4-BLE-SFLASH-Update\) to
update the user configurable SFlash during manufacturing.
This example project demonstrates how to update this user configurable SFlash location from user code so that application
specific dynamic data could be stored and retrieved.
Design Tool: PSoC Creator 3.1 SP1 with built-in GCC 4.8.4
Associated Devices: All PSoC 4 BLE devices
Required Hardware: CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit
Hardware Setup
The BLE Pioneer Kit has all the necessary hardware required for this example. Figure 2 shows the hardware setup for this
example. USB connection is required for programming the BLE Pioneer Kit and also to display user messages on serial port
terminal program on the host PC.
Figure 2: Kit Setup
PSoC 4 BLE - User SFlash Write
PSoC Creator Schematic
Figure 3. PSoC Creator Schematic
Figure 4. User SFlash Access Source Files
The important part of firmware in this example project is the “WriteUserSFlashRow” API located in WriteUserSFlash.c file. This
API demonstrates how to write to user configurable SFlash location from CPU. The example project uses switch SW2 on BLE
PSoC 4 BLE - User SFlash Write
Pioneer Kit to trigger user configurable SFlash row update with a predefined data pattern and displays the content of the user
configurable SFlash locations and other status messages on a UART terminal as shown in Figure 5.
Figure 5. UART Console Output
PSoC 4 BLE - User SFlash Write
Related Documents
Table 1 lists all relevant application notes, code examples, knowledge base articles, device datasheets, and Component
Table 1. Related Documents
Getting Started with PSoC 4 BLE
Provides an introduction to PSoC 4 BLE
device that integrates a Bluetooth Low
Energy radio system along with
programmable analog and digital
Similar pages