Flash Memory Organization and Array ID Parameter: PSoC® 3, PSoC 4, and PSoC 5LP
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
How is the flash memory organized in PSoC 3, PSoC 4, and PSoC 5LP? How to choose the array ID parameter for the CyWriteRowData API?
PSoC 3
In PSoC 3, the flash memory is organized as follows: (see Figure 1)
- One array of 64, 128, or 256 rows depending on the part number (Refer to the Ordering Information section of the family datasheet).
- Each row contains 256 data bytes plus 32 bytes for either ECC or data storage. To enable ECC in PSoC Creator, click the System tab of the .cydwr file > Configuration > Enable Error Correcting Code (ECC). If the option ‘Store Configuration Data in ECC Memory’ is enabled, then the device configuration data will be stored in the ECC memory to reduce main flash memory usage. Error correction may not be used when this option is enabled.
Figure 1. Flash Memory Organization for PSoC 3
PSoC 4
In PSoC 4, the flash memory is organized as follows: (see Figure 2)
- Either one array of 128, 256, or 512 rows, or two arrays of 512 rows depending on the part number (Refer to the Ordering Information section of the family datasheet).
- Each row contains 64, 128, or 256 data bytes depending on the part number (Refer to the Ordering Information section of the family datasheet). PSoC 4 has a maximum of 128 KB of flash memory and does not support the ECC feature.
Figure 2. Flash Memory Organization for PSoC 4
PSoC 5LP
In PSoC 5LP, the flash memory is organized as follows: (see Figure 3)
- Either one array of 128 or 256 rows, or as multiple arrays of 256 rows depending on the part number (Refer to the Ordering Information section of the family datasheet).
- Each row contains 256 data bytes plus 32 bytes for either error correcting codes (ECC) or configuration data.
Figure 3. Flash Memory Organization for PSoC5 LP
Writing data into Flash Using Firmware:
There are three APIs to write data into flash in PSoC 3/ PSoC 5LP.
- CyWriteRowFull(uint8 arrayId, uint16 rowAddress, uint8 *rowData, uint16 rowSize): to write the entire row including ECC
- CyWriteRowData(uint8 arrayId, uint16 rowAddress, uint8 *rowData): to write the entire row without ECC
- CyWriteRowConfig(uint8 arrayId, uint16 rowAddress, uint8 *rowECC) to write just the ECC memory
The parameters required by these APIs are as follows:
- Array-ID: The block number in which the required row is present. In the case of PSoC 3, the valid Array-ID is only 0x00
- RowAddress: Row address within the specified arrayId
- RowData/RowECC: Address of the data to be programmed
- RowSize: Number of bytes of row data
To write data into PSoC 4 flash, we use the CySysFlashWriteRow API, which does not require the Array-ID Parameter.
These flash APIs are defined in the CyFlash.c file. Details of the APIs are available in the System Reference Guide, which can be located in PSoC Creator at the following path:
Help > Documentation > System Reference > System Reference Guide
- Tags:
- 32-bit arma cortexa-m0 psoca 4
- 32-bit arma cortexa-m3 psoca 5lp
- Array ID Parameter
- flash memory
- psoc 4
- psoc 5lp
- psoca 3
- psoc® 3