Quote Originally Posted by Bartchou View Post
It is probably because the crystal and 22PF capacitor mismatch.
So you hand touches a short time changed your capacitor, so a short time is OK
the others reason:
one of your 22p capacitor is bad.
the wire connect to crystal oscillator is too long.
the capacitors is not connect GND.
I like to know how to check weather the capacitor is good or bad,I have a ESR meter but it only test capacitor smallest to 1 uF

My crystal is mounted next to the MCU,the capacitor is just next to the crystal

I have used the capacitor ground to test the voltage of the board,its works



I switch the capacitor from 16MHz to 4 MHz and reconfigure the program,it works fine

I google the crystal selection and found that the crystal calculation is as follow

C = (CL - Cstray)* 2
where CL is the load capacitance of the crystal
Cstray is the capacitance of the PCB lead and and crystal casing,maximum around 5 pF

So for my 16MHz crystal,datasheet shows that the load capacitance is 12pF,plug the figure into the equation , the capacitor should be 2 * (12-5) = 14pF,is that correct?