Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Application Note

Application Note

Ratings: (0)|Views: 16|Likes:
Published by tuandt2_1415

More info:

Published by: tuandt2_1415 on Mar 16, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





 7/19/2004 Revision A - 1 -
Application Note AN2134
PSoC Programmer 
: Alessandro Molini
Associated Project
: Yes
Associated Part Family
: CY8C26xxx
PSoC Designer Version
: 4.2
Associated Application Notes
: AN2014, AN2026
This Application Note describes a simple programmer for the PSoC
With this Application Note, I want to help thebeginner and the professional programmer in thePSoC world with a simple, economic tool for Flash programming. This tool allows one PSoC-based device to serve as a programmer for other PSoC-based devices. The ICE-4000 In-circuitEmulator is still necessary for debugging andprogramming the first device. However, small-scale, simultaneous production programming,and software development is possible.The heart of the project is a PSoC CY8C26443.The necessary hardware has been reduced to aminimum. The device sends clock, data in/outand Xres to the programming chip. Programmingis established through the PSoC serial COM portconnected to a MAX232. The download baudrate is fixed at 19200, N, 8, 1. The hardware iscomplete with a 5V stabilized power supply. Themain peripherals are inside the PSoC.
External Hardware
Figure 5 shows the CY8C26443 externalconnections. The programmer chip will beclocked at 24 MHz. Precautions should be takenfor the rigorous 5V power-supply connectionswith the programming chips, typically pre-assembled on the production board. As theEXECUTE MODE is planned for a clock at 2MHz, it is wise to keep the programming wires asshort as possible and insert serial resistances asspecified in Application Note AN2014“Design for In-System Serial Programming (ISSP).
TwoLEDs, green and red, will signal the programmingstatus as “in progress” or “in error.”
Operational Theory
The program flow follows the specifics outlined inApplication Note AN2026“In-System SerialProgramming (ISSP) Protocol”and is shown inFigure 1. For a better understanding of theprocedures used here, the reader is encouragedto review the material contained in AN2026.
Initialize Target ProcedureVerify Silicon ID ProcedureProgram ProcedureSecure ProcedureVerify ChecksumProcedure
Verify Procedure
Figure 1. Programming Flow
The programmer uses the reset signal, Xres, tobegin the start procedure. Hardware andsoftware changes allow modification of thisapplication with the Power-On-Resetprogramming (the essential cycle for the smaller devices, CY8C25xxx).
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.
Internal Hardware
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.
EXECUTE Procedure
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[4] 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[4]
Figure 3. P0[4] 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
AN21347/19/2004 Revision A - 3 -
Control Software
Operation does not require any particular download procedures. Any serial communicationprogram can handle the download procedureswithout problems. The required baud rate shouldbe at 19200, N, 8, 1. The start condition isrealized through the dispatch of any ASCIIcharacter through the serial port. After this, adelay of about 50 mS is needed for theprogrammer to initialize the target. Then the Hexfile can be transmitted.The programming result is displayed by theLEDs. When programming is successful, thegreen LED lights. If programming is notsuccessful, the red LED lights.A small Visual Basic application developed tooperate the programmer has been attached. Thesoftware does not have any controls. When theProgram button is clicked, a File Open dialog boxappears. Select the .hex file to be programmedand click OK. The chip will be programmed and amessage box will appear saying, "The Devicehas been Programmed." This message willappear even if the programming failed. This isbecause there is no feedback to the PC from theprogrammer about the result of the operation.
Figure 5. External Connections

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->