Archive for the ‘Uncategorized’ Category

WTPA v0.95 Noise Floor and Programming Victories

Wednesday, December 10th, 2008

Yesterday was a good day for sampler technology!


Three really important things got done; two are improvements on the old sampler:

First: the serial link between the MCUs is now totally robust and fast. As I suspected the real problem with the serial before was the internal RC oscillator on the helper MCU. For now it’s been replaced with a 7.3728MHz crystal, but Digikey just rolled up with some 18.432MHz crystals this morning which I’ll be using instead, I think (these particular and seemingly-weird frequencies are exact integer multiples of common UART frequencies, and allow 0 baud rate error).

There were a couple other little forehead-smacking moments where I got bit by casting errors and other general programming bugs but they weren’t really bad once the UART worked. Like for instance — if you declare a variable “theByte” as an unsigned char, set it equal to ~’p’, and then later check for equality with ~’p’, it comes back false. Know why? Know how to fix it? I do now. :-)

Second: It makes audio! Since I already put a picture of a noble sawtooth wave up a million years ago and since the old sampler definitely did this just fine, this is less exciting. BUT it does mean a couple things. The new DAC works, and the analog sections (mostly) work and all the volume pots are the right way around. The VCO works, and the jitter generator — Oh boy does it work! All these need tweaking but they’re all rocking solid.

Third: I spent a long long time fiddling with the PCB and tracking down noise demons. This, I am happy to say, was a big success and a _huge_ improvement on the old sampler!

Pictured above are some example waveforms. On the left is a picture of the output of the old sampler with the preamp gain, through level, DAC level, and master volume all the way up. You probably can’t read the V/div knob on the scope, but this waveform is unmistakably clock noise which has capacitively coupled into the audio path and has been amplified such that it is ~220mV at the output. Yikes! This is really bad. Those of you who’ve heard the original WTPA know that this whine is one of its not-so-good-akshully characteristics.

The photo on the right is a noise picture of the new sampler after a little screwing around by me. Under full-gain, worst-case noise conditions, the new sampler has approximately 4mV of clock feedthrough. This is 34.8dB of improvement!

There are a couple noise sources in the WTPA family. One source of LF noise is the LEDs pulling current spikes from the supply when they turn on. This is at its worst when running from a not-so-low impedance supply (like a 9v battery or worse an STK500 through the ISP header) and did manage to find its way into the audio but it wasn’t terrible. The best fix for it was to improve filtering at the op-amp reference terminals (the VDD/2 level at the non-inverting terminal of a summing amp, say) since the noise that got there got amplified by the circuit’s gain. This helped for sure.

By far the worst noise source is clock bleedthrough, although the new design also shows bleedthrough from the white-noise generator. Improving this was a little trickier. A couple things made a big difference. Varying the gain on the preamp as opposed to keeping the gain fixed (and high) and attenuating its input level was one. Re-doing the design with better ground and signal routing mattered A LOT, although I still had to rip up a trace with an exacto — one poorly-thought out connection added nearly 100mV to the output noise here. Filtering the analog references better helped deal with this noise a little, too.

Finally, I think a ground plane (or two) are in order for the final hardware revision. I also think associating the VCO and Jitter Generator with the digital supply lines (or at least isolating them from the quiet amplifier analog supply) would be a really good idea. I might even use a choke input to the quiet analog supply. We’ll see. Either way, this statistic is already A LOT better than it was, and I’m excited.

Next: Sampling / RAM / throughput rate test, and more fun analog tweaking.

WTPA v0.95 Gremlins

Saturday, December 6th, 2008

The lone and level sands stretch far away from this nasty Nas, I’m afraid:

Not that you can tell from gazing on this benighted silicon Ozymandias, but no pretty waveforms will happen tonight. It’s not a total loss; there’s some badassery that came through and TON of code, but since I said I’d post today here’s the breakdown:

The body of the code is done for both MCUs, at least at first blush, and the ISRs are now based on the parallel interfaces. The LEDs look crazy hot. Messy little resistors and whatnot are dutifully appearing on the board. The square waves are almost square.

