User Tools

Site Tools


project:member:dormant:open_chord

OpenChord.org AVR Development Board

I recently donated a few boards I used for my OpenChord.org guitar controller project to the space. Unfortunately, they're not the best boards to work with, but hopefully they'll provide someone with a beginning opportunity to start messing around with AVR microcontrollers.

The project is primarily hosted at www.OpenChord.org, but the more technical information is located at the project's Google Code site.

Here are a few relevant details:

Building

Unfortunately, I designed these PCB's when I was still using half-size clock chips instead of the common crystal oscillator. This means that the chips have don't have the proper mounting for the oscillator. The easy way to get around this is just to bend the leads on the crystal and jam them in the appropriate pins when you're installing the chip mount. Since the chip mount's pins are super-thin, it shouldn't be a problem. The leads on the crystal, of course, go into XTAL 1 and XTAL 2, the two pins below the ground pin on the left side of the chip. XTAL1 already has a lead going out to the place marked “16 MHz Clock” and XTAL2 is just below it. If you feel like attaching the 27pF load capacitors to the crystal, you can put those going from the XTAL1 hole that's in the clock footprint as well as the “Extra” space below it, I think, since that's where the XTAL2 pin is accessible on the board.

Luke
On the ATmega168, the two crystal leads correspond to pin 9 and pin 10 on the chip. When I built one of these boards I just stuck both crystal leads straight into pins 9 and 10 on the IC footprint, and put the crystal on its side. I soldered the two 22 pF (27 pF would work, but 22 pF is more common, and 22 pF is what's supplied with this set of components) to pins 9 and 10 on the bottom of the board, and scraped off a bit of solder mask to solder the other ends of the capacitors to bare copper ground plane.

I have left a fully assembled board I set up with the other ones at CCHS for other people to play with.

Also, using the same technique, you can add an additional 1uF or 0.1 uF decoupling capacitor on the left side of the board, putting it in the hole at the same time you put in the chip mount. You also might want to use the same method for the decoupling cap that actually has a footprint, since there aren't very many places you can access VCC or GND on this board. Sorry!

Luke adds
You really don't need to add any additional decoupling capacitor in order to have a board that works - but you might wish to do so in order to have convenient access to the Vcc and ground pads corresponding to the capacitor's original location.

Loading Code

Getting the board into bootloader mode is pretty easy. I'm currently using the V-USB HIDBootloader project to do my bootloading. All you need to do, once the USB parts are all soldered together is to ground the pin that corresponds to the “+” symbol on the PCB (PC 0) when you plug it into your computer via USB. If that pin is grounded during power on, the chip goes into USB bootloader mode.  On the PC side, there is a GUI program for Windows that will let you program compiled AVR binaries (in .hex form). There is also code for a command line tool for this bootloader that you can compile yourself, but I've never used it.

Luke
I will do some more work with trying to use the Unix software tools on my Mac - since I don't have Windows - and I will document what my experiences are.

Writing Code

This is the easiest part, hopefully. I write all my code in AVR Studio, but use whatever you want. You'll just need something that compiles code into standard .hex binary files for the ATmega88 or 168, The one caveat to mention is that if you want to communicate via USB, you'll need to use the V-USB library, and the PCB has a design issue that somewhat gets in the way. The V-USB library is hardware-interrupt dependent, and the usual example code always uses INT0. Me being an idiot and wanting to put the 2 USB pins next to each other and out of the way, went ahead and moved the USB data pins to the two closest to VCC on the chip, which moves the interrupt data pin (D+) to INT1 on the chip. V-USB can deal with this just fine; however, you need to edit the files in your usbconfig.h file as such:

#define USB_CFG_IOPORTNAME    D
/* This is the port where the USB bus is connected. When you configure it to
 * "B", the registers PORTB, PINB and DDRB will be used.
 */

#define USB_CFG_DMINUS_BIT    4
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
 * This may be any bit in the port.
 */

#define USB_CFG_DPLUS_BIT     3
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
 * This may be any bit in the port. Please note that D+ must also be connected
 * to interrupt pin INT0! [You can also use other interrupts, see section
 * "Optional MCU Description" below, or you can connect D- to the interrupt, as
 * it is required if you use the USB_COUNT_SOF feature. If you use D- for the
 * interrupt, the USB interrupt will also be triggered at Start-Of-Frame
 * markers every millisecond.]
 */

/* ----------------------- Optional MCU Description ------------------------ */
/* The following configurations have working defaults in usbdrv.h. You
 * usually don't need to set them explicitly. Only if you want to run
 * the driver on a device which is not yet supported or with a compiler
 * which is not fully supported (such as IAR C) or if you use a different
 * interrupt than INT0, you may have to define some of these.
 */

/* #define USB_INTR_CFG       MCUCR */ // register where interrupt features are configured
 #define USB_INTR_CFG_SET     ((1 << ISC10) | (1 << ISC11)) //feature bits to set
/* #define USB_INTR_CFG_CLR   0 */ // feature bits to clear
/* #define USB_INTR_ENABLE    GIMSK */ //register where interrupt enable bit resides
 #define USB_INTR_ENABLE_BIT  INT1 // bit number in above register
/* #define USB_INTR_PENDING   GIFR */ // register where interrupt pending bit resides
 #define USB_INTR_PENDING_BIT INTF1 // bit number in above register
 #define USB_INTR_VECTOR      SIG_INTERRUPT1 // interrupt vector

Hopefully that should get you started!

If you have any questions, you can ask them on the OpenChord.org forums, or e-mail me at develop@openchord.org.

Thanks, Alan Chatham

project/member/dormant/open_chord.txt · Last modified: 2015/04/16 20:22 by projectgus