Delays seem variable - Resonator Issue?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by micro9000 on Wed Jul 10 09:59:36 MST 2013
I have been playing around with delays and I have noticed that at times the delay isn't correct or the LED doesn't blink at all (nothing happens). For instance, working off of the systemtick examples, I use 1000 for 1s and 500 for .5s. When I ran it the first few times the delay appeared accurate for the LED I am using.

After this, I notied that upon programming it again, I noticed that the delays would start to decay and eventually it would stop working. Is this an indication of a oscillator/resonator issue? I tried a few different resonators (same capacitance) and the result was the same. What I suspect is that it could be the capacitance rating of the resonator. The one I have is a ceramic 20MHz resonator with 30pF capacitance.

I already ordered a 12MHz resonator with 30pF capacitance, but now I am not sure if I will get the same result. I am debating whether or not this is the issue from Table 15 in the user manual "crystal and external components parameters."

Here is a link to the resonator I have selected:
12Mhz 30pF built-in ceramic resonator

In addition, at times I get an error stating:

"05: File .axf load failure Ep(08). Cannot access core regs when target running."
(After building it again sometimes this goes away, but it appears after programming again the microcontroller is not operating properly - nothing happens and the LED does not blink)

I'm really not sure what is causing these issues with delays and what could be causing this error.

Am I better off using a crystal such as this 12MHz crystal? It has a 20pF load capacitance, has a ESR of 40 Ohm, and I can use it with these 39pF capacitors. So, it seems like it checks out and could work better then the resonator I am using. Is this the way to go?