AN21347/19/2004 Revision A - 2 -
Other essential characteristics are the accuracyand the stability of the frequency in EXECUTEMODE. In all other phases, the frequency andstability for the programming clock is notessential.
The PSoC internal hardware is shown in Figure2. The peripherals are a serial-synchronousMaster SPI to communicate commands and datato the programming chip, as well as anasynchronous serial receiver to receive the Intelhexadecimal program from a PC. A timer/counter produce a stable 2 MHz clock signal during theEXECUTE MODE.
Figure 2. User Module Placement
The software is separated into two sections: themain program written in C and the interruptroutine for asynchronous serial communicationwritten in assembly.The main C program covers the initialization andmanages iterations with the programming chip.The assembler interrupt section,
,manages the ASCII record sent from the PC,converts the record to binary, checks thechecksum and signals the correct reception tothe main C routine.
The most critical phase in the system isEXECUTE MODE in which the programmer mustsend an accurate and stable frequency of at least2 MHz to the device in order for the chip to beprogrammed.To activate the command previously sent by theSPI, the software switches pin P0 functionfrom SCLK, connected to the SPI, to CLOCK,connected to the ExecuteClock Counter (cntr8).This is shown in Figure 3. The software thenwaits for the answer with a low signal from thetarget chip, which is the signal from the targetthat the previously sent command has beencompleted.
SPICLOCK2 MHzClock OutP0
Figure 3. P0 Function Switch
The start of each procedure is the transmission of vectors represented by specific data, organizedin groups of 22 bits. See Figure 4.
Figure 4. Initialize 1 Vectors
The transmission through the SPI, rigorously at 8bits, is only possible by adding two 0 bits at thebeginning of each line. The resultant 24 bits willbe transmitted from the SPI in 3 transmissions.
Table1. Transmitted Bytes for Figure 4, Line 1.Byte 1 Byte 2 Byte 3
00110010 10000000 00000000