Hello, I have a problem migrating from the ATmega128A to the ATmega2561. I honestly think I have found a valid BUG.
I have a project that works well with the ATmega128A at 8Mhz. I took a sample board and dropped in an ATmega2561 which is pin-compatible. I use nothing but identifier labels to access port pins (no hard coded address anywhere).
The problem is that the ATmega2561 board moves proportionally slower. For example, leaving the setting at 8Mhz, the unit move 8X slower. If I use 4MHz, it moves 4X slower. If I use 1MHz, it works perfectly.
By 8X and 4X slower, I'm referring the time delays and baud rates I have observed.
I have another post regarding the Ow_Read() command. If I use 1Mhz for either processor, it doesn't work correctly. At first I thought these were separate issues, but now I see they are both related to the system clock.
By the way: I am using the internal RC oscillator.
Thank you, Richard V
Migrating Processors: clock registers not setting correctly
Re: Migrating Processors: clock registers not setting correc
Hi,
Have you tried toggling the CKDIV8 fuse bit ?
Regards,
Filip.
Have you tried toggling the CKDIV8 fuse bit ?
Regards,
Filip.
Re: Migrating Processors: clock registers not setting correc
Hello Filip. Changing the ClockDiv8 signal was the very first thing I did. After reading through Atmel's datasheets I found that I need to add some code to make the migration from the 128K part to the 256K part. I added in this code and all is well.
Here is my code:
// ***************** Support for ATmega2561 only. This will not work with the ATmega128A *****************
// Set up CPU clock
CLKPR = 0x80; // Set Bit 7 to 1 and all other bits to 0. This fixed the clock speed issue
CLKPR = 0x0; // Must be done within 4 cycles of the above command
// Disable JTAGEN
MCUCR = 0x80; // Disable JTAGEN //
MCUCR = 0x80; // Must be written twice, within 4 cycles
// *************************** END Support for ATmega2561 ***************************
Now I know this is the wrong forum to ask this, but how I do I create the BASIC version of the above code?
Thank you, Richard V
Here is my code:
// ***************** Support for ATmega2561 only. This will not work with the ATmega128A *****************
// Set up CPU clock
CLKPR = 0x80; // Set Bit 7 to 1 and all other bits to 0. This fixed the clock speed issue
CLKPR = 0x0; // Must be done within 4 cycles of the above command
// Disable JTAGEN
MCUCR = 0x80; // Disable JTAGEN //
MCUCR = 0x80; // Must be written twice, within 4 cycles
// *************************** END Support for ATmega2561 ***************************
Now I know this is the wrong forum to ask this, but how I do I create the BASIC version of the above code?
Thank you, Richard V