pheloniusfriar: (Default)
Well, I am finally back up to a basic operational level with Verilog coding... only to find out that the project I will be working with has been done in VHDL. While one language versus another is usually no big deal for me (okay, I hate C++, but I've been using it since the 80s when I worked on what was, at the time, the largest C++ project in the world and I'm good at it, but that doesn't mean I have to like it), VHDL has its roots in the Ada programming language D:. Why the grumblings? Ada was developed by the U.S. Department of Defense and is one of the most notorious Bondage and Discipline languages in existence. While B&D might be fine, it needs to be consensual and nobody ever asked me if I wanted the flagellations VHDL/Ada will entail ;).

It does remind me of an interesting side path in processor technology development from way back when... the Intel iAPX 432 system. By any measure, this was a complete failure for Intel (and the industry as a whole), but it introduced a number of features that we now see in most modern processors. I'm not going to go into it here, except to say that it supported object oriented data access and security control models at the hardware level, supported explicit hardware fault tolerance and multi-dimensional data busses, had superscalar processing elements, and so many other features that were too far ahead of their time (and thus made the system intolerably slow and cumbersome, and thus uncompetitive). I remember that the instruction set was actually a bitstream read into the processor in 32-bit chunks and parsed, and that instructions could be anywhere from 4 to 111 bits in length! It really was an engineering masterpiece, but I often mused that the people that worked on it must have been locked up in the loony bin afterward en masse (I think one of them went on to be CEO of Intel or something... maybe the same thing? Heh). Anyway, why I bring this up is the 432 was never meant to be programmed in assembly language or even "system" languages like C, but rather was designed such that Ada was essentially its assembly language. Perhaps that is another reason (maybe even moreso) for its demise ;). Sadly, VHDL is widely used in the electronics design sector, so it was inevitable that Ada would eventually catch up with me... I took two textbooks on VHDL out of the Carleton library on Wednesday and have started reading them. I am determined to progress, if equally resigned to my fate.

I'll make sure to leave a tube of lube on my desk as I work... it might make the proceedings a little more comfortable to me ;).

On a completely separate note, I am currently listening the heck out of Floex's album "Zorya" (Floex is the project of Czech composer, musician, artist, producer, etc. Tomáš Dvořák, who also did the gorgeous soundtracks for the delightful games Machinarium, which is where I first heard his work, and Samorost). The music on this album successfully pulls from so many different styles: prog, classical, industrial, pop, etc. and puts them together into what I find a very pleasing whole, blending acoustic instruments/sounds with synthesizers and samples. In particular, on one track (Forget-Me-Not), he plays piano and a clarinet without a mouthpiece that I can listen to over and over again... melancholy and evocative, it really floats my boat right now. The clarinet played like a trumpet has a very distinctive sound (to say the least) that makes that song stand out for me. There are many different moods throughout the album and even within the songs that keeps it interesting all the way through. It also features the best Yes song not by Yes I've heard in a while ("Precious Creature" featuring the vocals of James Rone), heh. You can listen to it free on his Soundcloud page (or listen to and potentially buy it at his Bandcamp site):

https://soundcloud.com/floex/sets/zorya

(the Soundcloud page is nice because it talks about some of the intruments and credits the other people that performed on the album... just click on "Show more...")

Edit: I started reading Douglas L. Perry's book "VHDL Programming by Example", Fourth Edition, McGraw-Hill, ISBN 0-07-140070-2. It bills itself as "the hands-down favourite user's guide to VHDL"; but good lard, what a disaster! I made it as far as page 4 and had already picked out typos and plain wrong information... the cruftiness was continued on page 5... and I have given up and tossed the book aside (gently, it's a library book). On page 4, they refer to the "counter device described earlier", but the only thing described earlier is a multiplexer (there's nothing else earlier in the book, this is the start of the book!). On page 5, it reprints a fragment of code from page 4 and says it's from the "architecture behave" code, but the code it is referring to is clearly "architecture dataflow". What a crock of shit (and it hasn't helped my opinion of VHDL any either, I might add, ugh). There does not appear to be any errata for this hunka-hunka-burning-turds. Let's try the other book I got from the library, sigh.

Second edit: I am now digging in to Peter J. Ashenden's book "The Student's Guide to VHDL", Second Edition, Morgan Kaufmann, ISBN 978-1-55860-865-8. I now know one of the reasons why VHDL has always seemed somehow wrong to me (while Verilog seemed a sensible approach in contrast). Quoting from the Preface: one pervasive theme running through the presentation of this book is that modeling a system using a hardware description language is essentially a software design exercise. And there you have it... VHDL became popular because it views hardware design as an exercise in software design. Since there are so many programmers in the world (thousands per hardware designer), it is a seductive statement that anyone who can write a program can design an integrated circuit. However, that is like saying that giving someone a Digital Audio Workstation (DAW) will allow them to effectively compose good music. Yeah, anyone using looping composition software can create something quite pleasing and often interesting, but it is not crafted in a way a trained composer or musician can do it. It is also much harder to innovate (music or hardware design) without deep training in the art in question. I find it interesting as well to note that there are thousands of folk musicians for every trained musician (I consider most rock, etc. kinds of folk music... and before you think I'm being snooty, I only do "folk" music myself in one form or another, and I have no pretentions about where my music fits into the spectrum of musical sophistication). I have done both serious hardware and software development (and I can do me a mess o' software... I've been programming complex and sometimes mission critical software for decades and I'm very good at it), but the two skillsets are radically different. Anyone with a VHDL compiler in one hand and an FPGA in the other can probably get something to work that'll do the job, but it is going to be sub-optimal in many potentially important ways (if not subtly buggy). This explains a lot of what I have seen lately with a number of ASICs, hmmm. The medium (VHDL) is the message.

I am starting to regret that I wasn't telling the truth when I said I'd keep lube by my side as I worked...
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:

http://www.cypress.com/training/free-online-video-training-and-tutorials-cypress

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)
It has been a long and twisty road to get to this point — it was a journey that began almost 40 years ago when a nerdy young teenager read an advertisement in Radio Electronics magazine talking about the über cool (and surprisingly affordable) modular synthesizer gear made by this upstart company called PAiA Electronics. I sent away for the catalogue (which I still have in a box of keepsakes in the basement as I have grown up to be a nerdy old man). I drooled over the stuff in that booklet for years, but could neither afford to buy nor justify purchasing anything from them.

