Projects/Minimus

MINIMUS AVR USB V1 Board

Hardware Information
NB the page below relates to the Minimus V1 which is 16K, the newer 32K version is basically the same but has its own page here

Add any V1 specific stuff here and general Minimus stuff the other page.

The Minimus AVR USB V1 board is an Atmel AT90USB162 processor board with USB interface and all I/O brought out to .1" pitch solder pads The board has a large amount of open source and free software already available.

The origins and low cost of the hardware are from the PS3 hack at the end of 2010 called PSGroove.

Thanks to members of the Reading Hackspace and help from London Hackspace we got a quantity of these boards at £2.63 each and further bulk purchases are still possible.

Minimus suppliers data provides a description, useful links, and some sample code.

AT90USB162 Datasheet describes the Processor in more detail.

The key additions over other small Atmel AtMega processors are:
 * USB Full speed device interface capable of offering different device types and classes(serial CDC, HID, ...)
 * Onboard voltage regulator providing 5V or 3.3V operation and interface
 * Retains USART, so offering USART plus virtual serial ports simultaneously

The key limitations are:
 * No I2C
 * No analogue to digital converters, analogue comparator might be used with PWM DAC
 * Limited Memory, 12K of remains when bootloader present. RAM is 512 bytes. Avoid too many text strings or at least keep them in program space!

Minimus do not publish the Schematic, though it has been reverse engineered with other useful hardware information here by Talpa Schematic and Hardware Information

Note: the above web page refers to the Minimus AVR USB 32K, which is variant of the board with an ATMega32u2 mounted. The schematic and circuit board appear identical for both boards

Reading using ISP the Minimus is shipped with the lock bits of the AT90USB162 set to:

LB = PROG_VER_DISABLED, BLB0 = NO_LOCK, BLB1 = SPM_DISABLE

LOCKBIT = 0xEC (valid)

And the fuse bits are:

BODLEVEL = 3V0, HWBE = [X], DWEN = [ ]. RSTDISBL = [ ] SPIEN = [X], WDTON = [ ], EESAVE = [ ], BOOTSZ = 2048W_1800 BOOTRST = [ ], CKDIV8 = [X], CKOUT = [ ], SUT_CKSEL = EXTXOSC_8MHZ_XX_258CK_65MS

EXTENDED = 0xF4 (valid)

HIGH = 0xD9 (valid)

LOW = 0x5E (valid)

Note: the Watchdog timer reset and the clock prescaler are set. Change this in application if you want different.

Getting Started
A new Minimus board has the Atmel DFU USB bootloader already installed and no application program present. To communicate to the DFU bootloader, the USB drivers for Atmel DFU must be correctly installed, and a compatible programmer application run under Windows or Linux. For Windows the GUI programmer is FLIP, and the FLIP package also includes BatchISB a command line version. For Linux the programmer is dfu-programmer. The role of the programmer application in conjuction with the Minimus bootloader is to program a .hex file into the flash memory of the AT90USB162 chip. Installing these programming applications and drivers does not interfere with other loaders and drivers such as those for Arduino.

You can get a detailed setup guide for the Atmel FLIP software and drivers here: setup PDF

And an example program which flash's the LED's and responds to the buttons here: led_test.hex and src. This hex file worked OK on my Minimus, but the source project files were not compatible with the latest AVR Studio 5 from Atmel, and also a hex file made from the provided source file had continual watchdog timeouts. A new AVR studio project and a fix to the watchdog disable code quickly fixes that, so you can now build you own hex files based on this using the available documentation and snippets of Atmega code from Arduino or elsewhere.

To create .hex files you need a compiler or development environment. The best is probably the AVR Studio 5 from Atmel. The Arduino IDE does not support the Minimus board.

I have put an AVRStudio 5.1 project here with the changes I made: avr-usb-162_led.zip

DFU Programmer Notes
When you use DFU-Programmer on linux, the first thing you want to do is erase the original ROM on the minimus. To do this

"sudo dfu-programmer atmega32u2 erase"

then feed it your new hexfile with

"sudo dfu-programmer atmega32u2 flash myhex.hex"

USB To Serial Project
The latest Arduino Uno uses an ATMega8U2 for the USB to serial interface in conjunction with the ATMega328 used for th Arduino code. The UNO USB to serial code is small enough to fit easily in the AT90USB162. The Minimus can therefore be used to provide an alternative to a USB serial cable to download to Arduino Pro Mini and similar boards. The link on the Minimus board allows it to be used with either 5V or 3.3V Arduinos.

The hardware configuration simply requires a 6 way .1" IDC female connector to go to the Arduino board as follows:

Arduino_Pin    Function   Colour    Minimus_Pin 1              Ground      Black    Gnd 2              Unused      Brown    None 3              Vcc         Red      Vcc      Wire may be left off if Arduino is self powered 4              Txd         Orange   PD3 5              Rxd         Yellow   PD2 6              DTR(Reset)  Green    PD4      Add 1K resistor to ground

