How to get started with the Atmega32u4 Breakout Board+ on Linux

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
msr
 
Posts: 6
Joined: Wed Mar 17, 2010 7:23 pm

Re: How to get started with the Atmega32u4 Breakout Board+ o

Post by msr »

I just received an adafruit atmega32u4 breakout board and I was trying to follow this tutorial as well as this page: http://ladyada.net/products/atmega32u4breakout/ and I can't get it to work. The boot LED never stops blinking (fading in, fading out)
Im on Linux (ElementaryOS) and thiis is my Makefile:
all:
avr-gcc -O1 -mmcu=atmega32u4 -Wall -c main.c -o main.out
avr-objcopy -O ihex main.out main.hex
upload:
avrdude -p m32u4 -P /dev/ttyACM0 -c avr109 -U main.hex
clean:
rm -f main.out
After reset button is pressed I try to upload the program, this is the avrdude output:
avrdude -p m32u4 -P /dev/ttyACM0 -c avr109 -U main.hex

Connecting to programmer: .
Found programmer: Id = "LUFACDC"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (46 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 46 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 46 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 46 bytes of flash verified

avrdude: safemode: Fuses OK (H:C3, E:D0, L:FC)

avrdude done. Thank you
Any suggestion?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to get started with the Atmega32u4 Breakout Board+ o

Post by adafruit_support_mike »

The Makefile looks okay and the output from `avrdude` shows a successful upload. What's in the source code you're compiling and loading?

msr
 
Posts: 6
Joined: Wed Mar 17, 2010 7:23 pm

Re: How to get started with the Atmega32u4 Breakout Board+ o

Post by msr »

adafruit_support_mike wrote:The Makefile looks okay and the output from `avrdude` shows a successful upload. What's in the source code you're compiling and loading?
Did you try it on the board? avrdude actually shows a successful upload message but the board doesn't quit from boot mode.
Finally, I managed to get it working by trying the second makefile provided on the first page of this topic (the bigger makefile). I'm currently trying to figure out which part of that makefile allowed to solve the problem since there are too many flags and steps I don't need.

edit:
This is the code I'm compiling:

Code: Select all

#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>

int main (void)
{	
   DDRE = (1<<6); //set up pin 0 on port B

   while (1) //loop forever
    {
        PORTE = (1<<6); //set pin 0 on port B high
       _delay_ms(100);
       PORTE = 0x00; //set pin 0 on port B low
       _delay_ms(100);
   }
   return 0;
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”