# TronXY X5S system (Marlin) - Very Slow menus

This is my board 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?

• Just as a note, Your board looks like a clone of the Zonestar ZRIB v2 mainboard, which derives from Melzi Aug 16, 2021 at 12:45

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 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.

Or section 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

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 or SE.Electronics I am sure that there is a question with the answer. I vaguely remember having the same problem with an ATtiny.

• 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. Aug 14, 2021 at 8:57
• 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. 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. Aug 14, 2021 at 9:56
• 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 of Tronxy page Aug 15, 2021 at 4:55
• 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. Aug 15, 2021 at 9:51
• 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. Aug 15, 2021 at 10:10