A new way to do firmware development on programmable devices

Mark Saunders, Cypress

February 7, 2012

Mark Saunders, Cypress

A Sample Design
Let’s start with a simple PSoC design for illustration’s sake. PSoC Creator’s schematic capture and parameterized components make it easy to draw up this peak detector circuit.


Click on image to enlarge.
Figure 1: Peak Detection Schematic in PSoC Creator

This design uses two main components: a comparator (Comp) and a mixer (Peak_Mixer). The comparator simply compares two input analog voltages and outputs a digital result. The mixer, which is configured in Sample mode, outputs the difference between its reference and input signals and updates that value on every clock cycle. Because the reference voltage is ground (Vssa) in this design, the mixer always outputs its sampled input voltage to another pin (Peak).

The output of the mixer is also fed into the reference input (-) of the comparator. When the voltage on the pin (Sig_In) is low, the comparator output is also low and the clock to the mixer is blocked by the AND gate.

As a result, the mixer does not sample the voltage and continues to output its last-sampled peak voltage. When the pin voltage is higher, the comparator changes output, the clock is no longer gated, and the mixer updates its output with the new peak voltage.

Building this design results in a number of APIs being generated. For our purposes, we just want to turn on the circuit:

1 - Comp_Start()
2 - Peak_Mixer_Start()

To write this code, we need to create the uVision project. This is done from the PSoC Creator Project menu, which offers the “Export to IDE” wizard.


Click on image to enlarge.

Figure 2: Step One - Choose the Target IDE

After selecting the uVision IDE, we have the option of creating a new uVision application or updating the device settings on an existing application project. This second option is only used when there have been major changes to an existing design (more on this later). Pick a directory, choose names for the workspace and application project then click “Next” again to advance.


Click on image to enlarge.

Figure 3: Step Two - Choose Project File Names and Location

Next, the dialog asks if you wish to include source code in the application project. Whether you do this depends on your style and how your team works. Sometimes hardware designers write just enough software to test the device configuration.

This code is not production-worthy and the hardware team may want to share it with software professionals. In other cases, the hardware teams develop useful low-level interfaces to the systems they have designed in PSoC Creator and want to export these to the application developers.


Click on image to enlarge.

Figure 4: Step Three - Export Application Code?

The important decisions are now made and clicking “Next” takes you to a review step, where you can see the actions that will occur during the export process. One more “Next” and the export is completed, with a checklist presented along with a checkbox option to launch uVision.


Click on image to enlarge.

Figure 5: Steps Four & Five - Review Actions and Launch uVision

Exporting to uVision involves the creation of a number of files: the PSoC design library project, the application project, and a multi-project workspace that allows users to open, and build, both projects in a single invocation of uVision.

The library project contains all the PSoC-specific details, including important API files and initialization code. When the project is built, a “*_PSoCxlib.lib” library file is generated that is linked directly with the application.

The application project is typically something of a shell when it is created (unless you export source files for PSoC Creator).


Click on image to enlarge.

Figure 6: Viewing the Exported Projects and API Files in uVision

It is dependent upon the library, meaning it links that project’s .lib file, and is the project to which that software developers will add source code, run the debugger and, ultimately, complete the product. It is in this project’s source files that the calls to those two APIs, above, will be made.

< Previous
Page 2 of 3
Next >

Loading comments...

Most Commented

  • Currently no items

Parts Search Datasheets.com

KNOWLEDGE CENTER