I have two custom boards with atmega328 IC. first board is working the other board which is not working the prblem what i’m getting is: " chip program enable error". ((I will refer as working and non working board))
for solution I have tried followig:
- checked pin XTAL1 and XTAL2 with oscilloscope
Result: in the working board, I was getting sine wave with 16 Mhz freqency in non working board I was getting 1.39 V on XTAL1 and 0.2 V on XTAL2 pin Dc voltage. I have attached table also. The problem is same component I have used on both boards. following are the details for my oscillator circuit
Oscillator part no: ABM3-16.000MHZ-B4Y-T
Capacitor values: 22pF
Equivalent series resistance (R1) = 40 Ohm
Shunt capacitance (C0) = 7pF
Load capacitance (CL) = 18 pF
Frequency tolerance = +/-30 PPM
Frequency stability= +/-30 PPM
second I have checked the Reset pin:
on non working board while programming I am gettng 7 time reset of 94 ms time duration.( checked on oscilloscope)
note: watchdog timer is also disebled
Help me to find the issue that why I’m getting 7 time reset on reset pin. and will the problem solved if i use 27 pf capacitor according to calculation.
For some reason the oscillator is not oscillating. For this reason the ATMega does not respond to the programming commands. Programmer tries to get the ATMega into programming mode repeatedly before it reports error - so you see repeated resets. Possible causes:
- Wrong fuses: inject external clock to XTAL1 (or XTAL2?) pin and try if it works.
- Soldering error: check continuity everywhere.
- Something is damaged?
C1 = C2 = 2(CL - Cs) where C1 and C2 are the values of capacitors for the Pierce oscillator circuit, CL is the stated load capacitance on the crystal datasheet and Cs, stray capacitance, in a SMT PCB is probably less than 2 pF, if designed correctly with the XTAL close to the pins and C1 and C2 as close also, and an appropriate keep out area and ground plane beneath the Pierce oscillator circuit. On a breadboard, Cs will be a bit higher... This formula is from page 54 of the ATmega328P datasheet. 2(18 - 2) = 32pF. This value can have quite a bit of range, as long as the fuses are set correctly, -U lfuse:w:0xF7:m for the low fuse. Even with a stray capacitance of 5pF, C1 and C2 should be 26pF. I'm not saying that IS the problem, but it could be out of spec. Also, in a custom circuit, consider the application notes, AVR040 and AVR042, to insure the board has appropriate decoupling caps on the power rails and appropriate components to prevent a reset etc.