Electronic Design

EiED Online>> Soft MCU Goes Graphical

PSoC is Cypress Semiconductor's mixed-signal controller that's based on an 8051 microcontroller. However, the PSoC is much more than just another hyper-powered MCU. Cypress surrounds the MCU with analog and digital blocks that can be configured in the same manner as an FPGA. Designers typically use blocks programmed from a standard set of peripherals, such as analog-to-digital converters (ADCs). PSoC chips are available with different combinations of analog and digital blocks. The system also includes standard peripherals.

The PSoC family has been around for a number of years with improvements in size, cost, and capacity. The original tool used to configure and program a PSoC was PSoC Designer. This tool is still available, but it takes a good bit of time and effort to become effective with it. In addition, many designs do not require the complexity available with PSoC Designer. This is where the new PSoC Express comes in.

The Good: PSoC Express
Okay, you have a simple set of design requirements. You need some buttons, a potentiometer, some LEDs, and a motor. The system needs to have an on/off button, and a PWM stream controls the motor. An analog feedback loop is available. How long will it take to create a microcontroller-based solution?

Take the conventional route and it will be at least a day to figure out what MCU will meet the requirements. Block out another week to get a demo board, wire up everything, and start programming.

The experienced PSoC developer pulls out PSoC Designer and takes a day to add standard components, logically wire up the chip, and start software development. It might take another day or two to iron out all the details.

The newbie grabs PSoC Express and has a system running in a couple hours. How? Well, PSoC Express (Fig. 1) provides access to the power of a PSoC chip, but hides the underlying details. The standard components like an ADC or pushbutton input are identical to those available with PSoC Designer, but PSoC Express limits developers' choices which allows PSoC Express to create the underlying code. I have used PSoC Designer in the past, but PSoC Express is a much different animal. I was able to build a simple system like the one just described in an afternoon while learning how to use the tool. I was very impressed.

The nice thing about PSoC Express is its simulation support. It allows a very complex system to be tested without hardware. A simulation can be interactive or driven by a predefined database contained in a standard spreadsheet.

I started my test project by adding the components I knew would be required: a PWM output, analog inputs and outputs, and some push buttons. It was then just a matter of linking the appropriate combination of peripherals together and finally adding the "transfer functions" using PSoC Express' dialog boxes.

The next step was to test the project. The interactive mode was easiest for this particular project, but a more complex simulation typically requires pulling out a spreadsheet. The interactive mode lets you use the mouse to change switch status and drag sliders to change analog inputs. Each component shows its current state, so it's very easy to see that a switch enables a particular action or a change in an analog input causes a change of one or more outputs. It actually takes more time to become familiar with the capabilities of the built-in devices.

The Bad: PSoC Designer
Okay, PSoC Designer is not really that bad, but its interface is complex compared to that of PSoC Express. Unfortunately, it must be complex to provide designers access to all the power of a PSoC MCU. It's not quite as bad as designing a system using something likeVerilog because PSoC can use standard modules, but you do get down to the level of dealing with signal routing through multiplexors and buses.

I fired up PSoC Designer (Fig. 2) to see what PSoC Express created. This is easy because PSoC Express generates a PSoC Designer project by default. It was just a matter of opening the project to reveal a rather complex system design. It would definitely take the average PSoC Designer developer a bit longer to create this system than it took with PSoC Express.

So, does this mean PSoC Express could be used by those PSoC Designer experts? Definitely. PSoC Express can generate standalone designs without having to resort to PSoC Designer, but PSoC Express can also be used to create a framework that can be further refined with PSoC Designer and custom programming.

One reason for taking this route is that PSoc Express' interface is a bit limited when it comes to programmability and custom signal routing. Many applications will require this level of customization.

And The Ugly: PsoC Express Interface
PSoC Express (Fig. 3) connects peripherals using a transfer function. It typically includes a set of conditionals based on constants and values from other peripherals. There is no sense of local variables or other programmable capabilities, but you can get a surprising amount of work done with this limited control structure. Cypress will continue to improve PSoC Express so more complex systems can be built using the graphical framework.

The ugly part of the interface is expected to improve in subsequent versions. For example, this first version of PSoC Express requires you to type in the conditions and result values for the control structures. A pop-up dialog box gives a list of available variables based on the currently placed peripherals, but you need to do the typing manually. Eventually these will be selectable so it will possible to just click on the desired variable.

Still, PSoC Express is such as major step forward that these rough edges can be overlooked. I look forward to the next major revision.

Getting Hardware
Of course, getting a design down to hardware is the ultimate goal. The PSoC Express development board (Fig. 4) provides an excellent platform for prototyping. It was a simple matter to plug in a servo for the test application.

The majority of the board is for customization. The lower left is where the MCU is located, and the single plug strip above it is connected to MCU pins. The other plug blocks are connected to hardware on the board, including switches, LEDs, an LCD display, control inputs, and the six headers across the top of the board.

I only used a fraction of the capabilities of the board for my project, but it's easy to see how this test bed can be used to prototype very sophisticated applications. It has support for SPI and I2C, and there is a fixed PSoC on the boad for additional peripheral support. Of course, thes MCU is programmable as well. The programming module (not shown) connects to the MCUs via headers on the board.

The bottom line is that anyone considering a PSoC-based design should check out the PSoC Express tool. It can be downloaded from the Cypress website and it is completely functional. Just use the simulator to check out your design.

By The Book
The conventional approach to mixed-signal programming is covered in a new book I just read by Moi Ten Chew and Gourab Sen Gupta entitled Embedded Programming with Field-Programmable Mixed-Signal uControllers. It covers the details of Silicon Labs' 8051-based C8051F020. The book is oriented towards a college-level course on MCU programming, and is essentially split between coverage of the C8051F020 and general embedded programming techniques.

The book is an invaluable tool for anyone using Silicon Labs' microcontrollers as well as anyone who can get their hands on one of the inexpensive demo boards. The C8051F020 takes the usual approach to mixed-signal systems by surrounding the 8051 with a fixed set of peripherals, including 12-bit ADCs and 8-bit DACs.

Related Links
Cypress Semiconductor
www.cypress.com

Silicon Labs
www.silabs.com

Embedded Programming book availability
www.mouser.com/silabs/

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish