English
Language : 

CY8C22213 Datasheet, PDF (47/304 Pages) Cypress Semiconductor – PSoC Mixed Signal Array
CY8C22xxx Preliminary Data Sheet
4. Supervisory ROM (SROM)
SWBootReset to get a good checksum, the fail count would
be 01h.
4.1.2.2 Read Block Function
The ReadBlock function is used to read 64 contiguous bytes
from Flash: a block. The number of blocks in a device is sim-
ply the total number of bytes divided by 64. For the
CY8C22xxx, the Flash contains 32 blocks of 64 bytes.
The first thing this function does is check the protection bits
and determine if the desired BLOCKID is readable. If read
protection is turned on, the ReadBlock function will exit set-
ting the accumulator and KEY2 back to 00h. KEY1 will have
a value of 01h, indicating a read failure.
If read protection is not enabled, the function will read 64
bytes from the Flash using a ROMX instruction and store the
results in SRAM using an MVI instruction. The first of the 64
bytes will be stored in SRAM at the address indicated by the
value of the POINTER parameter. When the ReadBlock
completes successfully the accumulator, KEY1 and KEY2
will all have a value of 00h.
Table 4-6. ReadBlock Parameters (01h)
Name
KEY1
KEY2
BLOCKID
POINTER
Address
0,F8h
0,F9h
0,FAh
0,FBh
Description
3Ah
Stack Pointer value, when SSC is exe-
cuted.
Flash block number
First of 64 addresses in SRAM where
returned data should be stored.
4.1.2.3 WriteBlock Function
The WriteBlock function is used to store data in the Flash.
Data is moved 64 bytes at a time from SRAM to Flash using
this function.
The first thing the WriteBlock function does is check the pro-
tection bits and determine if the desired BLOCKID is write-
able. If write protection is turned on, the WriteBlock function
will exit setting the accumulator and KEY2 back to 00h.
KEY1 will have a value of 01h, indicating a write failure.
The configuration of the WriteBlock function is straight for-
ward. The BLOCKID of the Flash block, where the data is
stored, must be determined and stored at SRAM address
FAh. Valid BLOCKID values are between 00h and.
The SRAM address of the first of the 64 bytes to be stored in
Flash must be indicated using the POINTER variable in the
parameter block (SRAM address FBh).
Finally, the CLOCK and DELAY value must be set correctly.
The CLOCK value determines the length of the write pulse
that will be used to store the data in the Flash. The CLOCK
and DELAY values are dependent on the CPU speed and
must be set correctly. Refer to “Clocking” on page 49 for
additional information.
Table 4-7. WriteBlock Parameters (02h)
Name
KEY1
KEY2
BLOCKID
POINTER
CLOCK
DELAY
Address
0,F8h
0,F9h
0,FAh
0,FBh
0,FCh
0,FEh
Description
3Ah
Stack Pointer value, when SSC is exe-
cuted.
Flash block number (00h – 3Fh).
First of 64 addresses in SRAM, where
the data to be stored in Flash is located
prior to calling WriteBlock.
Clock divider used to set the write pulse
width.
For a CPU speed of 12 MHz set to 56h.
4.1.2.4 EraseBlock Function
The EraseBlock function is used to erase a block of 64 con-
tiguous bytes in Flash.
The first thing the EraseBlock function does is check the
protection bits and determine if the desired BLOCKID is
writeable. If write protection is turned on, the EraseBlock
function will exit setting the accumulator and KEY2 back to
00h. KEY1 will have a value of 01h, indicating a write failure.
To set up the parameter block for the EraseBlock function,
correct key values must be stored in KEY1 and KEY2. The
block number to be erased must be stored in the BLOCKID
variable and the CLOCK and DELAY values must be set
based on the current CPU speed. For more information on
setting the CLOCK and DELAY values, see “Clocking” on
page 49.
Table 4-8. EraseBlock Parameters (03h)
Name
KEY1
KEY2
BLOCKID
CLOCK
DELAY
Address
0,F8h
0,F9h
0,FAh
0,FCh
0,FEh
Description
3Ah
Stack Pointer value, when SSC is exe-
cuted.
Flash block number (00h – 3Fh).
Clock divider used to set the erase
pulse width.
For a CPU speed of 12 MHz set to 56h.
December 22, 2003
Document No. 38-12009 Rev. *D
47