<p>Either:</p>
<ul>
<li>You have a clock prescaler set, or;</li>
<li>You are not using the external oscillator on the board.</li>
</ul>
<p>There are some internal fuses that set the clock frequency divider and the clock source and maybe your new IC has the incorrect fuses set.</p>
<p>That is to say, they may be factory default, but they are not the same as the controller board comes shipped with.</p>
<p>You probably want to check <em>both</em> settings as the factory defaults of your replacement IC are probably not what you expect, or desire.</p>
<p>Check the <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/doc8059.pdf" rel="nofollow noreferrer">ATmega1284P datasheet</a> for details.</p>
<hr />
<h1>Prescaler</h1>
<p>Section <strong>7.12.2 CLKPR - Clock Prescale Register</strong>, page 38. That is for the general clock frequency, and shows the register <code>CLKPR</code> in particular <strong>Bits 3:0</strong>.</p>
<blockquote>
<p><a href="https://i.sstatic.net/QFuhU.png" rel="nofollow noreferrer" title="7.12.2 CLKPR - Clock Prescale Register"><img src="https://i.sstatic.net/QFuhU.png" alt="7.12.2 CLKPR - Clock Prescale Register" title="7.12.2 CLKPR - Clock Prescale Register" /></a></p>
</blockquote>
<p>Or section <strong>7.11 System Clock Prescaler</strong></p>
<blockquote>
<p><a href="https://i.sstatic.net/VaEq4.png" rel="nofollow noreferrer" title="7.11 System Clock Prescaler"><img src="https://i.sstatic.net/VaEq4.png" alt="7.11 System Clock Prescaler" title="7.11 System Clock Prescaler" /></a></p>
</blockquote>
<h1>External clock</h1>
<p>Section <strong>7.2 Clock Sources</strong>, shows that <code>CKSEL</code> <strong>Bits 3:0</strong> set which clock is used, internal or external. You presumably want to use the external clock so set all four bits to zero</p>
<blockquote>
<p><a href="https://i.sstatic.net/bfJGB.png" rel="nofollow noreferrer" title="7.2 Clock Sources"><img src="https://i.sstatic.net/bfJGB.png" alt="7.2 Clock Sources" title="7.2 Clock Sources" /></a></p>
</blockquote>
<hr />
<p>To set, or examine, any of the registers, you have to use <code>usbasp</code>. I can't remember what the commands are. If you look on <a href="https://arduino.stackexchange.com/">SE.Arduino</a> or <a href="https://electronics.stackexchange.com/">SE.Electronics</a> I am sure that there is a question with the answer. I vaguely remember having the same problem with an ATtiny.</p>

