Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Bailey O.H.Embedded systems.Desktop integration.2005

.pdf
Скачиваний:
73
Добавлен:
23.08.2013
Размер:
9.53 Mб
Скачать

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.

Chapter 10 / The PSoC Prototype

401

 

 

Define

Analog / Digital

Block(s)

Define

Block Interface(s)

Develop

Associated Code

Test / Refine

Debug

Release

Figure 10-1

With this process the developer can make full use of the PSoC and continue to reduce support components until the PSoC is fully utilized. The PSoC Designer allows the developer to select configurable, precharacterized library elements to provide analog functions such as amplifiers, ADCs, DACs, filters, and comparators, and digital functions such as timers, counters, PWMs, SPI, and UARTs, and other digital communications processes. The PSoC analog performance is instrumentation-quality (including rail-to-rail inputs, programmable gain, 14-bit ADCs, and exceptionally low noise, input leakage, and voltage offset). In addition to these features the PSoC is also an 8-bit microcontroller, with

Chapter 10

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.

Chapter 10 / The PSoC Prototype

403

 

 

Available Hardware Development Tools

There are several hardware development tools available that range from an experimenter board to a complete in-circuit emulator system. The most expensive development kit is around $600, which includes a full in-circuit emulator. That is the PSoC Development kit, shown in Figure 10-2.

Figure 10-2

There is also the PSoC Basic Development kit, which sells for around $400. The PSoC Basic Development kit includes an in-circuit emulator, a variety of pods, the PSoC Designer software, and a small test board. It should be noted that this developer kit does not contain the C compiler, whereas the PSoC Development kit does.

Chapter 10

404

Chapter 10 / The PSoC Prototype

 

 

Figure 10-3

Next, there is the PSoC Evaluation kit, which contains an evaluation board and MiniProg programming unit. This kit contains everything needed to evaluate the PSoC, including a couple of sample parts. This kit sells for around $70 and does not include the C compiler.

Chapter 10 / The PSoC Prototype

405

 

 

Figure 10-4

And finally we have the PSoC Mini-Programmer kit, which includes a PSoC mounted on a DIP header, USB cable, and PSoC Designer software. This kit sells for about $40 and does not include the C compiler.

Chapter 10

Figure 10-5

The PSoC Mini-Programmer is also known as the PSoC experimenter board. In this chapter we will use both the PSoC Basic Development kit and the PSoC Mini-Programmer board.

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.

Chapter 10 / The PSoC Prototype

407

 

 

Figure 10-6

Development Strategy

Our development strategy for this chapter is a little different from prior chapters. We will first design the needed peripherals for the PSoC. We have options that will allow us to choose a hardware or software implementation of some of the functions. We will examine the pros and cons of hardware vs. software function implementation. Once we have the needed functions developed on the PSoC, we will write a short test program for testing I/O with each of the needed devices. This includes the 1-Wire interface, the 3-Wire (SPI) interface, TTL RS-232 interface, and the I2C interface. We will also cover programming the PSoC and using the in-circuit emulator.

The next step will be to implement the interface to the EZ-USB chip, debugging and testing as we go, and finally test the Ethernet interface to the NetBurner board, making any changes necessary to support the PSoC.

Chapter 10

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.

Chapter 10 / The PSoC Prototype

409

 

 

Figure 10-7

2. The options from this menu are: Start new project, Start the

Device Editor, Start the Code Editor, and Start a debugging

 

 

session. Press the Start new project button and the follow-

10

ing screen will appear.

Chapter

 

 

 

Figure 10-8

Соседние файлы в предмете Электротехника