Years came and went, and during the 80s, analogue synthesizers and related equipment fell out of favour to most (not to me, but I was otherwise occupied at the time). Through the 90s, the limitations of digital technologies were slowly being charted out, and there was a revival of analogue electronics for certain tasks. In particular, it was the nearly unlimited flexibility of digital synthesizers that presented the problem: the capabilities exceeded the abilities of anyone to master. Another problem with digital synthesizers was, ironically, limitations with their interface and of control. With an analogue system, you could (had to, really) "tune" the experience in microscopic increments; but with a digital system, by necessity, there were only certain discrete values that you could set a control to, and that limited the possibilities for subtleties in the sound. The advantage of digital systems was (and remains) that once you had a setting you liked, you could call it back (presuming you were smart enough to have saved it...) at whim and it would be exactly like the last time you used it — exactly like the last time, and the next time. And that was another limitation of digital: life is change and a digital patch was static and unchaging... it mimicked life, but was not alive. Analogue synthesizers and equipment are never the same way twice and will generally even drift a bit during a single performance (like a guitar going out of tune as the humidity or temperature changes)... it really has a life of its own and that's where it is an instrument that can be part of a performance instead of being a computer that just cranks out a sound at command. I have a lot of digital equipment, and I love the heck out of it, but there is something to be said for having organic components (in the metaphorical as well as literal sense) in a performance.

In late August of 2014, I was finally able to "justify" the purchase of a piece of equipment I have wanted for a long time by the simple virtue that I had (barely) enough money to do so, and had decided unilaterally that I had displayed sufficiently notable restraint thus far — thirty-six years is a long time to wait, and enough was enough! I ordered a PAiA model 6710 Vocoder kit (with the optional front panel cutout, but no power supply... a detail that will become important later in the story). Last year was pretty much absolute hell for me and was a non-linear slide into full burnout by the end of it. I did a lot of really cool stuff related to physics and my academics, but my actual academics definitely suffered as a result and I ended up getting extremely ill in April and through much of May (picked up some nasty flu virus or something and it laid me flat for six weeks... might even have been viral pneumonia, but the doctors I saw never really figured out what was going on with me [but that was one wild-ass guess they made]... gave me antibiotics that did nothing, thus my supposition that it was viral whatever it was). I actually failed a critical class and I now don't know whether it's going to take me one year or two to finish my degree(s)... not a great feeling, but I'll make the best of it either way, just like I always do. All that to say that it should come as no surprise that I didn't finish assembling the kit until my break from school in December 2014. It was a pretty gnarly assembly job (there were so many wires!) but I only made one assembly mistake (a polarized capacitor put in backwards), and I caught it with a close visual inspection as part of the assembly process. Overall, it was good to be soldering stuff again, I truly enjoy doing that sort of thing with my hands!

