Testing the Atmel Mega32U4
Tuesday, December 2nd, 2008
While I am wrangling with the appropriate board design, I needed to get started working with the underlying software so I ran up one of the six samples I was able to get from Cascade on a tqfp adapter from measure explorer.

The AtMega32U4 is the midrange model in the atmel usb chipset. It follows a new standard naming convention that atmel is adapting U for Usb 4 is for the 40 pins 32k, there is another 32K part the U6 which has the same pinouts as the 90usb646/647/1286/1287. The U4 does not have a legacy pinout however the q1000 price for this board is around $2 which makes it a very powerful chip for the money.
Dfu-Programmer.
There is a new release of dfu-programmer but it seems that they havent read the atmel doc on the signatures for the dfu recently. http://www.atmel.com/dyn/resources/prod_documents/doc7618.pdf
I need to check the memory and eeprom sizes against the datasheets for the parts. However the table in arguments.c should have the following entries; added new parts, corrected 64x and 82 signatures. (I will resubmit this patch).
/* ----- target specific structures ----------------------------------------- */
/* { "name", value, ,device_type, chipID,VID , MemSize,FPSize,abt,ifclass,eepgsz,eepmemsz} */
static struct target_mapping_structure target_map[] = {
{ “at89c51snd1c”, tar_at89c51snd1c, device_8051, 0×2FFF, 0×03eb, 0×10000, 128, false, true, 0, 0 },
{ “at89c5130″, tar_at89c5130, device_8051, 0×2FFD, 0×03eb, 0×04000, 128, false, true, 128, 0×03FF },
{ “at89c5131″, tar_at89c5131, device_8051, 0×2FFD, 0×03eb, 0×08000, 128, false, true, 128, 0×03FF },
{ “at89c5132″, tar_at89c5132, device_8051, 0×2FFF, 0×03eb, 0×10000, 128, false, true, 0, 0 },
{ “at90usb1287″, tar_at90usb1287, device_AVR, 0×2FFB, 0×03eb, 0×1F000, 128, true, false, 128, 0×0FFF },
{ “at90usb1286″, tar_at90usb1286, device_AVR, 0×2FFB, 0×03eb, 0×1F000, 128, true, false, 128, 0×0FFF },
{ “at90usb647″, tar_at90usb647, device_AVR, 0×2FF9, 0×03eb, 0×0F000, 128, true, false, 128, 0×07FF },
{ “at90usb646″, tar_at90usb646, device_AVR, 0×2FF9, 0×03eb, 0×0F000, 128, true, false, 128, 0×07FF },
{ “atmega32U6″, tar_atMega32u6, device_AVR, 0×2FFB, 0×03eb, 0×07000, 128, true, false, 128, 0×03FF },
{ “atmega32U4″, tar_atMega32u4, device_AVR, 0×2FF4, 0×03eb, 0×07000, 128, true, false, 128, 0×03FF },
{ “atmega16U4″, tar_atMega16u4, device_AVR, 0×2FF3, 0×03eb, 0×03000, 128, true, false, 128, 0×01FF },
{ “at90usb162″, tar_at90usb162, device_AVR, 0×2FFA, 0×03eb, 0×03000, 128, true, false, 128, 0×01FF },
{ “at90usb82″, tar_at90usb82, device_AVR, 0×2FF7, 0×03eb, 0×01000, 128, true, false, 128, 0×01FF },
{ NULL }
};
Then we test.
static
dfu-programmer atMega32U4 get bootloader-version --debug 20
target: atMega32U4
chip_id: 0x2ff4
vendor_id: 0x03eb
command: get
quiet: false
debug: 20
device_type: AVR
------ command specific below ------
name: 0
Bootloader Version: 0x00 (0)
(after reading the datasheets for the 3 classes of avr usb chips and looking at the way that the avr-gcc library calls the cpu names there are some changes to the above that I will post later.)
Next up some code.
Tried running up the midiGate software that I wrote last week and found my first bug for the chip in avr-libc
UBRR1 is redefined in iom32u4.h
#define UBRR1 _SFR_MEM16(0xCC) #define UBRR1L _SFR_MEM8(0xCC) #define UBRR0 0 #define UBRR1 1 ...
Which results in lvalue errors errors when trying to set the register to a given value. Setting the bit values as in some of the other registers seems to resolve this issue.
#define UBRR1 _SFR_MEM16(0xCC) #define UBRR1L _SFR_MEM8(0xCC) #define UBRR_0 0 #define UBRR_1 1 #define UBRR_2 2 #define UBRR_3 3 #define UBRR_4 4 #define UBRR_5 5 #define UBRR_6 6 #define UBRR_7 7 #define UBRR1H _SFR_MEM8(0xCD) #define UBRR_8 0 #define UBRR_9 1 #define UBRR_10 2 #define UBRR_11 3
This is a pretty braindead error so I am sure that its been resolved by now. I need to see if it is fixed in 1.6.3 or the current release candidate (since AvrMacPack is out of sync and has 1.6.2) And yes this is the case.
We have a device!!!








