pheloniusfriar: (Default)
As anyone who knows me knows, I'm something of a bithead (kind of a gearhead too... probably a poohead, but I'll let you decide on that one). Earlier last year, I ordered in some Cypress PSoC 4200 development kits to experiment with. Why? Well, I was trying to get up to speed on modern FPGA development (still a work in progress), and my Verilog language skills were beyond rusty (I think I was fully in the “I'd forgotten more than I ever knew” territory by that point).

There are two very interesting things about the development kits I ordered: firstly, despite it being a very humble device, the PSoC 4200 has configurable digital functionality that can be programmed using Verilog (an extremely unique situation from my experience... as a note, the PSoC 4100 does not have these configurable digital blocks); and secondly, the full development kit, the CY8CKIT-049-42xx (follow the link to the page), costs a whopping $4US and includes a USB programming module, the processor on a PCB with prototyping connections, a button and LED and some support electronics for other available functions on the chip, and a full and innovative development software kit called PSoC Creator. I say "kits" because at $4... why not order a bunch to play with? The PSoC 4200 not only has a Cortex M0 ARM CPU (up to 48MHz, with nested interrupt controller, etc.) and the configurable digital logic (which they call Universal Digital Blocks or UDBs), but it also has configurable analog electronics (op amps, comparators, two low resolution current-mode IDACs, a 12-bit 1Msps ADC, a powerful multi-channel capacitive touch and proximity sensing module, and analog multiplexers that let you dynamically connect them to any I/O pin on the device), a nice handful of useful on-chip peripherals (timer/counter/PWMs; and Serial Communication Blocks that can be used for I2C, SPI, LIN, I2S, and other protocols), LCD driving capabilities, up to 32K of Flash and 4K of SRAM, and an epic Digital Systems Interconnect (DSI) fabric that can connect pretty much anything to anything on the chip. The one thing the PSoC 4200 doesn't have is a Direct Memory Access (DMA) controller, so interrupts and the CPU must be used instead (some of the members of the 4200 family have DMA, but not the one on this kit). Given that in the applications I've written so far that the CPU is pretty much in standby mode most of the time waiting for short interrupts to service, the lack of DMA has not been an issue in the slightest for me so far. I also wanted to say that the fact the development kit just needs to be plugged into a USB to be programmed (sadly, PSoC Creator only runs on Windoze, but I'm willing to dual boot to that OS from Linux to run it, it's just that spiff!), is both a brilliant marketing move and a show of technical prowess that can't be ignored.

I've already built an invention that I've been trying to get to for over a decade using one of these little development kits, and as the saying goes “I've used every part of the buffalo”... from the CPU to the programmable logic (UDBs using Verilog) and the configurable analog, to the on-chip peripherals (well, the PWMs, I didn't need a serial communications port) and just about all of the Flash for data (not much RAM was needed though). The last piece I'm working on is a proximity sensing capability that starts the invention up when someone gets close enough to it (don't worry, it's nothing malevolent, heh... it just saves the batteries and encourages its use). The capacitive touch/proximity sensing uses the analog multiplexing capability and the two IDACs, but I didn't really have much more than a loop of wire to play with and it didn't really behave as well as I had hoped. I've since ordered a development kit peripheral from Cypress that has a proper printed circuit board and such for testing out proximity sensing designs. I'll be playing with that over the next few months I think (I wish I could say weeks, but I know I'm going to be super busy with school starting Thursday... ugh... it's my last semester as an undergraduate though, so there is that at least). I am rather amazed at what I have been able to accomplish with just one really, really inexpensive PSoC chip! As a further note to anyone who has ever used an Arduino or its ilk... while the PSoC development software seems to be aimed at all levels of expertise (from the expert developer to the novice hobbyist), it has more of a learning cliff than a learning curve and it's the kind of thing that is very easy to learn if someone shows you how (maybe at a Maker Faire or meetup?) but hard to pick up on your own unless you know what you're doing. The effort is worth it, but plan to spend weeks learning how to wrangle the thing, not the days needed to master Arduino development. As a final note, the PSoC Creator development suite allows you to enter schematics of the hardware you want to use on the chip (it synthesizes it for you, so you don't need to know Verilog or anything like that), and you program the CPU in the C language (like on the Arduino, for instance). There are lots of online tutorial videos and example projects to get started with as well, but even I found it all a bit overwhelming given the flexibility and power of these little chips (the "hello world" of blinking an LED on the development kit is described in the setup and test instructions for the kit... you can read it by going to the link above and downloading the “CY8CKIT-049-4xxx PSoC 4 Prototyping Kit Guide”).

Anyhow, I am going to be keeping a journal of the work that I have been doing because I know how hard it was for me to pick up the subtleties that were needed to make a professional-grade product using the PSoC platform. Of particular interest for others is perhaps that I was able to use the PWM (Pulse-Width Modulation) capabilities of the PSoC to play back an audio clip from Flash memory: the PWM digital output's pulse width was modulated by the value of the digital audio sample, then that was fed into a 4th order Chebychev low pass filter (in a Sallen-Key configuration with a 4kHz cutoff frequency ... it gives roughly the same audio bandwidth as a telephone conversation) built using the on-chip op amps and a few off-chip resistors and capacitors, and then into a little audio amplifier I bought locally as a kit. Apparently it had not been done before with this particular chip or kit since I could find no hint of it anywhere on the Intertubes, so it is something that I will be describing in a future post (including a photo of the resistor/capacitor network that was my first prototype... a mess of a 3D sculpted mass of wires and parts if there ever was one... the final version is on a prototyping board and is a study in elegance by comparison). I also took a public workshop that taught me how to develop PSoC-based Bluetooth applications (some of their processors have that built-in as an option... their BLE technology), so that's kind of hanging in the wings as well as a thing to get around to. I am also working on an embedded network protocol and am again pushing the PSoC to its outermost limits of capability (deliberately, and as part of a much larger research project I am working on that might result in a fun little educational product). The past few days I took a step back from the larger project to try a bunch of experiments with the UDBs, clock routing, and CPU interrupts done in non-standard ways. I finally got that working and have some lovely blinking lights on my desk, and am one step closer to a really funky “zero additional components” embedded communications mesh. There are at least two real-time operating systems for the PSoC family (some take as little as 1K of Flash, it's mind blowing!), and I might try to wrap it as an inter-processor message-passing mechanism in one or more of those frameworks. Obviously, more to come on this, but I will be presenting my little sub-experiments because they show a lot of techniques that are not discussed anywhere from what I can see.

If you are interested, you can watch a bunch of training videos here:

If you need a giggle about corporate types trying too hard to be hip, you can check out this video (although it does provide a good teaser on the development tools and capabilities):

Cypress: You dream it, we’ll help you make it

If you do not have epilepsy or a sensitivity to blinking lights, you can see the real thing here...

(some of the smaller text needs to freeze-framed, but it often quite funny... overall, I think it's a brilliant production! Full screen it if you can handle it...)


pheloniusfriar: (Default)

September 2017

3456 7 89
10 11 1213 141516
171819202122 23


RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 24th, 2017 09:05 pm
Powered by Dreamwidth Studios