Now remember that power supply thing I was mentioning earlier? Yeah... that. I have spent much of my life around electronics and power supplies and whatnot, so I didn't bother ordering PAiA's power supply kit. To be honest, I just don't like the looks of it with its wall barnacle and open board (and $50US price tag). I figured I would just go out and buy a nice little +/–15VDC power linear supply locally, or just pick up the parts and do it myself. Let me rephrase that, I mistakenly figured I would just buy one or the parts. A lot has changed since I last made a +/–15VDC power supply... like everything has changed and it's literally impossible to get the parts locally anymore to do that sort of thing. There are companies like Digikey that will ship components to Canada, and they are quite reasonably priced, so there was always that to fall back on (the shipping will kill you though... I remain convinced the package delivery service in Canada is run by the mob, or at least some sort of monopolistic, price fixing, conspiracy... when it's cheaper to ship something from Bangalore, India to here than from Toronto (Canada), you know there's a problem... but that's another story I guess). I went to one of the few remaining "electronics" stores in the city (Active Electronics) and discovered that they didn't really sell electronics anymore, or at least not any of the components I needed. What they did do was sell Arduino and Raspberry Pi boards and their ilk and related kits and shields (which they do very well, for what it's worth). I did manage to pick up a little hobby box from them though and decided that I would just recycle an old +/–15VDC power supply that I had designed and built many decades ago (if it still worked).

Well, that job took me forever to get to and even after I found it in my boxes and boxes of boxes of boxes in my basement, I just didn't have the energy or willpower to actually sit down and test it until sometime in May 2015. Long story short, it did work just fine still, and would fit nicely in the box I bought. Short story long? Anything by Dickens. The problems of moving forward and actually putting the power supply properly into the box were legion though, and involved many dozens of hours sorting through things in my basement to find the tools and parts I needed to complete the job. This is something I'm working on anyway, so the work is all part of a longer project, but it does mean that I was not ready to actually start the assembly of the power supply until about mid-June. Sigh. The good news is that most of my tools and bits of hardware are now in known locations to me instead of being spread around in dozens of hidey-holes and boxes and chests and cabinets and rooms. It still probably took me 40 hours of effort to actually machine the enclosure, wire and assemble the electronics into it, and finally test it... which is too long for a job like that, imho. Did you know that the LM7815's case is ground, but the LM7915's case is input so if you don't have thermally conductive but electrically insulative pads and hardware with which to mount them to the chassis for heat dissipation you short the output of the transformer to the electrical ground and fry everything? Uh, huh... I was wondering why I had used those pads on the original design... good thing I double checked and repeated the procedure, and triple checked with an ohm-meter before turning anything on (I'm pretty good, and very careful, at this stuff and most of what I build works the first time). I finally got it all together two days ago and solved one little stability issue with the negative supply output yesterday (all it needed was a 10µF tantalum capacitor on the output) and it was the most beautiful and quiet (from an electrical perspective) linear power supply you'll ever set eyes or oscilloscope on (very low electrical noise is critical for analogue electronics because any power supply noise will usually appear as a signal on its output... which is why I could not [or at least would not] just pick up a switching +/–15VDC power supply... they're just too noisy electrically).

Once the power supply was assembled and tested, I finally added power wires to the assembled vocoder and installed the integrated circuits into their sockets on it (I had kept them safe in a bag until I was ready to do the testing). It's funny how little techniques learned decades ago and not practiced in many, many years come back to mind. Here, in specific, I'm referring to the technique of pressing the sides of the integrated circuits onto a flat surface to bend the pins from the angle they are shipped with to the straight up and down position that is needed to insert them into sockets. I guess it's like falling off a bicycle: you never forget how. I powered on the vocoder and no smoke poured out of anything, so far so good! Since there are no indicators or anything on the unit, the only way to test it was to actually hook it up and give it a whirl. To get a good effect, you need a raspy/grumbly sound as the "instrument" and I hooked up the little Yamaha digital synthesizer I have (it has many, many preset sounds that would serve perfectly). I also got out one of my crappy microphones and hooked that in as the control signal (the power envelope of the control modulates the sound of the instrument being used, and that's how you get the "vocoder" effect). The output went into a little guitar amp I have and with a little tweaking of the knobs... it worked! I finally have my very own vocoder and I am very, very happy (and now I sound really cool too)!

Here's the assembled vocoder kit itself (ugly as sin inside with all those wires):

Picture of my assembled PAiA 6710 Vocoder kit

Here's the guts of the power supply I designed, built, redesigned, and rebuilt:

Picture of my custom assembled +/–15VDC power supply

And here's a photo of my test setup for the vocoder, it works like a charm!

Picture of my little test setup for the vocoder

I will be playing with it a little more today (and into the evening), but then it and all the related equipment, tools, parts, and such will be moved into the basement to wait for when I am ready to set it up in the recording studio space I'm setting up in the basement (that's part of that longer-term project I mentioned above). I am so looking forward to getting my dining room table back, and I know Beep and Happy can't wait to see my shit gone from there as well! Going forward, I will eventually have room in the basement to do this kind of work and won't need to repeat the "middle of the main living area workspace" experience again (or at least not as often or as drawn out timewise... but sometimes working on stuff in a social environment is better than putting away in a cave). Anyway, I'm off to make more cool noises and learn some of the techniques needed to get optimal and interesting sounds out of the thing (the one page operations description that came with the kit suggested a week or so of farting around with it should provide a sufficient basis to use it competently as a real instrument... the secret, apparently, is the sounds you feed it (both as instrument and control... using synth drums as control instead of voice was one thing suggested that sounds really, really cool), and learning how to play with the various levels to get the effect that's right for what you want). It also has an effects send/receive loop that I can use to add other effects on the control (e.g. my voice) to the mix, so I will be playing with that as well eventually.

Now, back to working on my differential equations homework (I have a test on Wednesday) and studying vocabulary words and grammar (last Thursday, I started my class on the Anishinaabewin [Eastern Ojibwe] language for beginners I'm taking as well this summer).

Profile

pheloniusfriar: (Default)
pheloniusfriar

September 2017

S M T W T F S
      12
3456 7 89
10 11 1213 141516
171819202122 23
24252627282930

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

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