I connected a LED with a resistor to breakout pin C6, then in Atmel Studio I wrote the following code for an Atmega32 device:
Code: Select all
#ifndef F_CPU
#define F_CPU 16000000L // 16 MHz clock speed
#endif
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC = 0xFF; //Makes PORT Output
while(1) //infinite loop
{
PORTC = 0xFF;
_delay_ms(1000); //1 second delay
PORTC = 0x00;
_delay_ms(1000); //1 second delay
}
}
Then I wrote the following on the Arduino IDE and used the Leonardo profile to compile a hex file:
Code: Select all
void setup()
{
pinMode(5, OUTPUT);
}
void loop()
{
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
delay(1000);
}
In both cases I am using the same avrdude command to upload each hex file:
The hex files built with the Arduino IDE and Atmel Studio are of significantly different sizes (158 bytes with Atmel Studio vs 4,818 bytes with Arduino). I guess that has to do with the Arduino wrappers getting tacked on to the hex file. It does make me wonder if the problem has more to do with Atmel Studio not building a complete/proper hex file because I don't yet know how to use it or if there is an issue instead with the board...avrdude.exe -F -v -c avr109 -p m32u4 -U flash:w:Blinky.hex:i -P COM5