Category Archives: atmel

Minimus 32 Dev Board – LUFA drivers and Atmel Studio 6.1

So I bought a Minimus32 Development board from [shortlink url=”http://www.modtraders.co.uk/minimus-32-avr-usb-development-board.html” title=”Mod Traders”]

minimus32

Couple of reasons for the purchase, Its was cheap, and it had a small processor and USB support out of the box.

OK, 1 and 2 are true, 3 is a little more complex.

After trawling the internet All I found was out of date information, information on the original Minimus board, or information using an old version of Atmels IDE. Having struggled in the past with old IDE’s I decided to use the newest one and brave it out.

So, For Windows…

You can download Atmel’s latest IDE free from here [shortlink url=”http://www.atmel.com/microsite/atmel_studio6/” title=”http://www.atmel.com/microsite/atmel_studio6/”] It is a Visual Studio based IDE and looks pretty good. Unfortunately there is no support for the bootloader contained in the minimus32 board.

So to get a hex image onto the Minimus 32 you need Flip downloadable for free here [shortlink url=”http://tinyurl.com/7jqeg3l” title=”http://www.atmel.com/tools/FLIP.aspx”]

Braving the new environment I cut and pasted a demo code sample (blink )

[code]

#include <avr/io.h>
#define F_CPU 16.000E6
#include <util/delay.h>
#include <avr/wdt.h>

void init_ports(void)
{
PORTB = 0b00000000;
DDRB = 0b00000000;

PORTC = 0b00000000;
DDRC = 0b00000000;

PORTD = 0b00000000;
DDRD = 0b01100000; // Set LEDs as output
}

int main(void)
{
MCUSR &= ~(1 << WDRF);
wdt_disable();
init_ports();

while(1)
{
if (PIND & 0b10000000) {
PORTD = PORTD & ~0b01000000;
PORTD = PORTD | 0b00100000;
_delay_ms(200);

PORTD = PORTD & ~0b00100000;
PORTD = PORTD | 0b01000000;
_delay_ms(200);
} else {
PORTD = PORTD | 0b01100000;
}
}
}

[/code]

I set the uP to ATMEGA32U2 hit build and It compiled first time.

Went into Flip, loaded the .hex file and sent it to the Minmus32. After a little playing with the buttons it ran.

(Tip: to put the Minimus into “Load” mode you need to press RESET, press HWB, release RESET and release HWB, just roll your finger over the buttons)

So a USB example.

I found that you can get the latest version of the LUFA libraries from here [shortlink url=”http://tinyurl.com/mx8flmo” title=”http://gallery.atmel.com/Products/Details/47ba24a4-d17b-4fed-b244-f5998b3d789d”] and the are already formatted for Studio 6

Loaded the Libraries and tried the demo project for USB to RS232

It compiled, but wouldn’t run.

Cutting a long story short there were a number of things wrong. The Processor speed was incorrect, the target board wasn’t set correctly and the LUFA libraries didn’t contain the code specific to the Minimus32 Board.

So. to fix these.

In Atmel Studio 6, Goto Project->Toolchain -> AVR/GNU C Compiler -> Symbols

Ensure they look like this

[code] F_CPU=16000000UL
F_USB=16000000UL
ARCH=ARCH_AVR8
USE_LUFA_CONFIG_HEADER
BOARD=BOARD_MINIMUS
USE_STATIC_OPTIONS=”(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)”
[/code]