# Selecting true crystal settings for 328P [7.3728 MHz]

I want to make a new board working with 115200 (gsm modem) UART. so I want minimum baud error rate. I look at

table and decide to work with ATmega328P 7.3728 Mhz / 3v3

The second step is choosing the right XTAL capacitance (Ce)

Cl = 18 pF (Load Capacitance of External Crystal) [ECS-073-18-20BM-JEN-TR]
Cs = 5 pF (Stray Capacitance; in additional sources says you can take it 2-5 pF)
Ci = 18 pF (ATmega328P datasheet; XTAL/TSOC capacitance)


This formula is given in ATmega datasheet

Ce = 2Cl - Cs - Ci

so

Ce = 2.18 - 5 - 18

External Capacitance is

Ce = 13 pF
CRYSTAL ESR = 70 ohm


is that a true calculation? and true settings for my clock setting?

Fuse Settings :

 Low Byte Fuse : 0xFD
High Byte Fuse : 0xDA
Extended Byte Fuse : 0xFD

• Just as a note: Normally the CPU and speed are chosen for the amount of work to be done. You will have 640 CPU cycles to process each byte (assuming n,8,1). – Oldfart Feb 12 at 10:22
• The answer to your actual problem is that it doesn't matter a bit. The UART resyncs at least once every new byte, and can tolerate timing errors up to several percent before you start dropping bytes. Your 20 ppm crystal is thousand times better than what is needed. It's a good question though, for other reasons you might want better assurance of crystal speed (and startup stability) – pipe Feb 12 at 10:42
• I make the other board with 328P and internal 8 Mhz crystal (with Li-Ion battery power source). And when I started to communicate with GSM modem sometimes have a frame error. So I want to be careful with that. – Mehmet Günce Akkoyun Feb 12 at 11:16
• @MehmetGünceAkkoyun As you can see from the table you posted, 8 MHz gives you over 7% mismatch. It has nothing to do with capacitor matching. – pipe Feb 12 at 12:29
• @pipe, using U2X bit will halve the error to only 3.5%. The internal oscillator is factory calibrated at 3.0V and 25C to give 10% tolerance, so statistically it could work. Then using oscillator calibration register, you can calibrate the oscillator to 1% which will work. But it is no match for an external crystal. – Justme Feb 12 at 17:50