Introducing Minimus

Posted in AVR, Minimus on 2011-09-27 at 20:08:10 by Chris – 6 Comments

The AT90USB162 is a great little microcontroller. It has a bunch of peripherals including digital I/O, UART, SPI, & ADC; it has interrupts and timers too, but the really cool thing is it has a built-in full-speed (12Mbit/s) USB peripheral. The chips come preprogrammed with a four kilobyte bootloader, so you can flash up to twelve kilobytes of your code to it over USB without the need for special equipment, just a computer with a USB port.

And it's cheap too; Farnell price them at £2.22 each when you buy ten (or £1.99 if you buy the equivalent part ATMEGA16U2). There are lots of boards out there using this micro (including my own home-etchable Nanduino), but by far the cheapest is Minimus, at an amazing £4.95.

Be warned though, it's likely that these are being sold off cheap to clear stock, and it's unlikely that any more will be made. How do I know that? Well, my guess is that these things probably cost more than £4.95 to make! So I grabbed ten of them while I still could:

Preparation

Minimus is tiny, and as the name suggests, pretty minimal. Before you can start experimenting with it, you'll need to solder on some sockets so you can connect stuff to it. I use turned-pin SIL sockets. Just cut off a couple of lengths and solder them to the board edges. You can temporarily piggy-back a couple more in a transverse orientation to hold them straight whilst you solder:

It's a good idea to blob a bit more solder on the legs of the USB plug, to improve the mechanical robustness.

Toolchain

You'll need to install the AVR GCC compiler and the AVR 'C' Standard Library. On Windows you need to install Atmel FLIP and WinAVR, and whenever you see make dfu, do make flash instead. On Linux (Debian, Ubuntu) you can install these packages:

chris@wotan$ sudo apt-get install gcc-avr
chris@wotan$ sudo apt-get install avr-libc
chris@wotan$ sudo apt-get install dfu-programmer

Blinky Part 1

Just to make sure it works, you can try this blinky example:

chris@wotan$ curl -sL http://www.swaton.ukfsn.org/uploads/2011/09/blinky1.tar.gz | tar zxf -
chris@wotan$ cd blinky1/
chris@wotan$ make
chris@wotan$ sudo make dfu

...which toggles the A and B LEDs on the Minimus board (which are connected to PD6 and PD5 respectively). Something like this:

To get back to the bootloader, follow these steps:

  • Hold down the RESET button
  • Hold down the HWB button
  • Release RESET
  • Release HWB

Get into the habit of doing it this way, because the HWB button is connected to PD7 on the micro, so if your code happens to drive PD7 high, pressing the HWB button without first holding down RESET will short the output to ground, which the micro will not enjoy at all.

Blinky Part 2

You can attach external LEDs easily using staples to make the connection between boards. Here's a Minimus connected to my trusty S-AVR:LED board, incrementing a binary counter:

You can get the example counter code from here. The code itself is pretty simple:

int main(int argc, const char *argv[]) {

    uint8_t count = 0;

    // Init system clock, disable WDT...
    //
    clock_prescale_set(clock_div_1);
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    // Configure LEDs...
    DDRD = 0xFF;

    // Blinky...
    for ( ; ; ) {
        PORTD = count++;
        _delay_ms(100);
    }
}

Power Options: +3.3v

The factory default for Minimus is to take power from USB, and to operate at +5v. This means that the VCC pin will be at +5v, and whatever you attach must be 5v-tolerant. Unfortunately many interesting components these days are not 5v-tolerant (e.g SD cards). Luckily the micro on the Minimus has a built-in 3.3v regulator capable of powering the micro and supplying 50mA to external components. To use it, find the three power pads on the Minimus board, take a sharp scalpel and carefully cut the track between the centre-pad and the +5v pad. Check with a multimeter that the connection has indeed been severed, and when you're satisfied that it has, put a blob of solder between the centre pad and +3.3v:

Now when you power it up, the VCC pin will be at +3.3v instead of +5v, and the I/O lines will drive logic '1' at +3.3v instead of +5v.

Power Options: External +5v Supply

Taking power from USB is great because it's convenient and straightforward. But sometimes you need to take power from somewhere else. To do that you need to use your scalpel to sever the +5v line from the USB plug as shown below, but don't alter the configuration of the three power pads shown above. Then connect your external +5v supply to the VCC pin.

Power Options: External +3.3v Supply

Use your scalpel to sever the +5v line from the USB plug, then blob solder across all three power pads:

Finally, it's important for your firmware to disable the onboard +3.3v regulator if you're using an external +3.3v supply. So this should be the first line of main():

REGCR |= (1 << REGDIS);  // Disable regulator

Now you can connect your external +3.3v supply to the VCC pin.

More To Come...

That's all for now; I'll post more about Minimus in the coming days. Stay tuned, it gets more interesting!

6 Comments

[...] figured this would be a great first "nontrivial" application for one of my new Minimus boards. And here it [...]

Reply

Would it be possible to build a AVR programmer using the Minimus? Most designs for ISPs use a 12MHz xtal, but the one in Minimus is 16MHz. Any thoughts would be helpful!

Reply

I tried Dean Camera's AVRISP mkII clone firmware, and it works nicely. See here for details.

Reply

[...] noticed the other day that ModTraders UK are selling Minimus AT90USB162 boards for an amazing £2.50 in 100+ quantities. I'm guessing they're really not going [...]

Reply

[...] (AT90USB162), 2 LEDs, 2 switches and a USB connector – and thats about it!  Here is a good article from MakeStuff introducing the board and what it can [...]

Reply

[...] I was at it, I also reinforced the USB connector’s solder joints, as suggested here on the makestuff [...]

Reply

Leave a Reply

You may use TWiki syntax in your comment. Your email address will not be published.

| Home | About | Log in | Register |

Powered by WordPress & MakeStuff theme, with Silk icons