CY8CMBR3xxx Device Programming Specifications
CY8CMBR3xxx Device Programming Specifications
CY8CMBR3xxx Device Programming Specifications
CY8CMBR3xxx
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
www.cypress.com
Copyrights
Copyrights
© Cypress Semiconductor Corporation, 2013-2019. This document is the property of Cypress Semiconductor Corporation
and its subsidiaries ("Cypress"). This document, including any software or firmware included or referenced in this document
("Software"), is owned by Cypress under the intellectual property laws and treaties of the United States and other countries
worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this para-
graph, grant any license under its patents, copyrights, trademarks, or other intellectual property rights. If the Software is not
accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use of
the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to subli-
cense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce
the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the
Software in binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for
use on Cypress hardware product units, and (2) under those claims of Cypress's patents that are infringed by the Software
(as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware
products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR-
POSE. No computing device can be absolutely secure. Therefore, despite security measures implemented in Cypress hard-
ware or software products, Cypress shall have no liability arising out of any security breach, such as unauthorized access to
or use of a Cypress product. CYPRESS DOES NOT REPRESENT, WARRANT, OR GUARANTEE THAT CYPRESS PROD-
UCTS, OR SYSTEMS CREATED USING CYPRESS PRODUCTS, WILL BE FREE FROM CORRUPTION, ATTACK,
VIRUSES, INTERFERENCE, HACKING, DATA LOSS OR THEFT, OR OTHER SECURITY INTRUSION (collectively, "Secu-
rity Breach"). Cypress disclaims any liability relating to any Security Breach, and you shall and hereby do release Cypress
from any claim, damage, or other liability arising from any Security Breach. In addition, the products described in these mate-
rials may contain design defects or errors known as errata which may cause the product to deviate from published specifica-
tions. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further
notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this
document. Any information provided in this document, including any sample design information or programming code, is pro-
vided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test
the functionality and safety of any application made of this information and any resulting product. "High-Risk Device" means
any device or system whose failure could cause personal injury, death, or property damage. Examples of High-Risk Devices
are weapons, nuclear installations, surgical implants, and other medical devices. "Critical Component" means any compo-
nent of a High-Risk Device whose failure to perform can be reasonably expected to cause, directly or indirectly, the failure of
the High-Risk Device, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and
hereby do release Cypress from any claim, damage, or other liability arising from any use of a Cypress product as a Critical
Component in a High-Risk Device. You shall indemnify and hold Cypress, its directors, officers, employees, agents, affiliates,
distributors, and assigns harmless from and against all claims, costs, damages, and expenses, arising out of any claim,
including claims for product liability, personal injury or death, or property damage arising from any use of a Cypress product
as a Critical Component in a High-Risk Device. Cypress products are not intended or authorized for use as a Critical Compo-
nent in any High-Risk Device except to the limited extent that (i) Cypress's published data sheet for the product explicitly
states Cypress has qualified the product for use in a specific High-Risk Device, or (ii) Cypress has given you advance written
authorization to use the product as a Critical Component in the specific High-Risk Device and you have signed a separate
indemnification agreement.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-
RAM, and Traveo are trademarks or registered trademarks of Cypress in the United States and other countries. For a more
complete list of Cypress trademarks, visit cypress.com. Other names and brands may be claimed as property of their respec-
tive owners.
1. Introduction 5
1.1 Programmer.................................................................................................................5
1.2 Introduction to CY8CMBR3xxx ....................................................................................6
2. Required Data 7
2.1 Hex File Origin .............................................................................................................7
2.2 Nonvolatile Subsystem ................................................................................................7
2.3 Organization of the Hex File ........................................................................................7
3. Communication Interface 9
3.1 The Protocol Stack ......................................................................................................9
3.2 I2C Interface ................................................................................................................9
3.3 Physical Layer ...........................................................................................................10
3.4 Hardware Access Commands ...................................................................................14
3.5 Pseudocode...............................................................................................................14
4. Programming Algorithm 17
4.1 High-Level Programming Flow ..................................................................................17
4.2 Subroutines used in Programming Flow ....................................................................17
4.3 Step 1 – Acquire Chip................................................................................................20
4.4 Step 2 – Check Silicon ID ..........................................................................................23
4.5 Step 3 – Program Flash .............................................................................................24
4.6 Step 4 – Verify Flash .................................................................................................26
4.7 Step 5 – Release Chip...............................................................................................27
Revision History 33
This programming spec gives the information necessary to program the nonvolatile memory of the CY8CMBR3xxx devices. It
describes a communication protocol that an external programmer will access, explains the programming algorithm, and gives
electrical specifications of the physical connection.
1.1 Programmer
A programmer is a hardware-software system that stores a binary program (hexadecimal file) in the silicon's program (flash)
memory. The programmer is an essential component of the engineer's prototyping environment or an integral element of the
manufacturing environment (mass programming). The high-level diagram of the development environment is illustrated in
Figure 1-1.
I2C-bus
IDE SILICON
HEX - File PROGRAMMER
(EZ-Click 2.0 ) ( CY8CMBR3xxx )
In the manufacturing environment, the IDE block is absent because its main purpose is to produce a hex file.
The structure of the programmer depends on its exploiting requirements. It can be software or firmware centric:
Software centric: The programmer's hardware works as a bridge between the protocol (such as USB) and I2C. All I2C com-
mands are passed to the hardware through the protocol from an external device (software). The bridge is not involved in the
parsing of the hex file and programming algorithm – the upper layer (software) performs this task. Examples of such program-
mers are the Cypress MiniProg3 and TrueTouchBridge.
Firmware centric: This is an independent hardware design in which all the functions of the programmer are contained in one
device, including storage for the hex file. Its main purpose is to be a mass programmer in manufacturing.
This document does not include the specific implementation of the programmer. It focuses on data flow, algorithms, and phys-
ical interfacing.
It specifically covers the following topics, which correspond to the three functions of the programmer:
Data to be programmed
Interface with the chip
Algorithm used to program the target device
The nonvolatile subsystem of the silicon consists of a flash memory system with a maximum of 128 bytes. The flash memory
system stores the device configuration information.
The part can be programmed after it is installed in the system by way of the I2C interface (in-system programming). The char-
acteristics of the I2C slave interface are:
Communication speed is up to 400 kHz.
No bus stalling – no clock-stretching
The I2C address is configurable through the I2C register map.
This document focuses on the specific programming operations without referencing the silicon architecture. Many important
topics are detailed in the Appendices. Most of the other material appears in the CY8CMBR3xxx datasheet.
This chapter describes the information that the programmer The flash memory is mapped directly to the I/O registers of
must extract from the hex file to program the the silicon; 128 bytes of flash configure 0x00-0x7F registers
CY8CMBR3xxx silicon. of the Device Configuration state. Programmer extracts all
128 bytes from the hex file.
2.1 Hex File Origin For more information about registers and operating states,
refer to the CY8CMBR3xxx datasheet.
Customers use the EZ-Click GUI to develop their projects.
After the project development, the nonvolatile configuration
of the silicon is saved in the hex file. Only one record in this 2.3 Organization of the Hex File
file actually targets the flash memory:
The hexadecimal (hex) file is a medium to describe the non-
Device configuration registers
volatile configuration of the project. It is the data source for
Other records are auxiliary and are used to keep the integ- the programmer.
rity of the programming flow.
The hex file for the CY8CMBR3xxx family follows the Intel
Hex File format. Because Intel's specification is generic, it
2.2 Nonvolatile Subsystem defines only some types of records that can make up the
The flash memory is organized into one bank of 128 bytes. hex file. The specification allows customizing the format for
The programming granularity is one bank at a time. essentially any possible silicon architecture. The functional
meaning of the records is defined by the silicon vendor and
The bank represents the registers of the Device Configura- typically varies for different chip families. See Appendix A:
tion state. During the silicon's start-up (after HW/SW reset), Intel Hex File Format on page 29 for details of the Intel Hex
the re-programmed functionality is loaded into the corre- File Format.
sponding volatile memory (registers).
The CY8CMBR3xxx family defines three types of data sec-
Figure 2-1 shows the flash organization and how it maps to tions in the hex file: configuration flash, checksum, and
the I/O space of the silicon. metadata. See Figure 2-2 to determine the allocation of
Figure 2-1. Nonvolatile Subsystem these sections in the address space of the Intel Hex File.
The address space of the hex file does not map to the phys-
Device Configuration ical addresses of the I/O registers of the silicon. Program-
mer uses hex addresses (see Figure 2-2) to read sections
0x00 from the hex file into its local buffer. Later, this data is pro-
SENSOR_EN_LSB
0x01 grammed (translated) into the corresponding addresses of
SENSOR_EN_MSB
0x02 the silicon.
FSS_EN_MSB
0x03
..
FSS_EN_LSB
Registers
. Stored in
Flash
0x7E CONFIG_CRC_LSB
0x7F CONFIG_CRC_MSB
1 byte
Figure 2-2. Organization of Hex File for the CY8CMBR3xxx I2C Write Address: This I2C address must be used dur-
Family ing the programming step. Note that after the device is
programmed by this file, its I2C address can be changed
0x0000 0000 128 bytes (the new address is effective only after a reset or power
cycle). Therefore, during the second and next program-
Configuration ming cycles, the programmer must use the I2C Verify
Flash Address. This field makes sense for the first program-
ming cycle.
I2C Verify Address: Use this I2C address during the ver-
ification step. Note that after the first programming cycle,
0x9030 0000 2 bytes
the I2C Write and I2C Verify addresses will be the same.
Checksum
0x9050 0000
The correct use of the I2C Write and I2C Verify
7 bytes
Metadata addresses will be covered later in this document.
Device ID: This three-byte value defines the part number
for which this hex file is generated. These three bytes
- unused space N Bytes - populated space
reflect the content of FAMILY_ID and DEVICE_ID[0-1]
registers in the memory map. For example, for
CY8CMBR3002 the Device ID is "0x9A (family_id), 0x0A
0x0000 0000 - Configuration Data (128 bytes), which must (silicon_id_high), 0x00 (silicon_id_low)". The program-
be programmed into the flash. These bytes configure the mer uses this field to check whether the hex file corre-
CY8CMBR3xxx device during boot. sponds to the target chip. See Table 2-2 to understand
the correspondence between the ID in hex and the
0x9030 0000 - Checksum (2 bytes) of all the bytes in the
memory map.
Configuration Flash (128 bytes). The checksum is the arith-
metical sum of every byte in the user's flash. The 2-byte Table 2-2. Device ID in Hex and Memory Map
result is saved in this section in the Big-Endian format (MSB Device ID
I2C Register Description
byte is first). This record must be used by the programmer to (in hex)
check the integrity of the hex file. Integrity means that the 0x91 Meta Data [4] High ID
"Checksum" and "Configuration Flash" sections must corre- 0x90 Meta Data [5] Low ID
late in this file. 0x8F Meta Data [6] Family ID
0x9050 0000 - Meta Data (7 bytes). This section contains
data, which is not programmed into flash. These are param-
eters for the programmer used during programming. The
meaning of the fields in this section are listed in Table 2-1.
This chapter explains the low-level details of the communi- The I2C Interface and Physical Layer are the lower-layer
cation interface. protocols. Note that the physical layer is the complete hard-
ware specification of the signals and interfacing pins, and
includes drive modes, voltage levels, resistance, and other
3.1 The Protocol Stack components. The upper protocols are logical and algorith-
Figure 3-1 illustrates the stack of protocols involved in the mic levels.
programming process. The programmer must implement The purpose of the I2C interface layer is to be a bridge
both hardware and software components. between pure software and hardware implementations. The
Figure 3-1. Programmer’s Protocol Stack “Programming Algorithms” protocol is implemented com-
pletely in the software; its smallest building block is the I2C
command. The whole programming algorithm is the mean-
Programming Algorithm ingful flow of these blocks. The I2C interface helps to isolate
(Step 1 … Step N) the programming algorithm from hardware specifics, which
makes the algorithm reusable. The I2C interface must trans-
form the software representation of these commands into
I2C Read / Write
line signals (digital form).
I2C – Interface
(Hardware Access Commands) 3.2 I2C Interface
Inter-Integrated Circuit (I2C) is the industry-standard com-
munication interface developed by Phillips Semiconductors
Logical I2C signal
(now NXP Semiconductors). It is a synchronous, serial, 8-bit
oriented, bidirectional 2-wire bus that implements a master/
Physical Layer slave relationship with 128 slaves on the bus. The I2C stan-
(Signals, interfacing with chip) dard defines the following working modes: Standard (up to
100 kHz), Fast (up to 400 kHz), Fast-mode + (up to 1 MHz),
Signals on the Line or High Speed (up to 3.4 MHz). The complete bus specifica-
tion can be found on the official NXP website. Designers of
I2C-compatible chips must use the I2C-Bus specification
and user manual (UM10204) as a reference to ensure that
The Programming Algorithm protocol—the topmost proto-
their devices meet all specific limits.
col—implements the whole programming flow in terms of
atomic I2C commands. It is the most solid and fundamental Cypress's family of CY8CMBR3xxx devices is I2C-compati-
part of this specification. For more information on this algo- ble and these devices operate in the slave mode. The mas-
rithm, see Chapter 4: Programming Algorithm. ter (host) uses an I2C bus to program flash or configure
devices during runtime, read CapSense data, and so on.
Note that the programmer may occasionally need to work in The I2C-Bus defines two digital pins to communicate with
a multi-master environment. Consider that possibility when the master (programmer). They are sufficient for bidirec-
selecting the master's solution. In most cases, programming tional, semi-duplex data exchange (byte granularity). These
runs on single-master buses. two bidirectional wires are:
The CY8CMBR3xxx I2C interface has the following fea- Serial Clock (SCL): This line is used to synchronize the
tures: slave with the master.
7-bit addressing mode (up to 128 slaves). Serial Data (SDA): This line is used to send data
between the data and slave.
Bit-rate up to 400 kHz (Standard mode).
No bus stalling – no clock stretching. Figure 3-2 shows an example of an I2C bus with slaves.
I2C buffer – 252 bytes (the first 128 bytes are used for Note During programming of the CY8CMBR3xxx device,
device configuration). the I2C bus executes only the transport function (sends
bytes between the master and slave). A complete set of
The developer of programmer must ensure that the selected
lines is required from the programmer to communicate with
or designed solution of the I2C master supports all these
the CY8CMBR3xxx device, as specified in Physical Layer.
features, which are a subset of the I2C specification.
VDD
I2C R R
Master
SCL
SDA
The programming flow consists of multiple Read and Write The external interface connection between the host pro-
I2C transactions. These transactions are atomic transac- grammer and the target CY8CMBR3xxx device is shown in
tions from the standpoint of this specification. They can be Figure 3-3 on page 11.
of different length in bytes, but both are embraced in the
This figure also depicts all the power supply connections
bus's START and STOP signals. Repeated START is not
required in the typical working conditions of chip.
used.
CY8CMBR3xxx
Host
Programmer RP RP
0.1 uF
1.5 - 6 K VDD_IO
Vcc
VDD VDD
SCL I2C_SCL
SDL I2C_SDA
XRES XRES
VSS VSS
GND
Note 1: The VDD_IO supply is pin available only the selected packages. For the packages that have a
VDD_IO pin, the VDD and VDD_IO pins should be connected together (shorted) on the board.
Note 3: If the device is powered in the 1.8 V ±5% range, the VDD and VCC pins must be connected
together (shorted) on the board. If the device package has a VDD_IO pin, then the VDD, VDD_IO, and VCC
must be connected together (shorted).
Note 4: All other pins which are not shown in the circuit above should not be connected to any
electrical node and must be left floating.
Unused
Mode Necessary Pins Use cases
Pins
1. Board can be self-powered (device VDD is not connected to the programmer).
VDD (optional) 2. This mode is used when the board consumes too much current, which the pro-
grammer cannot supply (VDD line is not connected).
GND VDD
Reset 3. Five-pin case – when the host supplies power and toggles XRES (this is the
XRES (if self-pow-
most popular programming method).
SCL ered)
4. If there are other devices on the I2C bus, it is recommended to connect the
SDA host’s XRES to every chip. It will ensure that the host can reset every slave that
may hang up the bus.
1. The board can be self-powered (device VDD is not connected to the program-
VDD (optional) VDD mer).
GND (if self-pow- 2. This mode is used when the board consumes too much current, which the pro-
No-Reset
SCL ered and no grammer or the I2C master cannot supply (the VDD line is not connected).
SDA XRES) 3. This mode is used when the I2C master (host) or slave (target) does not have an
XRES pin.
1. This mode is used when the I2C master (host) or slave (target) does not have an
XRES pin on the part’s package. The only way to reset a part is the Power Cycle
VDD mode when there is no XRES pin.
GND 2. The Power Cycle mode is relevant to most of the CY8CMBR3xxx packages
Power Cycle XRES
SCL because all of them, except one, do not have an XRES pin. It is the recommended
mode.
SDA
3. Some third-party I2C masters can use this mode if they do not implement the
XRES line but can supply power (on/off) to reset a part.
CY8CMBR3xxx
Function External Programmer – Drive Modes
Pin Name
Power supply input
VDD Positive voltage – powered by external power supply or by programmer.
(1.8 – 5.5 V)
VSS Power supply return Low resistance ground connection. Connect to circuit ground.
Active low external reset input
XRES Output – drive TTL levels (Drive mode – Strong)
(with internal pull up).
Output – drive TTL levels (Drive mode – Open Drain Low)
Input – read TTL levels in High-Z mode.
I2C Clock line In general, SCL is bidirectional to watch for clock-stretching but CY8CMBR3xxx
SCL
(up to 100 kHz) devices do not support stretching. Therefore, this line is used in the unidirectional
mode.
The external pull-up resistor (RP) must be calculated.
Output – drive TTL levels (Drive mode – Open Drain Low)
I2C Data line
SDL Input – read TTL levels in High-Z mode.
- bidirectional
The external pull-up resistor (RP) must be calculated.
VCC Power Output Filter The external 0.1-uF capacitor must be connected between this pin and ground.
CMOD External Modulator Capacitor The external 2.2-nF capacitor must be connected between this pin and ground.
Figure 3-3 on page 11 shows that the I2C bus requires 3.4 Hardware Access
external pull-up resistors (RP). In choosing these resistors,
consider supply voltage, clock speed, and bus capacitance. Commands
The typical value is in the range of 1.5 to 6 K for supply This section focuses on the low-level APIs that must be sup-
voltages in the range of 1.8 to 5.0 V. More information about ported by the programmer of the CY8CMBR3xxx devices.
calculating the RP value can be found in the I2C Bus Speci-
fication (UM10204, section 7.1 - Pull-up resistor sizing). The APIs must be implemented by the I2C Interface layer
shown in Table 3-3. They make up the software fundamental
The I2C timing specifications and the silicon's electrical for the high-level programming algorithm. This low-level API
specifications are documented in the CY8CMBR3xxx data- interface can be considered the hardware abstraction layer,
sheet. because it is hardware-independent (but its implementation
is important for concrete hardware). Theoretically, the upper
layer (Programming Algorithm in Table 3-3) can be reused
for a different programmer hardware.
For more information on the structure and waveform of the I2C_Write (address, size, data[])
Read/Write I2C transactions, see Appendix B: I2C Protocol - I2C_Read (address, size, OUT data[])
Packets and Signals on page 31.
where the address, size, and data[] parameters have the
same meaning as in the corresponding I2C_Read and
3.5 Pseudocode I2C_Write transfer commands (see Table 3-3). The upper-
layer APIs automatically check all ACKs of current transac-
The programming flow consists of numerous I2C_Read and
tion and return a single status via its name. These APIs help
I2C_Write transfer commands, with multiple status acknowl-
to keep the programming script concise. The following are
edgement bits that must be checked every time. It is conve-
some usage examples:
nient to wrap them up in new procedures. This document
uses easy-to-read pseudocode to show the programming BYTE[3] data = {0x07, 0x25, 0xAF}
algorithm.
I2C_Write( 0x04, 3, data)
The following two commands are used for the programming
BYTE[10] data; //reserve 10 bytes
script:
I2C_Read ( 0x04, 10, OUT data)
The defined Write and Read pseudo-commands must be successful if they return the ACK status for every written byte. For
Read transactions, this is the ACK of only the address byte, but for the Write transaction address and all data bytes, it must
be ACKed. If at least one byte is NACKed, the transaction is treated as failed. In this case, depending on the programming
context, the process must be terminated or the transaction tried again.
The following is the implementation of Write/Read pseudo-commands based on hardware access commands (Table 3-3):
bool I2C_Write (address, size, data[])
{
BYTE ackAddr;
BYTE[size] ackData; //reserve space for status bytes of data
//1 bit is sufficient for 1 ACK
//This implementation uses byte to store 1 ACK bit
I2C_WriteTransfer (address, size, data[], OUT ackAddr, out ackData);
// Check ACKs of address and data bytes (ACK = 0x00, NACK = 0x01)
If (ackAddr != 0x00) Return FALSE; //NACK
For (BYTE i = 0; i < size; i++)
{
If (ackData[i] != 0x00) Return FALSE; //NACK
}
Return TRUE; //all ACKed
}
The programming code in Chapter 4: Programming Algorithm, will be based mostly on the I2C_Write/Read pseudo-com-
mands and some commands from Table 3-3.
This chapter describes the programming flow of the The external programmer puts parameters into the volatile
CY8CMBR3xxx device. It starts with a high-level description memory and requests a system call, which, in turn, performs
of the algorithm and then describes every step using the flash updates.
pseudocode. All programming script is made up of hardware
Figure 4-1. High-Level Programming Flow of
access commands (see “Hardware Access Commands” on
CY8CMBR3xxx Device
page 14).
Atomic I2C_Read/Write() APIs from “Pseudocode” on
page 14. They are middle-level APIs. START
High-Level subroutines, which wrap up atomic
I2C_Read/Write() APIs. They make up ~ 90% of the FAIL
whole script. See Subroutines used in Programming Step 1. Acquire Chip
Flow. PASS
PASS
4.1 High-Level Programming
Flow Step 5. Release Chip
PASS / FAIL
Figure 4-1 shows the sequence of steps that must be exe-
cuted to program the CY8CMBR3xxx device. These steps FINISH
are described in the following sections. All of the steps in
this programming flow must be completed for a successful
programming operation. The programmer should stop the
programming flow if any step fails. In addition, in pseudo- 4.2 Subroutines used in
code, it is assumed that the programmer checks the status
of each I2C transaction (I2C_Write, I2C_Read, WritePacket,
Programming Flow
ReadPacket). This extra code is not shown in the program- The programming flow includes some operations that are
ming script. intensively used in all the steps. Eventually, the program-
If any of these transactions fails, you must abort program- ming code will look compact and easy-to-read and under-
ming. To abort, execute Step 5 – Release Chip, which exe- stand. Besides that, most registers and frequently-used
cutes the opposite actions of Step1. It ensures that the constants are named and referred to from the pseudocode.
programmer and the target are left in the known state after
programming is stopped (upon PASS or FAIL).
Subroutine Description
bool WritePacket( address, This subroutine wraps I2C_Write() API from the “Pseudocode” on page 14. It keeps sending
size, the same I2C write request until it is ACKed. If the CY8CMBR3xxx does not respond
data[] ) (NACKs), then the master has to poll it for some time.
bool ReadPacket( address, This subroutine wraps the I2C_Read()API from the “Pseudocode” on page 14. It keeps send-
size, ing the same I2C read request until it is ACKed. If the CY8CMBR3xxx device is unresponsive
OUT data[]) on the I2C bus, the master has to try sometimes.
The implementation of these subroutines follows. It is based on page 14 and “Hardware Access Commands” on page 14.
on the pseudocode and registers defined in “Pseudocode” It uses the constants defined in this chapter.
// “ReadPacket” Subroutine
bool ReadPacket (address, size, OUT data[])
{
bool ack;
for (i = 0; i < 20; i++)
{
ack = I2C_Read(address, size, OUT data[]);
if (ack) // ACK
{
return TRUE ;
}
}
return FALSE; // NACK
}
START
NO
ACKed ?
YES
NO
ACKed ?
YES
Detected_Address = Verify_Address
NO
Timeout >= 3 sec
Return FAIL
I2C_ADDR == NO
Detected_Address
YES
Do
{
ack = ReadPacket (Program_Address, 1, out data);
If (ack == ACK)
{
Detected_Address = Program_Address; // to be used in Steps 2,3
break;
}
}
While (time_elapsed < 3 sec);
Return PASS;
//------------------------------------------------------------------------------
START
Chip Device ID == NO
Hex Device ID ?
Chip Family ID == NO
Hex Family ID
YES
IF (HexID[2] != data[0])
Return FAIL;
Return PASS;
//------------------------------------------------------------------------------
START
NO
If Error Code == 0x00 ?
YES
Return PASS
return PASS;
The verification process starts from reading device configurations from the chip and compares it with the corresponding hex
data. If there are any differences, the programmer must stop and return fail. The programmer reads the new data not directly
from flash, but from the same volatile buffers that were used during programming (see Figure 2-2 on page 8). New flash data
was automatically loaded there at the end of the programming step. This data must be identical to the flash's content, since
"nobody" tried to change it between the Program and Verify steps.
START
YES
Verify_Address = HEX_GetVerifyAddr();
return PASS;
It is recommended to call this step at the end of the programming flow and even after failed steps. Therefore, we can ensure
that in the end, the device is in the known state.
This step is optional and does not generate any I2C traffic, but guarantees that the programmer and the target are left in the
known state at the end of programming.
return PASS / FAIL; // this method should return result of previous Steps,
// which actually executed real “programming”
//-------------------------------------------------------------------------------
The Intel hex file records are a text representation of the hexadecimal-coded binary data. Because only ASCII characters are
used, the format is portable across most computer platforms. Each line (record) of the Intel hex file consists of six parts as
shown in the following figure.
1. Start code: One character - an ASCII colon ':' For the sake of readability, "Record type" is highlighted in
2. Byte count: Two hex digits (1 byte) – specifies the num- red and the 32-bit address of the Metadata section is in blue.
ber of bytes in the data field.
The first record (:0200000490501A) is an extended linear
3. Address: Four hex digits (2 bytes) – a 16-bit address at address record as indicated by the value in the Record Type
the beginning of the memory position for the data. field (04). The address field is 0000 and the byte count is 02.
4. Record type: Two hex digits (00 to 05) - defines the type This means that there are two data bytes in this record.
of the data field. The record types used in the hex file These data bytes (9050) specify the upper 16-bit address of
generated by Cypress are as follows: the 32-bit address metadata section in the hex file's space.
a. 00 - Data record, which contains the data and 16-bit In this case, all the data records that follow this record are
address. assumed to have their upper 16-bit address as 0x9050 (in
b. 01 - End of file record, which is a file termination other words, the base address is 0x90500000). The ‘1A'
record and has no data. This must be the last line of byte is the checksum byte for this record:
the file; only one is allowed for every file.
0x1A = 0x100 - (0x02+0x00+0x00+0x04+0x90+0x50)
c. 04 - Extended linear address record, which allows
full 32-bit addressing. The address field is 0000, the The next record (:07000000010137370A009AE5) is the
byte count is 02. The two data bytes represent the data record, as indicated by the value in the Record Type
upper 16 bits of the 32-bit address, when combined field (00). The byte count is 07, meaning that there are only
with the lower 16-bit address of the 00 type record. 7 data bytes in this record (010137370A009A). The 32-bit
5. Data: A sequence of 'n' bytes of the data, represented by starting address for these data bytes is at address
2n hex digits. 90500000. The upper 16-bit address (9050) is derived from
6. Checksum: Two hex digits (1 byte), which is the least the extended linear address record in the first line; the lower
significant byte of the two's complement of the sum of 16-bit address is specified in the address field of this record
the values of all fields except fields 1 and 6 (Start code ':' as 0000. The ‘E5' byte is the checksum byte for this record.
byte and two hex digits of the Checksum).
The last record (:00000001FF) is the end of file record, as
Examples for the different record types used in the hex file indicated by the value in the Record Type field (01). This is
generated for the CY8CMBR3xxx device are as follows: the last record of the hex file.
Consider that these three records are placed in consecutive Note The data records of the following multi-bytes region in
lines of the hex file (Meta Data and End of Hex File). the hex file are in big-endian format (MSB byte in the lower
:0200000490501A address): Checksum data at address 0x9030 0000 and
:07000000010137370A009AE5 Meta data at address 0x9050 0000. The data records of the
rest of the multi-byte regions in the hex file are all in the lit-
:00000001FF
tle-endian format (LSB byte in lower address).
The I2C interface is a packet-based serial transaction protocol and at the pin level, uses one bidirectional data line (SDA) and
one clock connection (SCL). Generation of clock signal on the I2C bus is always the responsibility of the master devices. Bus
clock signals from the master can only be altered when they are stretched by a slow slave device holding down the clock line,
or by another master when arbitration occurs. A complete data transfer on the I2C bus (one packet) consists of five phases:
Start Condition – this signal initiates packet transfer. It is HIGH to LOW transition on the SDA line while SCL is HIGH.
The bus is considered to be busy after the START condition. Therefore, no other master will try to access the bus while it
is busy. The bus is considered to be free again after the STOP condition is generated.
Address – the 7-bit address is sent by the master to establish connection with the necessary slave device.
R/W Bit – using this bit, the master informs the slave about the type of transaction - Read or Write.
Data Block – This is the actual data transferred between the master and slave. It must be at least 1-byte long and the
number of bytes for each transfer is unrestricted. The granularity of the data is 8 bits and it is transferred from the master
to slave (Write) or from the slave to master (Read) depending on the R/W bit.
Stop Condition – this signal ends the packet transfer. It is a LOW to HIGH transition on the SDA line while SCL is HIGH.
The timing diagrams of the I2C transfer are shown in the following figure. This diagram is common for Read and Write trans-
fers.
SDA
SCL
STOP
START ADDRESS R/W ACK DATA ACK DATA ACK condition
condition
data transferred
‘0’ (write) (n bytes + acknowledge)
data transferred
(read) (n bytes + acknowledge)
SDA
SCL
Revision History
Document Title: CY8CMBR3xxx Device Programming Specifications
Document Number: 001-89944
Origin of
Revision ECN# Issue Date Description of Change
Change
** 4184417 11/06/2013 ANDI / LIRA New specification.
Remove CALC CRC and SAVE_CALC_CRC commands related information in all instances across the
document.
*A 4287776 02/21/2014 ANDI / LIRA Updated Required Data chapter on page 7:
Updated “Nonvolatile Subsystem” on page 7:
Updated Figure 2-1.
Updated Programming Algorithm chapter on page 17:
Updated “High-Level Programming Flow” on page 17:
Updated description.
ANDI /
*B 4329537 04/01/2014 Updated “Step 1 – Acquire Chip” on page 20:
VVSK
Updated cross-references.
Updated “Step 3 – Program Flash” on page 24:
Updated Pseudocode.
Updated Communication Interface chapter on page 9:
Updated “I2C Interface” on page 9:
*C 4426483 06/30/2014 ANDI / BVI Updated Figure 3-2.
Updated “Physical Layer” on page 10:
Updated Figure 3-3.
Updated Programming Algorithm chapter on page 17:
*D 4959044 10/12/2015 ANDI Updated “Step 3 – Program Flash” on page 24:
Updated Figure 4-4.
Updated to new template.
*E 5532573 11/25/2016 STPP
Completing Sunset Review.
*F 5709691 04/24/2017 AESATMP8 Updated logo and Copyright.
Updated “Step 3 – Program Flash” on page 24
*G 6593652 06/13/2019 TAMX
Updated copyright