The bad news is that all the old timers who I didn’t pay attention to were right — UART communication on internal RC oscillators is dodgy at best. The real (and unforseen) challenge of the last 16 hours has been massaging the serial link between the two MCUs enough that it works. It limps along now but it sucks. My studied conclusion is that the second MCU really needs its own crystal, and it might as well be at a UART-friendly frequency.
I probably have some laying around somewhere, and will dig them (and exacto blades) out this weekend.

Other fun bugs and riders of the nitpick train include:

The AVR toolchain doesn’t seem to be very excited about the 48p/88p/168p MCUs, and although you can fool it, doing so raises the “bad idea” error flag. Further, the STK500 seems to only want to program the old-ass m168s I dug out to rectify this problem ONE TIME, before getting totally weird. This is a good one: These parts are socketed in the STK, mind, and the fuse bits remain totally unchanged through this whole process. You put code onto the part just fine and boom, it becomes unprogrammable. I did this THREE times. Furthermore, reading the Vtarg on the STK500 shows 6+ Volts, and the device times out when you try to communicate with it. Say what?
I started shopping for a new STK, until further fiddling revealed you can a.) physically pull the RESET pin to ground on the socketed target device using an alligator clip (or stream of foul language) which allows it program just fine OR you can socket and connect to another WORKING part, and move the Vtarg down to 3v, whereupon the old “broken” part works just fine again. Gremlin central.

Writing the code was, thankfully, pretty straightforward and I discovered a kickass feature in avr-libc: ISR_ALIASOF() — this reduced the accumulated ISR code to half the size — thus doubling its beauty.
Finally, a point of consideration: Naming an electonic device on your website “Where’s The Party At” makes for no small amount of schoolgirlish giggling when looking at your keyword referrals in Google Analytics. In keeping, I have decided to name my next piece “Hot Hipster Tang For Altbros”.

WTPA v0.95 Up and Executing

Thursday, December 4th, 2008

OK, OK dusty and neglected friends. For you, today: Twinkles!

What does this mean? Well, several things. The most important of which is that the new version 0.95 PCBs are up and executing code. There are 2 MCUs on the new boards that communicate via a UART. Mostly I did this because I wanted to keep this sampler “kit-friendly” (meaning big DIP parts) and ran out of pins on the main MCU to do all the stuff I wanted to do.

What you’re seeing right now is the smaller helper MCU (here an Atmega168, but it’ll end up a 48p or 88p depending on how much I shave down the code) making the lights go. This is his reason for being, in addition to reading the control pot / CV in, the switches, and generating white noise for the clock jitter generator circuit. More importantly, he’s pretty much done. Besides freeing up the main MCU for more important stuff, this extra MCU allows a lot more foofy lighting effects —

I’ve coded in a bunch of little strobe effects and fades and chases that ought to help keep your sampling experience trippy.

More importantly this update means that I’ve got a bigass hole in my freelance work right now and I’m pretty sure I can use it to nail the code/hardware debugging for WTPA once and (almost) for all. There’ll have to be another PCB rev (I’ve found hardware bugs on this one already) but the code should be pretty much exactly portable to the next one.
A couple days ago I set a deadline of, er, tomorrow to get this revision up, sampling, and tested. The code for the main chip is already well underway, and I think this is realistic. Stay tuned…

WTPA v0.95 Assembled, Other Nerd Biz

Thursday, November 6th, 2008

The nerd-biz has been thick since my last post — Chicago-based rocketry’s own Ignignokt ate peroxide in New Mexico, I finished making a bunch of art pieces / circuits for my man Cory (who is putting them in a show this month at Team Gallery which opens on November 13th — those of you in New York should definitely crash it), I made some fancy LED illumination for a furniture firm here in Chicago, and we have a new President who I’m told has a Twitter account. As of now I’m currently playing hooky on an Embedded radio project which is due soon for another buddy of mine.
Sadly this means that I’ve been a big slacker w/r/t WTPA, but I did manage to assemble the HOT NEW circuit:

