I'm designing a board for a school project using eagle. I thought I could get away with using the onboard clock of the PIC18 since it's not doing a whole lot (mostly just LEDs), but one of its tasks is RS232 communication, and I (just) learned that the onboard is nowhere near accurate enough for any sort of comms. Since the RS232 link is crucial, I need it to work. So I've had the task of cramming an xtal and two caps on my already crowded PCB. Here's my result at 3am this morning:

enter image description here

I'm sure I've made some experienced board designer sweat a bit. The big glowing trace is ground. I think it's the best I could do considering there was absolutely no room to move the PIC or the two top chips, and very little room to move the bottom one. The board is going to be CNC milled so I can't go less than 16mil trace width/16 mil spacing. I rearranged what I could to make sure OSC1 and OSC2 had no vias. The caps are small little ~20pf ceramics, I just used the cylindrical parts for the pad spacing.

(Also, blue is the bottom layer, red is the top; everything has to be through-hole and connect on the bottom)

I plan on running the chip at 4.9152MHz. If for whatever unfathomable reason it's not enough speed, I'd like the option of 7.2MHz. I know speed affects design.

Any advice would be appreciated. I'm probably going to spin the caps so the trace to the xtal is shorter. I don't see any possible way to have a 'ground ring' which is suggested as there's no room.

EDIT: Here's an updated design. I switched out the caps with a better footprint (still ceramic), and the microcontroller connects to the ground plane at only one point. The dashed lines show where I'm going to put my guard ring (pins 1 and 20 of the TPIC are N/C):

enter image description here

Edit 3: Fatter traces, better shielding, I think this is as good as it can get:

enter image description here

  • \$\begingroup\$ near-duplicate question: electronics.stackexchange.com/questions/41693/… Even though the earlier question is about an SMT layout, the same basic principles apply. \$\endgroup\$
    – The Photon
    Commented Jan 6, 2013 at 18:08
  • 1
    \$\begingroup\$ This one is even closer to your situation: electronics.stackexchange.com/questions/39136/… \$\endgroup\$
    – The Photon
    Commented Jan 6, 2013 at 18:10
  • \$\begingroup\$ You don't specify your RS232 speed, but at many speeds the internal crystal is fine for asynchronous communication. \$\endgroup\$
    – kenny
    Commented Jan 6, 2013 at 18:34
  • \$\begingroup\$ RS232 will be 9600 baud at the very most. If it turns out I don't need it then I can just leave it unpopulated. This way I won't have to respin the board, I can just pop the components in and I'm back up and running. I saw Photon's link and it was very helpful about the ground plane. \$\endgroup\$
    – BB ON
    Commented Jan 6, 2013 at 19:02
  • 5
    \$\begingroup\$ @kenny Many people believe that, but it's wrong. The percent error that a UART can tolerate is independent of the baud rate in use. \$\endgroup\$
    – Dave Tweed
    Commented Jan 6, 2013 at 19:46

1 Answer 1


I see a few issues with your design:

  1. One of the caps is physcially touching the crystal. Move it just a little bit away

  2. Move the crystal up so that it's as close as can be to the PIC18.

  3. Make room for the guard ring. From the little I see in the image, you can likely move some things to move it closer.

  4. make sure to ground the crystal case itself mechanically (don't forcibly solder it somehow)

  5. Change the capacitors for the crystal to ceramic. This will make them smaller and there's no point in electrolytic here.

The reality is that even in its current state, the circuit will work. So it's not a question of whether it will work, but whether you'll get the best performance, cleanest clock, lower EMI, etc.

The following is one app note about how to best layout crystals:

AVR186: Best Practices for the PCB layout of Oscillators

  • \$\begingroup\$ Regarding 1 and 5, the capacitors were always ceramic, I just used an electrolytic footprint in eagle because of the pad spacing. I found a better part and replaced it with that. I don't know how to ground the crystal unless I have a ground pad on the top layer...is that correct? \$\endgroup\$
    – BB ON
    Commented Jan 6, 2013 at 19:05
  • \$\begingroup\$ You need to build a guard ring around the crystal from the GND pin of the PCB. Grounding the case isn't going to make or break you. Just put a trace that isn't coverd with soldermask under the case so that it mechanically makes contact with the case itself then be careful when soldering so that it makes contact. \$\endgroup\$ Commented Jan 6, 2013 at 19:17
  • \$\begingroup\$ In your second picture you still haven't placed the crystal as close as possible to the microcontroller. This will work, but it's not the best design. Still, for your requirements might be good enough. \$\endgroup\$ Commented Jan 6, 2013 at 19:21
  • \$\begingroup\$ That's as close as I can get it. There's no clearance in between the chips for the xtal, caps, guard ring, and a grounding line at 16mil. Better grounding and EMF protection sound more important than it being fractions of an inch closer. \$\endgroup\$
    – BB ON
    Commented Jan 6, 2013 at 19:31
  • \$\begingroup\$ Being closer brings better grounding and EMF protection :D However, if that's all you can do, then that's all you can do. No point is squeezing a dry orange for juice. \$\endgroup\$ Commented Jan 6, 2013 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.