2

I've been programming an ATMega1284 using the Arduino IDE with the MightyCore package. I'm now trying to migrate to Atmel Studio. Atmel Studio (7.0) will now compile the sketch and all required libraries (that took some time) and upload the output via USBAsp to the ATMega (Essentially just calling avrdude). However...

The uploaded sketch is running differently. It seems slower. For example, the Tone() function seems to output a lower pitch. My best guess is that Atmel Studio has the xtal/clock setting wrong, but I can't find where to inspect/change it?

I'm using a 12mhz external xtal, and can only communicate with the chip via UART. If I upload the sketch from Arduino IDE then it reverts back to normal.

5
  • 1
    Do you have correct F_CPU in project?
    – KIIV
    Nov 2 '20 at 21:32
  • Thanks KIIV, where would I find that? (Apologies, new to Atmel Studio) Nov 3 '20 at 11:08
  • First result of Google showed where to find it. That fixed the problem, Thank you @KIIV Nov 3 '20 at 11:15
  • For anybody else who comes across this: In the Solution Explorer, Click on ArduinoCore, click on the spanner icon, go to Toolchain, and for both C and C++ compilers, go to Symbols, and have a look at F_CPU. Repeat the above for the sketch. Nov 3 '20 at 11:20
  • Or Alt-F7 (Project - 'projectname' properties), click on Toolchain, then Symbols under AVR/GNU C compiler. Also don't forget to set the correct fuses, under Device Programming (Ctrl-Shift-P)
    – Swedgin
    Nov 3 '20 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.