Silicon ChipProgrammable Systems on a Chip (PSoC) - March 2013 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Wind farms are now recognised as a serious health issue
  4. Feature: Oscium Test Instrument Add-Ons For The iPad by Nicholas Vinen
  5. Project: High Performance CLASSiC DAC; Pt.2 by Nicholas Vinen
  6. Project: Infrasound Detector For Low Frequency Measurements by Allan Linton-Smith & Ross Tester
  7. Feature: We Test Some New Hearing Aids by Ross Tester
  8. Project: Automatic Points Controller For Model Railways by Jeff Monegal
  9. Project: Capacitor Discharge Unit For Twin-Coil Points Motors by Jeff Monegal
  10. Project: Control Relays Via The Internet With Arduino by John Boxall
  11. Feature: Programmable Systems on a Chip (PSoC) by Nicholas Vinen
  12. Project: AAA-Cell LED Torch Driver by John Clarke & Ross Tester
  13. Vintage Radio: Seyon 2D 2-valve "wireless" and an old single-valve receiver by Rodney Champness
  14. Subscriptions
  15. PartShop
  16. Order Form
  17. Market Centre
  18. Advertising Index
  19. Outer Back Cover

This is only a preview of the March 2013 issue of Silicon Chip.

You can view 20 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "High Performance CLASSiC DAC; Pt.2":
  • CLASSiC DAC main PCB [01102131] (AUD $20.00)
  • CLASSiC DAC revised main PCB [01102134] (AUD $25.00)
  • dsPIC33FJ128GP306T-I/PT programmed for the CLASSiC DAC v1.02 [0110213B.hex] (Programmed Microcontroller, AUD $25.00)
  • Red & White PCB-mounting RCA sockets (Component, AUD $4.00)
  • SMD parts for the CLASSiC DAC (Component, AUD $80.00)
  • CLASSiC DAC front & rear panels [01102132/3] (PCB, AUD $20.00)
  • Firmware for the CLASSiC DAC [0110213B.HEX] (Software, Free)
  • CLASSiC DAC main PCB pattern (PDF download) [01102131] (Free)
  • CLASSiC DAC front and rear panel PCB patterns (PDF download) [01102132/3] (Free)
  • CLASSiC DAC front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • High Performance CLASSiC DAC; Pt.1 (February 2013)
  • High Performance CLASSiC DAC; Pt.1 (February 2013)
  • High Performance CLASSiC DAC; Pt.2 (March 2013)
  • High Performance CLASSiC DAC; Pt.2 (March 2013)
  • High-Performance CLASSiC DAC; Pt.3 (April 2013)
  • High-Performance CLASSiC DAC; Pt.3 (April 2013)
  • High-Performance CLASSiC DAC; Pt.4 (May 2013)
  • High-Performance CLASSiC DAC; Pt.4 (May 2013)
Items relevant to "Infrasound Detector For Low Frequency Measurements":
  • Prechamp: 2-Transistor Preamplifier PCB [01107941] (AUD $5.00)
  • Champ: Single Chip Audio Amplifier PCB [01102941] (AUD $5.00)
Items relevant to "Automatic Points Controller For Model Railways":
  • Automatic Points Controller PCB [JWM-0812/09103131] (AUD $15.00)
  • "Frog" Relay PCB [09103133] (AUD $5.00)
  • TCRT5000 Reflective Optical Sensor (Component, AUD $2.50)
  • Automatic Points Controller PCB patterns (PDF download) [09103131-2] (Free)
  • Frog Relay PCB pattern (PDF download) [09103133] (Free)
Items relevant to "Capacitor Discharge Unit For Twin-Coil Points Motors":
  • Capacitor Discharge PCB for Twin-Coil Points Motors [09203131] (AUD $7.50)
  • Capacitor Discharge Unit (CDU) PCB pattern (PDF download) [09203131] (Free)
Items relevant to "AAA-Cell LED Torch Driver":
  • AAA LED Torch Driver PCB [16102131] (AUD $5.00)
  • AAA-Cell LED Torch Driver PCB pattern (PDF download) [16102131] (Free)