The AVRStudio 5.1 Project is here: MinimusUno.zip. The USB to serial worked fie on my Arduino Pro Mini (5V/16MHz), but failed initially to work on an Arduino based board I built myself. The problem was with the automatic reset, and I added the 1K resistor from Reset(PD4) to ground as fitted on the Uno, this fixed the problem.

The interface uses the Lufa USB library, the project only contains part of the library.

The code is derived from Uno Loader sources from Arduino.

AVR_ISP Project
I recently built an arduino based board and needed to load the bootloader into the ATMega168 I used. The board had a 6 pin ICSP connector, so I built an AVR ISP MkII clone.

Don't cut the USB pin as the blog describes if leave out the Vcc wire in the cable so USB powers the ISP.

The firmware is available within the lufa projects. Change the makefile to use the Minimus board so the LEDS work properly.

For the 6 pin ICSP connector, I wired as follows:

ICSP_Pin       Function    Colour   Minimus_Pin 1              MISO        Black    PB3 2              Vcc         Brown    None     May connect to Minimus Vcc if you want ot power the board you are programming 3              SCK         Red      PB1 4              MOSI        Orange   PB2 5              RESET       Yellow   PB4 6              Ground      Green    Gnd

You can use this ISP programmer to change the bootloader in another minimus AVR.

Board is recognised as AVR ISP MkII by AVR studio. It may not be recognised by the Arduino IDE or AVRdude, because the AVR STudio USB drivers when installed override the Arduino drivers. You need to delete the USB drivers and use the Arduino supplied ones.

Can we use Arduino IDE and run Arduino code direct on the Minimus ?
I have not found a ready made solution to load Arduino sketches into the Minimus from the IDE. The Teensy product V1.0 was based on the AT90USB162 and does acheive this goal, however it uses a closed source HID bootloader(Halfkay). Dean Camera from Lufa made an version called TeesnyHID which uses conforms to the Teensy protocol, though larger. Teensy changed their software to not recognise TeensyHID so now a dead end.

Dean also has a CDC serial bootloader which works on the Minimus, but it conforms to AVR109 bootloader specification and not STK500 used by Arduino, so cannot be used with Arduino IDE. Works with AVRdude though.

The new Arduino Leonardo product will use the ATMega32u4 which has a higher spec. than the AT90USB162. This is not supporting the AT90USB162 and not yet completely working in the Beta. However, this has meant that the Minimus32 has been able to be modified with a new DFU Bootloader to work as an Arduino Leonardo, with some limitations, more information on the Projects/Minimus32 page.

For now, I am personally happy to use AVR Studio and existing avr 8 bit libraries. If anyone wants to start a project to use Leonardo on Minimus, I might help.

Using the Minimus as an AVR Firmware loader for the TVRR Controller
As an example of a project to use the Minimus, I am posting notes from Barnaby about how to use the Minimus for this rather specialist application. The TVRR is based on the RepRap 3D printer with specially designed electronics. Much of the build has been undertaken at RHS - MikeTheBee

Barnaby Shearer	- Posted on TVRRUG Google Group on Apr 16 2012

Here are some provisional firmware steps to get you going.

First clone Michel's git repository:

git clone https://github.com/buserror-uk/Marlin.git curl http://arduino.googlecode.com/files/arduino-0022-64-2.tgz | tar -xz cd Marlin/Marlin git checkout -b local origin/dev-michel

Then build. You will need a working version of avr-gcc on your path, then:

make

Then you need to know if your AVR has been programed with a bootloader. If so you should be able to upload strait away, though you may need to change PORT=/dev/arduino in the Makefile to PORT=/dev/ttyUSB0 or whatever your printer has been detected as.

make upload

If you don't have a bootloader you will need a AVR ISP to flash the firmware. If you have a Minimus they can be easily made into an ISP. Simply get LUFA:

svn checkout http://lufa-lib.googlecode.com/svn/trunk/ lufa-lib cd lufa-lib/Projects/AVRISP-MKII

Change the BOARD=USBTINYMKII to BOARD=MINIMUS in the makefile and build and upload using flip etc.

You then need to wire the Minimus to the 6-pin IDC header on the OMCA. http://www.batsocks.co.uk/readme/isp_headers.htm:

1 MISO  = PB3 2 Vcc   = Vcc 2 Sck   = PB1 4 MOSI  = PB2 5 RESET = PB4 6 Ground = Gnd

Then back in Marlin change the Makefile to:

AVRDUDE_PROGRAMMER = avrispmkII PORT = usb

and run:

make upload

I had best results also removing the -D from the AVRDUDE_FLAGS in the Makefile so that I got a full erase on each flash.

- Barnaby

Other useful links
Project YACC is a project from the London Hackspace for a AT90USB162 board and describes some Arduino integration.

Teensy is a product based on the Atmel USB devices including the AT90USB162 in early versions. It is the most integrated to Arduino, but the loader used is product specific and not open source. Some useful libraries and ideas.

DFU Programmer is a Linux command line loader program. Seems to be able to set fuses in AT90USB162, so more options, but higher risk.

Jamie Lentin provides some useful programming tips under Linux and an Arcade Joystick project.

YouTube Link Video of workshop held 1st April 2012, in 3 Parts.