use the USB10 SPI portal and digital I/O lines to program
the AVR of a nesting Wasp. The USB10 programming
function is supported by a PC application called USB10Prog
which is a free download from the SOC Robotics website.
What would ANY microcontroller project be without
LEDs? As you’ve probably already figured out, the l-led
command allows us to illuminate or extinguish the red and
green LEDs that are indigenous to the USB10.
Like the l-led command, b-boot is pretty obvious as to
what the function performs. When b-boot is selected, the
boot routine loaded in the high memory of the
AT90USB162 kicks off. A new program is loaded with the
help of an Atmel application called FLIP.
The Ferret control program does all of this and NEVER
backs up into a corner.
Where’s the Code?
It’s already written. The Wasp Data Logger application
not only contains data logger routines, it contains separate
C modules that enable and exercise the AT90USB162’s SPI
portal, TWI module, UART, and I2C functions. You’ll also
find a C module that initializes all of the Wasp hardware.
There’s even C code for a monitor and the interrupt
handlers. If that’s not enough canned C code for you,
here’s an excerpt from the utilities module that writes data
to the Wasp EEPROM:
// Function to initiate an EEPROM write
// writes the specified data byte to the
specified location
// this will fail if the EEPROM is not ready!
void RTEEPROMwrite(int location, unsigned char
databyte)
{
unsigned char savedSREG;
EEAR = location; // set address
EEDR = databyte; // set data
savedSREG = SREG; // keep setting so
// it can be
// restored
// disable interrupts
// set “write enable” bit
// set “write” bit
// restore SREG
CLI();
EECR |= BIT(EEMWE);
EECR |= BIT(EEWE);
SREG = savedSREG;
EEAR = 0;
}
// function to test if the EEPROM is ready
// for a read or write operation
// returns non zero if ready, zero if not
// ready
unsigned char RTEEPROMReady(void)
{
return !(EECR & 0x02);
}
58 SERVO 09.2010
I included the EEPROM ready code to show you that
everything you need to interface your C code to a Wasp is
most likely already contained in some form or fashion
within the data logger application modules. There are even
C routines in the data logger modules that can be called to
blink the LEDs.
To make the assimilation of the canned Wasp C
routines easy, the entire Wasp Data Logger application was
written using ImageCraft ICCVX for AVR and Atmel’s AVR
Studio. AVR Studio is a free download and the ImageCraft
C compiler is as inexpensive as C compilers go. ImageCraft
also offers a 45 day trial period to allow you to fall in love
with their AVR C compiler. SOC Robotics offers a huge
bang for the firmware buck, as well. You can download the
Wasp Data Logger application, the AT90USB162
Bootloader, the UB10Prog programmer application, and
Ferret control program for free from the SOC Robotics
website.
I had a blast working with the Wasp and didn’t get
stung one time. SV
Fred Eady can be reached via email at fred@edtp.com
Sources:
ImageCraft
ImageCraft C Compiler for AVR
www.imagecraft.com
SOC Robotics
Wasp
USB10 Smart AVR USB Processor
www.soc-robotics.com
Atmel
AVR Studio
AVRISP mkII
www.atmel.com