updated on 18-12-2010
The circuit

Sound tone detection with a PSoC

Connecting blocks

Every book about PSoC starts with: “Design and test carefully your circuit before start writing the code”. It’s really true! When you build your project after connecting all the blocks needed, the Designer (this is the name of the Integrated Development Environment freely downloadable from Cypress web site) defines the template for the program you are going to write. It collects all the libraries needed, creates the basic main.c file and all the “include” files, with the name you gave to each block. Changing the block configuration after you have written hundreds lines of code using that names and libraries, even if always possible, could be painful.
The good thing is that you can test your analog circuit without writing a line of code. Connect programmable amplifiers, filters and other blocks via the common buses available and you can display the result of your work with a scope after injecting the signal to the input. It’s not a simulation, it's real.
If you are used to work with MCUs, the first approach could be very strange. You don’t have a fixed number of peripherals that can be connected to I/O pins according to your needs, you have a fixed number of boxes that can be filled with any kind of functional block. The limit, in this case, is the number of the boxes, not the number of the blocks. The blocks can be connected internally with other blocks or externally with I/O pins. Not every combination is possible. There are a good number of buses and boxes but you have to study the right compromise between your needs and the connections available. At the very beginning it can be confusing but after a while it becomes easier. Be prepared to spend most of your time on testing different connections and different configuration for each of the blocks before reaching the optimum solution.
Every operation is performed inside Designer. You can connect blocks, configure them, read the datasheet of each block, write and compile your program, flash the device and more without going out of the IDE. You can also configure everything manually editing the code, after all it acts as an usual MCU with a huge number of registers for really a lot of different configurations. You have to take care of all the compatibilities avoiding possible conflicts and… Fortunately there is the Designer that does all this things creating the code for you.
At the end you can also create an exhaustive report of the entire configuration with the block diagram and a detailed description for each block using the menu item “view-configuration datasheet”. It creates a folder (ConfigDataSheet) with all the information and the picture for a complete documentation. Many of the pictures used on this document have been generated automatically with this function.
It is very interesting, even only as an exercise for the brain, reading some of the many application notes available on Cypress web site

Below some little tips personally experimented on my shoulders, hoping to save some time and some headache to you:
- On copying text from a window to another one, you cannot use standard ctrl-C, ctrl-V as copy and paste but you have to use drag & drop with mouse between tabs. Fortunately I’m a Mac OSX user too and drag & drop is more common than copy & paste for me, compared to Windows users.
- At least at the beginning, it is highly recommended to enable “show allowed connections” feature (right click) to immediately know which connection are admitted for the line or module you are using.
- There is no big enough monitor when you are working with Designer, you have to zoom and pan very often. To navigate easier on the block diagram to place or connect modules and buses, you can temporary switch from standard to pan mode view with alt key, instead of clicking the menu item or using right click contextual menu.