Programmable Systems on a Chip Microcontrollers, Digital Signal Processors (DSPs) & Field Programmable Gate Arrays (FPGAs) have collectively revolutionised much of the electronics industry. There would be no such thing as a $300 100MHz Digital Signal Oscilloscope without these ICs. Cypress Semiconductor are taking the next logical step with their ingenious Programmable Systems on a Chip. Let’s see what they have to offer. I F YOU’VE BEEN regularly reading our project articles, you will have seen just how many of them are built around a microcontroller (or a digital signal controller, which is a micro with DSP instructions). Clearly, those circuits are much simpler and more capable than we could have made them with just discrete componentry and the development time is often much shorter too. And while SILICON CHIP has not published any circuits which use FPGAs or their poor cousins, Complex Programmable Logic Devices (CPLDs), they are used widely in commercial electronic gear when a microcontroller just isn’t powerful enough. For example, crack open just about any DSO, from a budget $300 model up to those in the $10k+ price range, and you will likely find several FPGAs responsible for tasks such as interfacing with the high-speed ADCs, driving the LCD panel and so on. FPGAs fill the gap between micro­ controllers and custom logic ICs (also known as Application-Specific Integrated Circuits or ASICs). ASICs 74  Silicon Chip have a large development and set-up cost which only pays off when you’re building tens of thousands of units or more. In many cases, a product can be brought to market more quickly and sometimes more cheaply by using configurable logic devices. In fact, it’s even possible to load one or more “soft cores” into an FPGA, yielding virtual microcontrollers which can be customised to suit the task at hand and surrounded by purpose-designed “glue” logic, all in one neat IC package. These soft cores can range from basic 8-bit jobs to fullon 64-bit multi-core microprocessors, given a sufficiently powerful FPGA. Some FPGAs also come with built-in microcontrollers since this is such a common need and it saves money and board space. What about analog? Of course, most microcontrollers and some FPGAs can interface to the analog world too, through analog-todigital converters (ADCs), digital-toanalog converters (DACs) and other peripherals such as built-in compara- By NICHOLAS VINEN tors. For DSPs, interfacing with analog systems is effectively their raison d’etre and so they generally have dedicated interfaces to communicate with DACs and ADCs. Yet it’s still common to surround microcontrollers with a host of analog parts like op amps, filter stages, instrumentation amplifiers and so on, in order to effectively connect them to the “real world” of sensors, transducers, audio and so on. A fair few circuits are little more than a microcontroller and a series of analog ICs and associated passives; the microcontroller “does it all” from the digital perspective but usually only has fairly basic internal analog circuitry. This is starting to change though. There are now Microchip PICs with built-in op amps, such as the PIC­ 16F527, PIC16F1782 and most of the dsPIC33E/PIC24E series. There are also now some microcontrollers with fairly capable onboard DACs/ADCs (eg, up to 16-bit resolution). Clearly, microcontroller manufacturers are realising that with better analog interface circuitry, designers can save siliconchip.com.au space and money by not needing so many external interface chips. Some micros now also contain some basic Configurable Logic Cells, such as the PIC16F150X. These are akin to small CPLDs and while they are only powerful enough to eliminate a few external discrete logic chips (eg, 74HCs), ultimately we hope to see this sort of feature grow to the point where you can “roll your own” digital interface circuitry within the microcontroller, rather than just settle with the modules that the manufacturer decides to provide. Enter the PSoC Cypress have taken both of these concepts – integrating additional analog circuitry and configurable logic – and run with them. They call the result a “Programmable System on a Chip” and that is quite an accurate description. Essentially what you get is a single IC that contains a powerful ARMbased microcontroller, a boost regulator, a small LCD driver, capacitive touch-sense circuitry, programmable logic blocks, a USB transceiver, timers and PWM units, an accurate voltage reference, three high-speed ADCs, four DACs, four comparators, four op amps, configurable multi-function analog blocks, crystal oscillators and PLLs, debug support and the “glue” that you need to tie it all together into a working circuit. Taking a step back, you can look at it slightly differently. Effectively, the PSoC is an ARM (Advanced RISC Machine) microcontroller with all the usual peripherals, teamed up with the 20-24 configurable logic blocks and all the various analog and analog/digital circuitry, with a series of multiplexers allowing the interconnections between the various units to be programmed in. So essentially you have most of the building blocks of a complete digital/analog circuit in a single package. Analog circuitry Because the analog circuitry is the most unusual part of the PSoC, let’s have a look at what it comprises and what you could potentially do with it. First, the voltage reference. It is necessary to have a good voltage reference if you are to use an ADC to accurately measure DC voltages (or for that matter, AC). Most microcontroller references siliconchip.com.au This PSoC5 is the first series of “Programmable Systems on a Chip” to use an ARM microcontroller core. The window in the background shows the graphical interface used to configure the chips. are disappointing, with a typical accuracy (incorporating both factory trim error and temperature drift) of around ±5%. Compare this to the PSoC5’s reference which is 1.024V ±0.1%! As well as being used as the reference for the ADCs and DACs, this can also be routed to the other analog circuitry (eg, comparators and op amps) to set thresholds, provide a DC bias and so on. Each PSoC5 chip has one differential delta-sigma ADC which can be set to have a resolution between eight bits and 20 bits, with a resolution/ speed trade-off. For example, it can be set to 8-bit/384ksps, 12-bit/192ksps, 16-bit/48ksps and 20-bit/187ksps. With its good linearity, this makes it suitable for use with general analog signals, audio or for precise DC measurements. There are two additional singleended/differential successive approximation (SAR) ADCs, more typical of those found in microcontrollers but slightly more capable, being able to sample at the full 12 bits up to 1MHz. The four built-in DACs have 8-bit resolution and can give either a voltage (1Msps) or current (8Msps, source or sink) output. They have programmable upper and lower voltage limits. Op amps & comparators There are four comparators and the inputs of each are connected to one of the internal analog buses and thus may come from a GPIO pin, the output of an internal op amp, the voltage reference, one of the filter blocks, one of the DACs, configurable analog blocks (more on them later), etc. The outputs of the comparators are fed to a series of look-up tables (LUTs), allowing a pair of comparators to be used as a window comparator for example. The resulting state is then fed to the microcontroller and/or the configurable logic blocks. The inputs for the four op amps can be connected either to a GPIO pin or to one of the internal analog buses. The outputs of all four drive a specific GPIO pin but these pins can also be connected to an internal analog bus, to feed the op amp output back into the system if necessary. Also, each op amp can be switched to buffer mode, therefore requiring only one input to be connected. Configurable analog blocks This is one of the more powerful parts of the system. There are four “switched capacitor/continuous time” (SC/CT) units which can be configured to operate in a number of ways. These include: op amp, unity-gain buffer, programmable gain amplifier (PGA), transimpedance amplifier, up/down mixer, sample and holder filter and analog-to-digital modulator. The unity gain bandwidth of the SC/CT units is 6MHz and when used March 2013  75 This CY8CKIT-010 development board has an onboard PSoC5 chip (other side of PCB) and can be used to evaluate this chip and also develop and test circuits based around it. It also comes with Windows software and documentation. as programmable gain amplifiers, the gain can be set in the range of -49 to +50. They can work with internal or external signals (via a GPIO pin). When used as transimpedance amplifiers, the SC/CT units convert voltage into current with a selectable gain of between 20V/mA and 1000V/ mA. The output can also be offset by a reference voltage, fed into one of the block inputs from an external or internal source. When an SC/CT unit is used as an up-mixer, the two input frequencies can be up to 1MHz. When used as a down-mixer, the input signal can be up to 14MHz and the output up to 4MHz. When configured as a modulator, the SC/CT unit can be used to help build a very accurate low-frequency ADC system, suitable for measuring the output of strain gauges, thermocouples and so on. These configurable blocks are most useful for those and similar measurement applications however they could also be useful for other tasks. For example, PGAs are useful in any situation where you want to digitise a signal with a wide dynamic range as they can be placed in front of an ADC and therefore allow its effective full-scale voltage to be dynamically adjusted. Power efficient design One of the main focuses of Cypress’ PSoC series appears to be power efficiency and the PSoC 5 has a number of features which allows the power consumption to be adjusted between a very low level, for applications which require it, and a higher level where more processing power is required. 76  Silicon Chip The internal synchronous boost regulator mentioned earlier is a particularly nice feature. It will operate with an input voltage as low as 0.5V! That means that the whole systemon-a-chip can be run from a single alkaline or NiMH cell with very few additional components. It can even be used if you are not running from a battery, eg, if you want to run the chip from a 1.8V supply but need 3.3V for some other purpose (eg, to drive an LCD), it can produce that too. Also, the whole system will run with a supply voltage from 1.8-5V meaning that you only need to boost that single cell voltage up to 1.8V, minimising wasted power. The system can also run directly from a single LiIon or LiPoly cell. The PSoC5 core runs at 1.8V, regardless of the I/O voltage (as mentioned, it can be up to 5V). This is achieved via internal 1.8V regulators. There are several, as different ones are used during normal operation, sleep and hibernate modes (the latter two having very low quiescent currents). There is also a low-power 32.768kHz realtime clock and oscillator circuit for timekeeping which operates even in the power-down modes. Like many micros, the clock system and PLL are quite flexible and the micro’s clock rate can be varied to change power consumption depending on requirements and over time. Power saving is also possible in the analog circuitry. For example, the comparators can be set to fast, slow or ultra-low-power modes which give different trade-offs between speed and power consumption. Similarly, the op amps can be set to be slow, medium or fast. Because the analog circuitry can run from such low supply voltages (eg, 1.8V), virtually all the analog components have rail-to-rail inputs and outputs. The LCD driver is also designed to consume as little power as possible, for use in portable equipment. With all the circuitry on this chip, you’d expect its power consumption to be quite hefty when operating. But its quiescent current is just 3.1mA with the analog and digital units powered up and the microcontroller executing instructions at 6MHz. This means that with a 1.8V supply, the power consumption is just 5.5mW which is rather impressive. The power consumption will presumably rise when the chip is active and analog signals are being processed. Digital features There are some fancy features on the digital side of the chip, too. We’ve already mentioned the Universal Digital Blocks which, according to Cypress, are “a collection of uncommitted logic (PLD) and structural logic (Datapath)” and can be used to create all common embedded peripherals and customised ones too. They give some example peripherals you can build using these UDBs: I2C transceivers, UARTs, SPI (serial peripheral interconnect) transceivers, external memory interfaces, PWMs, motor control, timers, counters, logic (NOT/ OR/XOR/AND), cyclic re­ dundancy check (CRC) generators and so on. PLD stands for “Programmable Logic Device” and is a small chunk of configurable logic similar to the CPLDs and FPGAs mentioned earlier. The “Datapaths” each consist of an 8-bit arithmetic/logic unit (ALU), a FIFO queue (first-in, first-out), data registers, accumulators, barrel shifter and mask unit, plus routing and configuration. Clearly, combined with the PLD blocks, this is quite a powerful system for building the aforementioned types of digital circuits and more. The “Digital System Interconnect” (DSI) is used to route signals between the GPIO (external) pins, microcontroller I/Os, UDBs, interrupts, DMA and other systems. Digital filter block Then there is the Digital Filter Block (DFB) which is a DSP-like construct. siliconchip.com.au This can be used to implement Infinite Impulse Response (IIR) or Finite Impulse Response (FIR) filters. These are commonly used with oversampling ADCs and DACs to prevent aliasing and other undesirable artefacts when dealing with high-frequency signals. It can also be used to form digital notch, low-pass, bandpass, high-pass or arbitrary shape filters for general use. The DFB has a single-cycle 24-bit multiply/accumulator and can be used to generate up to a 64-tap FIR filter or four 16-tap FIR/IIR filters. Other features As if that was not enough, Cypress has added some other features to make the developer’s life easier. There are extensive debug and test interfaces including JTAG, Serial Wire Debug (SWD) and TRACEPORT. It also has several embedded debug and trace units plus the ability to re-flash itself using an I2C, SPI, UART or USB interface. So that the chip can interface with other external circuitry easily, it’s possible to run some pins at a certain I/O voltage level (say, 3.3V) while others can operate at 1.8V or 5V. In fact there are four VDDIO pins which can all run at different voltages in the range of 1.85V and they control separate banks of digital I/O pins. The USB interface can run from an internal oscillator, saving a crystal and associated components, if desired. Some PSoC5 chips also have a CAN (Controller Area Network) interface built-in. Plus all these chips support “Capsense” which means that you can implement capacitive touch pushbuttons with no external components but just use PCB traces. Limitations This all sounds very clever and it seems that you could build quite a powerful signal acquisition and processing system using a PSoC 5 chip and little else. But there are some disadvantages compared to discrete solutions. For a start, the internal analog multiplexing inside the PSoC chip adds significant series resistance to the signal paths. There are two types of internal analog switches, small and large, with a nominal on-resistance of 870Ω and 200Ω respectively. This can affect the accuracy of gain set by external resistors and requires careful design so that this resistance doesn’t interfere with filter constants or other operating par­ ameters of the system being designed. Then there’s the cost. A PSoC5series chip starts at around $14 (64KB flash, 16KB RAM, 64 pins) and the more powerful versions are around the $35 mark (256KB flash, 64KB RAM, 100 pins). However when you consider how many additional chips you might need to perform the same task and how much PCB area will be saved, those prices start looking quite reasonable, even when you consider that a similarly powerful microcontroller (ignoring all the analog magic) costs around $3. Another possible drawback is the fact that the 67MHz Cortex-M3 32-bit processor in the PSoC 5 is nowhere near as powerful as a proper DSP chip. However, that is partially mitigated by some of the features of the PSoC5 which reduce the amount of work the processor must do, such as the digital filter block. Still, in many applications, a powerful DSP is what you need. One option may be to team the two together, using some Universal Digital Blocks to form a high-speed interface for data exchange. For comparison, a 200MHz Blackfin DSP starts at around $6 and 400MHz at around $9. Then again, DSPs are (currently) much higher volume chips than the relatively new PSoCs. Perhaps, given time, that will change. We certainly like the idea of being able to do for analog processing what FPGAs can in the digital realm. Getting into PSoC If you’re interested in trying out the PSoC series of chips, there are some evaluation boards available. The CY8CKIT-010 is a small PSoC5 development board which comes with Windows software and documentation. This kit costs $60-$90 and is available from element14, Digi-Key and Mouser. There is also a more comprehensive (and expensive) development kit called CY8CKIT-001 which has an LCD, breadboard area and some other circuitry but its availability is limited. Useful links (1) General information: http://www. cypress.com/?rID=72824 (2) Data sheet: http://www.cypress. SC com/?docID=42375 Radio, Television & Hobbies: the COMPLETE archive on DVD YES! A MORE THAN URY NT QUARTER CE ICS ON OF ELECTR HISTORY! This remarkable collection of PDFs covers every issue of R & H, as it was known from the beginning (April 1939 – price sixpence!) right through to the final edition of R, TV & H in March 1965, before it disappeared forever with the change of name to EA. For the first time ever, complete and in one handy DVD, every article and every issue is covered. If you’re an old timer (or even young timer!) into vintage radio, it doesn’t get much more vintage than this. If you’re a student of history, this archive gives an extraordinary insight into the amazing breakthroughs made in radio and electronics technology following the war years. And speaking of the war years, R & H had some of the best propaganda imaginable! ONLY Even if you’re just an electronics dabbler, there’s something here to interest you. Please note: this archive is in PDF format on DVD for PC. Your computer will need a DVD-ROM or DVD-recorder (not a CD!) and Acrobat Reader 6 or above (free download) to enable you to view this archive. This DVD is NOT playable through a standard A/V-type DVD player. Exclusive to: SILICON CHIP siliconchip.com.au 62 $ 00 +$10.00 P&P HERE’S HOW TO ORDER YOUR COPY: BY PHONE:* (02) 9939 3295 9-4 Mon-Fri BY FAX:# (02) 9939 2648 24 Hours 7 Days <at> BY EMAIL:# silchip<at>siliconchip.com.au 24 Hours 7 Days BY MAIL:# PO Box 139, Collaroy NSW 2097 * Please have your credit card handy! # Don’t forget to include your name, address, phone no and credit card details. BY INTERNET:^ siliconchip.com.au 24 Hours 7 Days ^ You will be prompted for required information March 2013  77