Tuesday, August 16, 2011

AVR programming

Today marked a bit of progress on a couple of my microcontroller projects.  First, I discovered the reason that my LED cube controller board wasn't working.  It turned out to be because I had swapped two control lines on the schematic.  Unfortunately, it's not something I can fix in software.  The swapped lines are a clock pulse line and an output enable line, going to each of eight '574 8-bit flip-flop chips.  The two lines work in completely different ways (clock pulse latches the flip-flop outputs on low-to-high transition, and output enable is active low), and are being driven in completely different ways (output enable is supposed to be a shared signal driven by a single pin from the microcontroller, while the clock pulse is supposed to be individually selected one at a time from a 3-to-8 multiplexer chip's output).  So there really isn't a clean (or perhaps even viable) solution to fix this in software.  As a result, I made a revision "C" of the board design and submitted it for manufacture.  The LED cube is getting pretty expensive at this point.

The other bit of success I've had was in hooking up a Trimble Copernicus GPS receiver-on-a-chip that's mounted on a Sparkfun breakout board, through a logic level converter to an atmega8u2 breakout which is programmed to be a USB-to-serial device.  It.. sort of worked, in that I could see bits of data being sent from the receiver, but the firmware on the atmega8u2 would only work at 9600 bps, while the Copernicus talks at 38400 bps or 4800 bps, depending on which interface you chose to use.

The bad news is that the tool chain provided by Ubuntu is way out of date and I can't really compile for the atmega8u2 with what's been provided.  Newer versions of the tool chain can, in theory, be built, but the instructions as listed in that link don't actually work.

After much hair pulling, I managed to find this sticky thread on avrfreaks.net.  I had to do a little bit of tweaking to get the scripts to download the source files to use a site that was actually up in a couple of instances, but the level of hassle to get that tool chain built and installed was far less than what I was going through with the others.  I was able to build LUFA.  I did not, however, install any of the LUFA bootloaders onto the sparkfun device, opting instead to reinstall the original sparkfun firmware to see if it was capable of switching baud rates.  It was, and I was able to confirm NMEA messages coming out of the Trimble receiver chip.  Progress.

I'm still 6 days away from having the Rev. C LED cube controller boards in my hands, but I'm hopeful that when I get that put together, I'll finally have that working as well.

No comments:

Post a Comment