Bailey O.H.Embedded systems.Desktop integration.2005
.pdf
400 |
Chapter 10 / The PSoC Prototype |
|
|
program something that will damage components or hardware. Enough said! Let’s take a look at this remarkable chip.
The PSoC Design Process
By technical definition the PSoC is a configurable mixed-signal array that integrates the microcontroller and related peripheral circuits typically found in an embedded design. This translates to two words — reduced components. The idea here is by defining the peripheral components into the PSoC, fewer parts will be needed for the finished circuit. From my experience I’ve found the PSoC can reduce support components by up to 30% depending on the circuit function. This will translate to smaller circuit boards and reduced manufacturing costs so the PSoC, if used wisely, will pay for itself. This information is very important since it affects the design process. This means a little extra care of the hardware design and a thorough review of the hardware should be done just before or after the first prototype is designed. To take advantage of the cost saving features of the PSoC means going through two or more iterations of the design to eliminate components and costs. This is the only way the PSoC can be utilized to its fullest capability.
The PSoC Designer
The PSoC Designer is very similar in appearance and functionality to the dsPIC designer. The difference is that the PSoC Designer is the only development tool required to develop, debug, and program the PSoC parts. Using the Designer the developer uses the following process to develop the hardware.
402 |
Chapter 10 / The PSoC Prototype |
|
|
up to 32 K of flash memory, up to 2 K of static RAM, an 8x8 multiplier, 32-bit accumulator, built-in power and sleep monitoring functions, real-time clock, and built-in I2C communications processor. The PSoC uses a superset of the Intel 8051 instruction set.
PSoC Assembly Language
The PSoC assembler is built into the PSoC Designer. When creating a new project, the developer may create a new project from a template, create a new project from an existing project, or create a new project from an existing component definition. If Assembly is the language of choice, then once the project is created, all the necessary header and include file stubs are available and ready to have block definitions inserted. If the developer chooses to use the assembler, then no further tools or investment is required.
The PSoC C Compiler
As an option the developer may choose to purchase the PSoC C compiler. The C compiler is actually provided by ImageCraft exclusively for the PSoC Designer. This is very inexpensive, at around $145, and is activated by simply typing a code into the PSoC Designer. If the C compiler is available, the developer has the choice of starting a project in assembler or C. Even if C is chosen as the primary language, inline assembler can be used and external assembler object files can be linked.
406 |
Chapter 10 / The PSoC Prototype |
|
|
The EZ-USB Chip
To complement the PSoC we will also be introducing the EZ-USB chip, also from Cypress MicroSystems. In past chapters we used the FTDI-based DLP-Design USB interface, and the PICKit 1 and PICDEM USB from Microchip. So the first question we need to ask is how the EZ-USB differs from the prior devices. It differs in two ways. First, EZ-USB can be fully programmed on the fly, that is to say, upon USB initialization. So how does this compare to the other devices? Well, the FTDI-based products have limited ability to do custom programming since they are USB-to-RS-232 converters. Aside from a vendor and product ID there is little that can be added in the way of programmability. The PICKit and PICDEM USB are fully programmable devices; however, the PIC 16C745/16C765 series is EPROM based, which means the device cannot be electrically erased. The 18F4550 chips in the PICDEM USB 2 product are flash based, which makes them similar to the EZ-USB. Again, however, the boot code for the USB chips from Microchip must be present at boot or initialization time.
EZ-USB differs because upon EZ-USB initialization the device actually boots twice. The first boot is a generic USB device that then loads personality-specific code. This is actually a second boot process that when completed will have a fully functional USB device. This allows the secondary boot code to be updated while the device is running and then restarted with bug fixes or new features in place. The EZ-USB development kit contains everything needed to develop including a C compiler. This compiler, however, is from Keil Systems and not ImageCraft, so there are differences in both the compiler and development environment. Figure 10-6 shows the EZ-USB development board.
408 |
Chapter 10 / The PSoC Prototype |
|
|
Using the PSoC Designer
The PSoC Designer integrates visual development, code development, debugging, and programming into a single interface. The actual code listings for the finished thermostat are available at www.wordware.com/files/embsys and www.time-lines.com, but let’s design the functionality of our part in this chapter. We will use the PSoC Mini-Programming kit for this exercise. This device is seen as a CY8C27443 PSoC. This device operates at
24 mHz (the same as the dsPIC) and has 16 K of program memory available.
Programming this device is a two-step process. First we develop the code within the PSoC Designer, and then download the code to the device. Later we will attach the in-circuit emulator (ICE) to our board and do real-time debugging. Let’s start by designing our PSoC-based circuit.
1.From the Windows Start menu choose Cypress MicroSystems | PSoC Designer. A screen that looks similar to the following will appear.
