Mandar Joshi
Member level 2
I am using STK600(ATmega2560) and ASF wizard for my project. I have written simple code for LED blinking. But whenever I use delay_ms from ASF it gives inaccurate delay.
As I am using ASF, I haven't defined F_CPU manually and default clock for ATmega2560 is 8MHz as per datasheet. So direct parameter passing to delay_ms() should give appropriate delay but it doesn't.
Fuse values are
Extended 0xFF
High 0x99
Low 0xE2
Is anything wrong with my fuse settings? I have another code for uart but it works fine with same fuse settings and it confirms default clock is 8MHz. So why I am getting inaccurate delays?
My code for LED blink is as follows:
- - - Updated - - -
How can I find what F_CPU it is taking by default? I don't have any debugger.
As I am using ASF, I haven't defined F_CPU manually and default clock for ATmega2560 is 8MHz as per datasheet. So direct parameter passing to delay_ms() should give appropriate delay but it doesn't.
Fuse values are
Extended 0xFF
High 0x99
Low 0xE2
Is anything wrong with my fuse settings? I have another code for uart but it works fine with same fuse settings and it confirms default clock is 8MHz. So why I am getting inaccurate delays?
My code for LED blink is as follows:
Code:
#include <asf.h>
int main (void)
{
// Insert system clock initialization code here (sysclk_init()).
board_init();
DDRB=0xff;
while(1)
{
PORTB=0x00;
delay_ms(2500);
PORTB=0xff;
delay_ms(2500);
}
// Insert application code here, after the board has been initialized.
}
- - - Updated - - -
How can I find what F_CPU it is taking by default? I don't have any debugger.