I have the ATMega2560 16AU. I have noticed that when I do taskDelayFromNow(2000); there is only a one second delay. I have defined F_CPU=16000000UL in the symbols of my compiler however, the delay is still half of what is should be. I know this code was written with 8MHz in mind, what can I do to properly configure the system for 16MHz?
Brandon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Probably you are aware of this, but just to be certain: you know that the software can only scale down the frequency and that the maximum frequency the internal oscillator can run is 8MHz. So, in order to run at 16 MHz on the ATMega2560 you need an external crystal. And of course the external voltage must be sufficient. With the 16MHz crystal mounted and the proper fuses set (see manual) this device should run at 16MHz.
Ahh okay, that makes a lot of sense. I was thinking that 2000 meant 2000 milliseconds == 2 seconds. Thank you clearing this up for me. (Also, this is the R3 version of this board and it is the 16 MHz chip with a 16MHz external crystal and I sure from the factory they have set it to run at 16MHz.)
Thanks again!
Brandon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the ATMega2560 16AU. I have noticed that when I do taskDelayFromNow(2000); there is only a one second delay. I have defined F_CPU=16000000UL in the symbols of my compiler however, the delay is still half of what is should be. I know this code was written with 8MHz in mind, what can I do to properly configure the system for 16MHz?
Brandon
Femto OS can run perfectly on 16MHz, You need to modify the file femtoos_ATmega2560.asm in the femtoos_devices directory. Change
into
I know this is not a very elegant solution. In the next version you will be able to set the frequency in the configuration file.
Hmm… I have changed this and done a clean rebuild. However, the delay's are still half as long as they should be.
For example a taskDelayFromNow(2000); will delay for only 1 second.
Probably you are aware of this, but just to be certain: you know that the software can only scale down the frequency and that the maximum frequency the internal oscillator can run is 8MHz. So, in order to run at 16 MHz on the ATMega2560 you need an external crystal. And of course the external voltage must be sufficient. With the 16MHz crystal mounted and the proper fuses set (see manual) this device should run at 16MHz.
Then make sure that (in the configuration)
and you should be ok.
The tick frequency can be deduced from
In this case
so that
will indeed take approximately 1 sec.
Maybe i do not get the point … ?
Ahh okay, that makes a lot of sense. I was thinking that 2000 meant 2000 milliseconds == 2 seconds. Thank you clearing this up for me. (Also, this is the R3 version of this board and it is the 16 MHz chip with a 16MHz external crystal and I sure from the factory they have set it to run at 16MHz.)
Thanks again!
Brandon