CC BY-SA 4.0
2021-08-14T08:57:20.423Z
I tested by using this command `avrdude -c usbasp -patmega1284p  -U lfuse:w:0b01100000:m`  default value  is 0x62 = 01100010 so I changed bits 3:0 to zero new value 0x60 = 01100000  and the MCU no longer responds.
ioen jid
CC BY-SA 4.0
2021-08-14T09:56:42.447Z
Is there a jumper that you need to make, in order to apply the external clock? Maybe that is missing. There is clearly a 16 MHz crystal on the board. Can you check (with an oscilloscope) whether there is a clock signal, *both* from the crystal and on the MCU clock pin? Otherwise, the solution isn't easy. While the chip is not dead, you will need to apply an external clock, see [this post](https://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr). You might have to remove the SMD, or add a wire to a clock, external to the whole board, using a 555 timer, for example.
Greenonline
CC BY-SA 4.0
2021-08-14T10:02:42.293Z
I can't see a jumper pin for clock select, looking at the image in [this PDF](https://github.com/makerbase-mks/Datasheet/blob/master/Chinese%20datasheet/MKS%20MELZI%20V2.0%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8C.pdf), it seems to be "hard wired". Maybe check that the CLOCK line is soldered correctly, by visual examination, and by checking with a oscilloscope. It just sounds like there isn't an external CLOCK signal getting through. Check the clock circuit, maybe the crystal, or the pair of 22 pF capacitors (`C11`), or other supplementary components (`C14` or `R24`) are damaged?
Greenonline
CC BY-SA 4.0
2021-08-15T04:55:55.163Z
I replaced the crystal with a new one and checked the line - that's all connected  but same issue. My board is a little bit different from the original, so I don't have `C11`  `C14` `R24`. Its produced by Tronxy  "cxy v.2-0508". I have two capacitors on crystal pintout  each leg have one here [link](https://www.tronxyonline.com/Tronxy-Ramps1-4-Update-Version-3D-Printer-Reprap-mainboard-CXY-V-2-p69319.html) of Tronxy page
ioen jid
CC BY-SA 4.0
2021-08-15T05:38:55.397Z
It is difficult to see the component names/numbers from either your photo and the photo in the link, but there seem to be two resistors (next to each other) and two capacitors on the other side (in a line). Apart from checking to see if the components (R and C) are good,  you would need to see if there is a clock signal using a oscilloscope to see what is really happening - otherwise we are just guessing. Either that, or apply an external clock source to get the MCU running, so that you can flash it back to using the internal clock again (`0x62`). Then you could check the prescaler setting.
Greenonline
CC BY-SA 4.0
2021-08-15T08:42:58.657Z
If the MCU is set back to using the internal clock, then the speed will be 8 MHz so am I supposed to flash Marlin using `1284p` with `8 MHz` option  not `16 MHz`, right ? On the oscilloscope, the signal looks weird, it is not a square signal. The only hope to ask Tronxy for help. i will update with a solution soon
ioen jid
CC BY-SA 4.0
2021-08-15T09:51:26.507Z
The internal clock speed will be determined by the prescaler value. Did you check to see what that was, before setting the fuses for the external clock? The waveform would not be square, if there are capacitance issues (leakage etc.). Maybe one of the tracks on the PCB has been damaged? Could you post a **new question** about the missing external clock (as your original question has been answered, this is a new question), and add a photo/screenshot of the scope output, showing the waveform? In the new question, refer back to this question, using the URL of this question, as they are related.
Greenonline
CC BY-SA 4.0
2021-08-15T10:10:04.653Z
You need to ask a *new question* for the new issue of the missing clock. Once you open a new question, I can copy over the information from these comments for you. Many thanks in advance.
Greenonline
CC BY-SA 4.0
2021-08-13T08:34:19.967Z
2021-08-13T12:46:20.973Z
2021-08-13T12:46:20.973Z
Greenonline
<p>This is my board MKS Melzi v2.0 cloned</p>
<p><a href="https://i.sstatic.net/89BqI.png" rel="nofollow noreferrer" title="MKS Melzi v2.0 cloned"><img src="https://i.sstatic.net/89BqI.png" alt="MKS Melzi v2.0 cloned" title="MKS Melzi v2.0 cloned" /></a></p>
<p>I replaced the MCU (the <em>actual</em> IC) with new ATmega1284P 16 MHz, because the old MCU was damaged - the reason was that the fan got dusty and the power line became unstable. I replaced the MCU with the exact same model.</p>
<p>I have tried to flash it many times using <code>usbasp</code>. It works but same issue system menus boot splash are still so slow it's painful. It takes minutes on an old Marlin version 1.1.6, hours on a new Marlin 2.x</p>
<p>I think it's something related to MCU (crystal oscillator frequencies). Maybe the system uses an internal crystal so the MCU got stuck.</p>
<ol>
<li>How can I switch to an external crystal?</li>
<li>If it's not, then what can cause the problem?</li>
</ol>
<p>Firmware links:</p>
<ul>
<li>The old firmware link:
<a href="https://github.com/nathantsoi/Marlin/tree/tronxy-x5s-1.1.6" rel="nofollow noreferrer">https://github.com/nathantsoi/Marlin/tree/tronxy-x5s-1.1.6</a></li>
<li>The new firmware is last stable firmware 2.0.9.1 <a href="https://github.com/MarlinFirmware/Marlin/tree/2.0.9.1" rel="nofollow noreferrer">https://github.com/MarlinFirmware/Marlin/tree/2.0.9.1</a></li>
</ul>

CC BY-SA 4.0
2021-08-16T12:45:13.507Z
Just as a note, Your board looks like a clone of the Zonestar ZRIB v2 mainboard, which derives from Melzi
craftxbox
<marlin><electronics><tronxy>
TronXY X5S system (Marlin) - Very Slow menus
ioen jid
# TronXY X5S system (Marlin) - Very Slow menus

(Asked by: username_0 on 2021-08-13)

This is my board MKS Melzi v2.0 cloned

[![MKS Melzi v2.0 cloned](https://i.sstatic.net/89BqI.png "MKS Melzi v2.0 cloned")](https://i.sstatic.net/89BqI.png "MKS Melzi v2.0 cloned")

I replaced the MCU (the *actual* IC) with new ATmega1284P 16 MHz, because the old MCU was damaged - the reason was that the fan got dusty and the power line became unstable. I replaced the MCU with the exact same model.

I have tried to flash it many times using `usbasp`. It works but same issue system menus boot splash are still so slow it's painful. It takes minutes on an old Marlin version 1.1.6, hours on a new Marlin 2.x

I think it's something related to MCU (crystal oscillator frequencies). Maybe the system uses an internal crystal so the MCU got stuck.

1. How can I switch to an external crystal?
2. If it's not, then what can cause the problem?

Firmware links:

* The old firmware link:
  <https://github.com/nathantsoi/Marlin/tree/tronxy-x5s-1.1.6>
* The new firmware is last stable firmware 2.0.9.1 <https://github.com/MarlinFirmware/Marlin/tree/2.0.9.1>

**Tags:** marlin, electronics, tronxy
> **Comments:**
> **username_1**: Just as a note, Your board looks like a clone of the Zonestar ZRIB v2 mainboard, which derives from Melzi  

---

## 1 answers

### Answer by username_2 on 2021-08-13. Score: 1 | Accepted answer

Either:

* You have a clock prescaler set, or;
* You are not using the external oscillator on the board.

There are some internal fuses that set the clock frequency divider and the clock source and maybe your new IC has the incorrect fuses set.

That is to say, they may be factory default, but they are not the same as the controller board comes shipped with.

You probably want to check *both* settings as the factory defaults of your replacement IC are probably not what you expect, or desire.

Check the [ATmega1284P datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/doc8059.pdf) for details.

---

# Prescaler

Section **7.12.2 CLKPR - Clock Prescale Register**, page 38. That is for the general clock frequency, and shows the register `CLKPR` in particular **Bits 3:0**.

> [![7.12.2 CLKPR - Clock Prescale Register](https://i.sstatic.net/QFuhU.png "7.12.2 CLKPR - Clock Prescale Register")](https://i.sstatic.net/QFuhU.png "7.12.2 CLKPR - Clock Prescale Register")

Or section **7.11 System Clock Prescaler**

> [![7.11 System Clock Prescaler](https://i.sstatic.net/VaEq4.png "7.11 System Clock Prescaler")](https://i.sstatic.net/VaEq4.png "7.11 System Clock Prescaler")

# External clock

Section **7.2 Clock Sources**, shows that `CKSEL` **Bits 3:0** set which clock is used, internal or external. You presumably want to use the external clock so set all four bits to zero

> [![7.2 Clock Sources](https://i.sstatic.net/bfJGB.png "7.2 Clock Sources")](https://i.sstatic.net/bfJGB.png "7.2 Clock Sources")

---

To set, or examine, any of the registers, you have to use `usbasp`. I can't remember what the commands are. If you look on [SE.Arduino](https://arduino.stackexchange.com/) or [SE.Electronics](https://electronics.stackexchange.com/) I am sure that there is a question with the answer. I vaguely remember having the same problem with an ATtiny.

> **Comments:**
> **username_0**: I tested by using this command `avrdude -c usbasp -patmega1284p  -U lfuse:w:0b01100000:m`  default value  is 0x62 = 01100010 so I changed bits 3:0 to zero new value 0x60 = 01100000  and the MCU no longer responds.  
> **username_2**: Is there a jumper that you need to make, in order to apply the external clock? Maybe that is missing. There is clearly a 16 MHz crystal on the board. Can you check (with an oscilloscope) whether there is a clock signal, *both* from the crystal and on the MCU clock pin? Otherwise, the solution isn't easy. While the chip is not dead, you will need to apply an external clock, see [this post](https://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr). You might have to remove the SMD, or add a wire to a clock, external to the whole board, using a 555 timer, for example.  
> **username_2**: I can't see a jumper pin for clock select, looking at the image in [this PDF](https://github.com/makerbase-mks/Datasheet/blob/master/Chinese%20datasheet/MKS%20MELZI%20V2.0%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8C.pdf), it seems to be "hard wired". Maybe check that the CLOCK line is soldered correctly, by visual examination, and by checking with a oscilloscope. It just sounds like there isn't an external CLOCK signal getting through. Check the clock circuit, maybe the crystal, or the pair of 22 pF capacitors (`C11`), or other supplementary components (`C14` or `R24`) are damaged?  
> **username_0**: I replaced the crystal with a new one and checked the line - that's all connected  but same issue. My board is a little bit different from the original, so I don't have `C11`  `C14` `R24`. Its produced by Tronxy  "cxy v.2-0508". I have two capacitors on crystal pintout  each leg have one here [link](https://www.tronxyonline.com/Tronxy-Ramps1-4-Update-Version-3D-Printer-Reprap-mainboard-CXY-V-2-p69319.html) of Tronxy page  
> **username_2**: It is difficult to see the component names/numbers from either your photo and the photo in the link, but there seem to be two resistors (next to each other) and two capacitors on the other side (in a line). Apart from checking to see if the components (R and C) are good,  you would need to see if there is a clock signal using a oscilloscope to see what is really happening - otherwise we are just guessing. Either that, or apply an external clock source to get the MCU running, so that you can flash it back to using the internal clock again (`0x62`). Then you could check the prescaler setting.  
> **username_0**: If the MCU is set back to using the internal clock, then the speed will be 8 MHz so am I supposed to flash Marlin using `1284p` with `8 MHz` option  not `16 MHz`, right ? On the oscilloscope, the signal looks weird, it is not a square signal. The only hope to ask Tronxy for help. i will update with a solution soon  
> **username_2**: The internal clock speed will be determined by the prescaler value. Did you check to see what that was, before setting the fuses for the external clock? The waveform would not be square, if there are capacitance issues (leakage etc.). Maybe one of the tracks on the PCB has been damaged? Could you post a **new question** about the missing external clock (as your original question has been answered, this is a new question), and add a photo/screenshot of the scope output, showing the waveform? In the new question, refer back to this question, using the URL of this question, as they are related.  
> **username_2**: You need to ask a *new question* for the new issue of the missing clock. Once you open a new question, I can copy over the information from these comments for you. Many thanks in advance.  

---