In this photo if you look closely you can see that the board is up and running, drawing a reasonable amount of current and turning on the power light. It’s back to a pricey and involved Hello World, but I’m excited to get the code up to speed soon. Truth be told I’m about ready to flip out and just finish this project since it’s been all up in my free time for half a year now, and I can’t wait to get on to some NEW electronic instrument design. I just got this great book and it is both inspiring and incredibly useful — it makes me remember why I fell in love with the humble emitter follower all those centuries ago :-)

PS: Here are some random hard-earned nuggets of electronic design arcana I discovered during that artsy Video Game Controller-Controller job:

  • On the AVR, DORD flips the order in which the bits are _received_ as well as transmitted.
  • Surprisingly I’ve seen the AVR (mega164p) run at 20MHz more often than not at 3.4vDC. I only saw one misbehavior that looked like an oscillator burp.
  • The INVALID pin on the Max3221 is useful as hell. The TSSOP-16 package gives me more bridged pins than anything else I’ve ever soldered, however.
  • Serial Terminal Dumps — use “script -a LogFile” then “term” or “kermit” or “screen” or whatever. You can also do this with Minicom and the escape-L command. Or “term” and “tee”. And you will be totally buggered if you try this on a Mac b/c of its bizzare “cooked” serial drivers.
  • A weird thing about doing SPI with the Playstation One: You can send an ACK pulse TOO FAST after serial byte exchanges with some games, and the console will abort the transfer. I had to add nops in my interface. Also — this is only true for some games (EA Sports, are you listening?)
    • Corrollary: Some games (specifically EA sports games) will bail on you and pause if you have a bad controller exchange during play — I think this is an effort on the developers to help the player in case they pull a controller out in the heat of competition, and it makes sense, but MAN was it annoying to me and required a lot of workaround.

WTPA v0.95 Boards Arrive

Friday, October 17th, 2008

There is some spiritual sense of wholeness, some cosmic teleology that makes me feel thoughtful about posting pictures of a circuit called “Where’s The Party At” when it’s Friday night.

Like if somehow all the drunk, attractive people on Milwaukee Avenue could see the current in these traces they wouldn’t go to a 4am bar, because they would already have been there. Or something. I can’t decide whether this parable is supposed to be more like the two young fish meeting the old fish in the river, or the young bull and the old bull seeing all the cows from the top of the mountain. Some kind of middling-stinky animals appreciating time-and-reality type business is what I suppose I’m going for here.

*Ahem* So:

The next revision of PCBs are in! You’re looking at the Version 0.95 WTPA “barebones” boards. One thing I really like about Advanced Circuits is those sharp (and handy) fluorescent notepads they give you when you order a board. It tickles my hope for nerd-success: I used to really have to hoard them — not so long ago it took Very Serious Consideration before ripping off one of those bright, rare leaves to write “Call Mom” or something. Now I can pretty much paper my walls with them. Feels good. Before you know it I’ll have a cummerbund!

I can already see it’s going to be one of those nights, so down to business: These boards are necessary because they’re the last rev before I order the hundreds of PCBs and many thou of parts I’ll need for the real production release. Hopefully these guys are pretty close to perfect. Parts are already on their way from Digikey and Mouser and should be here next week. I’ve got an OS to re-write in the meantime — I’ve been learning a lot about the GNU Linker for some other projects and as a result my MCU code is getting a lot more pretty looking, and a little more clear (to me anyway) w/r/t how GCC’s optimizer thinks about it. Practically speaking I doubt I’ll have the OS re-written in the next couple weeks: I’ve been nuts making a Playstation version of Beat The Champ (also #8 here) which needs to be done in short order and, and just got a fancy interior design related project which of course ought to be done like yesterday, too. Of course the X-Prize Lunar Lander Challenge is next weekend and I plan to get good and drunk and watch my friends at TrueZer0 put a whoopin’ on the guy that wrote Doom.
Finally, my crappy electronic music project is playing (using WTPA even) next Friday at the Hideout with my old buddies in Parts and Labor.