The LabRat:  Simplify PSoC Programming

DN Staff

January 11, 2010

6 Min Read
The LabRat:  Simplify PSoC Programming

The PSoC 3 First Touch Starter Kit gives users opportunities tolearn more about the Cypressprogrammable embedded system-on-chip, or PSoC. The PSoC 3 family provides awide array of internal capabilities and peripheral devices. But unlike mostmicrocontrollers (MCUs), the PSoC devices rely on internal programmable logicthat can place and route devices such as counters, timers, DMA channels andADCs. Some functions, such as 4- and 8-bit counters, already exist within aPSoC chip. The PSoC Creator tools create others as needed and implements themin Universal Digital Blocks (UDBs) of programmable logic. A single-cycle 8051core (67 MHz) provides the PSoC processor core.

You can find the data sheet for the CY8C3866AXI-040ES2 chip usedon the board here. To me, the success of the hardware dependsgreatly on the innovative PSoC Creator software that simplifies system designand programming. Click here for information, video tutorials and data sheets for the PSoC3 family.

I enjoyed working with this kit and except for the lack of aworkbook or reference manual for the PSoC Creator tools, it rates highly. I gave it a "4" rating for MeetsExpectations only because the kit lacks do-it-yourself projects or follow-onexercises. If you want to concentrate on solving problems rather than becomingenmeshed in the details of complicated functions and I/O ports, I highlyrecommend the PSoC chips and the PSoC Creator software.
Support for the Micrium uC/OS II and the Segger embOS shouldbecome active soon for the higher-end PSoC 5 family of devices that include an80-MHz ARM Cortex-M3 CPU rather than an 8051.

In addition to the PSoC chip, the board includes a CapSensetouch-sensor slider, a proximity sensor, eight LEDs, a thermistor, anaccelerometer, a USB interface and a push-button. The board communicatesdirectly with a host PC through a standard USB cable. The board can run from a9-V battery or from power through the USB cable. (Disconnect the battery afteryou use the board as a stand-alone device.)

Instructions on a one-page Quick Start Guide show how to connectthe board to the 9-V battery and rapidly wave the board back and forth todisplay a "rasterized" message - PSoC Rocks! - in the air as the LEDsturn on and off in response to the board's accelerometer signal. After I testedthe board, I printed the "PSoC 3 First Touch Starter Kit Guide"provided on the CD, and followed the steps to load the PSoC Creator and PSoCProgrammer software, and four sample projects. The first project opens the PSoCRocks! project folders and lets users easily change any of the six messages theboard will display and the duration of each message. At first I couldn't findthe kit files, but only because my lab PC had not completed installing them onmy Windows XP lab computer. Be patient when installing the software tools.

The PSoC Rocks! project worked as expected, and my modifiedmessage displayed "Lab Rat!" The Starter Kit Guide includes three otherprojects, a bubble-level emulator, a proximity sensor, and a CapSense slidercontrol. I skipped them because I wanted to learn how to use the PSoC Creatorsoftware and make up my own experiment.

The PSoC Creator software includes a schematic-capture-likescreen that lets developers select functional analog and digital buildingblocks such as timers, ports, clocks, UARTs, analog multiplexers, ADCs, DACs,and so on and move them into a TopDesign window. By using these blocks youavoid writing low-level code to control devices and I/O ports. The LED-displayproject, for example, contains three block; read the accelerometer's Y-axisvoltage, set up the accelerometer and output the 8-bit LED values. TheLED-output section uses graphical "wires" to connect an LED-controlport to a set of inverters and then to two ports of four LEDs each.

When I double clicked on a component, PSoC Creator opened aconfiguration window that let me set start-up and operating conditions. Eachconfiguration window also links to a data sheet that explained a component'soperation, its input and output signals, configuration information, theapplication program interfaces (APIs), how the APIs operate, and sample code.

I chose to create an 8-bit binary counter that would display itscount on the eight LEDs. But I couldn't figure out how to relate thebuilding-block schematic diagram with the code to do something useful. Anapplication person at Cypresssuggested I watch the video: "101 Introduction to the Architecture"that included a simple experiment that toggles an LED on or off based on aninternal time delay. That video helped and its associated project operated properly. But I stillneeded a hand with an 8-bit counter. To view the video and three others, click here.

Cypressdoesn't yet have step-by-step tutorials that explain how to do things with thePSoC Creator software and for that reason I rated the kit's documentation a"3." The examples in the Starter Kit Guide only have users duplicatesteps rather than solve given problems, with answers provided later.

So, I talked with a member of the PSoC Creator team at Cypress and he walked methrough a four-bit counter example. Based on his explanations, I quicklyextended the design to an eight-bit counter that evening. My online version ofthis review includes or points to a tutorial that explains the steps I used tocreate the 8-bit counter. You can use that explanation as a do-it-yourselfexperiment that links hardware and software. My compiled programs flowed to the target PSoC chip through the USBcable and I used debug functions to monitor chip and program actions. It feltgood to see the eight LEDs flash as expected for a binary counter.

Developing an application still requires writing C code. Theschematic approach eliminates difficulties working with chip-level functionsand devices, but the overall operation still depends on your C code. You cansee that aspect of a design in my 8-bit counter example that required onlyeight lines of code to control an interrupt-driven program.

This kit and the PSoC creator have a lot of potential becausethey create a code "outline" based on the PSoC functional buildingblocks you use in a design and thus remove developers from the nitty-grittydetails of register controls for I/O ports, configuring a 12-bit ADC, and soon. Schematic-diagram-like "wires" make connections as needed betweenthese blocks through Universal Digital Blocks (UDBs). The PSoC Creator tools automatically use theUDBs to create any needed functions, such as 32-bit counters, and route signalsbetween existing resources and I/O pins. Imagine having to write the code for aCAN-bus controller vs. dragging a CAN-bus controller into a schematic and usingseveral configuration screens and prebuilt API functions. The latter approachwins every time.
I enjoyed working with this kit and except for the lack of aworkbook or reference manual for the PSoC Creator tools, rate it highly.Perhaps Cypresswill have that type of information available soon.

If you want to concentrate on solving problems rather thanbecoming enmeshed in the details of complicated functions and I/O ports, Ihighly recommend the PSoC chips and the PSoC Creator software. Support for the Micrium uC/OS II and theSegger embOS should become active soon for the PSoC 5 family of devices thatinclude an 80-MHz ARM Cortex-M3 CPU rather than an 8051.

Click here for an exclusive, in-depth tutorial.

Sign up for the Design News Daily newsletter.

You May Also Like