Go Down

Topic: boards.txt entry for atmega128 (Read 1 time) previous topic - next topic

Zandis

Mar 31, 2012, 09:53 pm Last Edit: Apr 02, 2012, 07:29 am by Zandis Reason: 1
Can somebody please help me to set up a boards.txt file for atmega128? I'm using a USBasp programmer to program my AVR's.
My current setup is as follows:
Code: [Select]
atmega128.name=ATmega128 (USBasp)
atmega128.upload.using=arduino:usbasp
atmega128.upload.maximum_size=129024

atmega128.bootloader.low_fuses=0xFF
atmega128.bootloader.high_fuses=0xDC
atmega128.bootloader.extended_fuses=0xFF
atmega128.bootloader.path=atmega
atmega128.bootloader.file=ATmegaBOOT_128.hex
atmega128.bootloader.unlock_bits=0x3F
atmega128.bootloader.lock_bits=0x2F

atmega128.build.mcu=atmega128
atmega128.build.f_cpu=8000000L
atmega128.build.core=arduino
atmega128.build.variant=standard


Actually this allows me to upload sketch to the microcontroller, but my code just doesn't gets executed.

Here's my test code:
Code: [Select]
void setup() {
// output
DDRD |= 1<<PD1;
}

void loop() {
// toggle
PORTD ^= 1<<PD1;
delay(200);
}


Once I upload it, my LED just does not start to blink. However, if I try to write the same in AVR studio and upload binary with khazhama programmer, connected LED blinks just fine.
Here's code from AVR studio that works just fine:
Code: [Select]
#define F_CPU 8000000
#include <avr/io.h>
#include <util/delay.h>

int main() {
// output
DDRD |= 1<<PD1;
while(1) {
// toggle
PORTD ^= 1<<PD1;
_delay_ms(200);
  }
 return 0;
}


So, can anybody tell me what's wrong with my arduino's setup? Why doesn't my sketch gets executed if uploaded by Arduino IDE?

Coding Badly


The ATmega128 timer 0 is considerably different from the "normal" ATmega timer 0.  My suspicion is the Arduino Core is not initializing it correctly.

Go Up