Go Down

Topic: Replaced resonator on Arduino Mega 2650. Issue with frequency. (Read 579 times) previous topic - next topic

SanjaB

Hi. I have a 3D-printer with control board based on Arduino 2650.

I have accidentally destroyed one element on the board, SMD resonator. It has Y1 label on schematics,



The part must be CSTCE16M0V53-R0 resonator by Murata of unknown frequency.

My local electronics shop didn't have these, so I purchased 16Mhz and 20Mhz resonators and soldered them.



16Mhz didn't work, but 20Mhz was OK.

I am not 100% sure that the old resonator was 16Mhz. And I am not sure why the new 16Mhz resonator didn't  work - was it incompatibility or mechanical fault.

My question is - is there any way to check on what frequency my Arduino Mega 2650 board was designed to work and is there any easy way to "adjust" its internal clocks if I have "overclocked" it?

septillion

The most obvious place to look would be the board spec page:
https://www.arduino.cc/en/Main/ArduinoBoardMega2560

Quote
Clock Speed    16 MHz
So yeah, you overclocked it. Will work just fine, only everything relying on timing will be off by 25%...
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

SanjaB

No, most obvious answer is not always correct. As I said, I have custom 3d-printer control board which is based on Arduino Mega and uses Arduino IDE to flash its program ("Repetier").

The producers of such boards sometimes use 16Mhz clocks, sometimes 20Mhz clocks. It makes sense because calculating trajectories for 3d prints and running 4 stepper motors is a very compute-intensive task.

And my question is - how to determine which clock rate was it designed for? Most obvious solution would be to program simple timer that counts minutes. If it will be off by 20 divided by 16, crystal is of wrong type. But this is lame, there must be an easier option.

septillion

If you could program it from the IDE as a Mega it was running at 16Mhz :)

If you programmed it as something else, open the board.txt file in which that board is defined and you'll find a clock speed parameter for that board :)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

cif40

So yeah, you overclocked it. Will work just fine, only everything relying on timing will be off by 25%...
What happend if I set Mega board to run at 1 MHz but I used it with a resonator 20MHz? Is it still running? Are there other effects beside the incorrect timing?

Thanks,

CrossRoads

You are setting it to run at 1 MHz by using the system clock divide by 8 feature?
Clock division factors available are 1, 2,3,4,8,16,32,64,128,256.
So the typical divisor of 8 with 20MHz resonator would yield 2.5 MHz, which would more than likely result in some pretty odd baud rates.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

septillion

If you only tell the compiler it runs at 1MHz (aka, change the boards.txt speed) then yeah, everything will work. But everything timing related will be 20x to fast. So forget serial :p (yeah, that's time related.)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Go Up