Note: Time ran out on me in this competition, but I wanted to thank tariq.ahmad and the element14 group for selecting my proposal and sending me the Cypress . I am disappointed that I was unable to complete my entry at this time, but I do intend to follow up on this project and post some updates as I get further along on this.
When the Digital Fever project14 contest was announced, with the ability to receive a free CYPRESS - INFINEON TECHNOLOGIES board, I replied with the following:
"I have been thinking about improving an existing design that I have been producing for a few years now. The product produces multiple PWM channels for driving servos. The product currently uses a timer to generate two PWM signals that are then demultiplexed into ether 6 of 12 PWM channels, depending on the board type. While the timing is pretty good, there still is a bit of jitter due to some resource contention and interrupt delays. I was thinking about trying out the PSoC devices to generate the multiple PWM signals and potentially also replace the onboard processor (ATmega328PB). The plan would be to reduce my parts cost and assembly time while improving my device's performance. So a PSoC 4200 would be an excellent platform to allow me to learn a bit more about these cleaver little devices."
As a result, I received one of the boards and started my journey into the wonders of the Cypress PSoC devices. Although I have know about these parts and even had a small collection of development kits and parts, I had never fully committed to actually using one of these parts in a project. Well, it was time for that to change.
Let start out by looking at the existing schematic and BOM.
The boxed in regions represent the areas of the schematic that need to change in this effort.
- The 'Orange box' is the programmable LED dimmer circuit. The main part is a TLC59731DR by Texas Instruments. This part is a 3-channel, 8 bit, PWM LED Driver with a Single-Wire Interface (EasySet). In addition to this chip, I am using one half of a dual P-channel MOSFET (BSD223PH6327XTSA1CT) as an inverter for the serial programming stream and a higher power P-channel MOSFET (PMN52XPX) to provide a flash function (much quicker than reprogramming the LEDs on/off). Note: there will be some added cost in the conversion of this circuit as I will need to supply drivers for the LEDs as the the peak currents can be as high as 50mA per LED.
- The 'Red box' is the 2 to 12 channel demultiplexer that uses to PWM channels (from a single counter/timer of the ATmega328PB processor) to generate the 12 Servo output signals. This circuit uses 6 dual P-channel MOSFET (BSD223PH6327XTSA1CT) and 24 resistors (12 1K and 12 220) (Note: the 220 Ohm resistors are current limiters to protect the outputs and may be needed in the new design).
- The 'Blue box' is the current processor (ATmega328PB) that will be replaced by the PSoC device.
Looking through the BOM, the items that could be removed are as follows:
The cost reduction of $4.7858 doesn't even cover the entry point pricing for the part specifications that I need (Min 8K RAM and 4200M class programmable digital). But cost isn't the only factor, the assembly time for 20+ less components is also an important factor. It usually takes me 1-2 hours of time to just place the components onto the board, any reduction in time is also an important saving. The numbers still might be worth looking forward into this plan.
After loading up all of the development software and getting familiar with the environment, I jumped in and starting playing with the programmable logic side of the puzzle. An what a puzzle it was. The development reminds me of the earlier attempts of logic design in CPLDs and small FPGAs. You build some logic, run the fitter, look at the reports (and/or failures) and then to try it again (and again......). Having the design leverage the bigger blocks (SCB and TCPWM) seemed to be the way to go. Using lower level logic seemed to eat up valuable resources much too quickly. Here is the final top level design that seemed to address most of my needs.
I used the same markup colors to help define the design.
- The 'Orange box' is the LED dimmer design. This design, could allow me to use 16-bit dimming command, but to retain backwards compatibility with my prior design (especially in the DMX definition of channel slots), I will happily use 8-bit dimming. As mentioned above, I will also need to supply drivers for the channels to reach the ~50mA per channel (eating into my cost a bit).
- The 'Red box' is the 12 channels of Servo output signals. The Interrupts allow for the processor to service the PWM devices and Demuliplexer switching.
- The 'Blue box(es)' represent the logic that is need to provide the minimum level of functionality needed to replace the ATmega328PB processor. The configuration port is currently used to assist in testing, allowing me to send simple commands to the device to exercise the PWM signals.
The LED dimming and the servo output pulses are fulling tested and working. Where I ran into issues where in the development of the DMX receiver function. I have roughly ported some of my existing code, but I failed to get it all function properly. I plan on updating this post as I get further along on this project.
In general, I was very impressed with the Cypress PSoC product and development environment, but I do think that I might need to further research their PSoC product offerings and hopefully find a better match (cost, pin count and capabilities) in order to make this project successful. It was quite a leap of faith to use these PSoC parts, as I really like to be a register level type of designer, typically doing bare metal type of coding. The software wrappers over the registers (way too many 'ifdef's) and the huge amount of resisters in general made it very difficult for me to get as comfortable with these parts as I would like to be. The limited areas of protected code spaces (#START/#END) made it a little difficult to adapt some of the software wrappers for the levels of interaction of components that I needed. The whole bootloader scared me from even consider writing my own bootloader (which a area were I am usually pretty comfortable working in).
Thank you again to element14 for the opportunity to try out this PSOC development board and I look forward to digging into these parts as soon as possible. Best of luck to members who were able to complete their projects for this contest!