CPU clock Speed of Arduino Mega2560 Rev 3 board, How to check and modify?

Hi All,

I am using Mega 2560 Rev 3 board. Having problem to get clock speed faster than 1 microsecs when using SPI.

Eventhough I set SPI as


SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE3)); // 4M clock


I did not put in any code for SPI clock division at all. I suspect my board is only running at 1 Mhz clock which is giving 1 microsecs clock.

May I know,

  1. what is best method or tool to use to check MEGA2560 R3 is running at what CPU speed.
  2. If it is 1MHz , how to configure Mega2560 to run at the 16Mhz speed, I check the board it has a 16M crystal.

Read the ATmega2560 specs and it shows CKSEL & SUT. That is the chip, but how do I set this Arduino Mega2560 board to 16Mhz?

Requesting advice from experts here, thank you.

You're seeing zebras. The Arduino Mega runs at 16MHz- if it was running at a different frequency you would have to use a different board selection when you upload a sketch, or it wouldn't work.

Hi Henry,

Thank you for the reply.
Yes, the schematic shows, 16MHz crystal, physical PCB has crystal connected to pins too.
However, it is very tiny and I cannot make out what value it is.
There is a huge crystal but it is physically closer to the ATMEGA16U2.

Is there a way, for me to verify the CPU (ATMEGA2560-15AU) is running at 16 MHz.???

The ceramic resonator that the board uses is really tiny, the case will be marked with the frequency but you might need a microscope to read it.
Let me expand a bit on my earlier answer. The bootloader that the Arduino uses to communicate with a computer is set to use a specific baud rate. If the Arduino was running at a different speed (say 1MHz rather than 16MHz) then the communication wouldn't work, since changing the clock frequency would change the baud rate.
If the computer can communicate correctly with the Mega (ie, if you can successfully upload a sketch) then the Mega is running at 16MHz.

Is there a way, for me to verify the CPU (ATMEGA2560-15AU) is running at 16 MHz.???

Configure the Blink sketch to flash the LED once per second.

Hi srnet,

I will test it out.

By using the delay(1000); // ???

Thank you.