Brief explanation: I built a small project using an ATTINY85 and a 22.1184 MHz. crystal. I edit the source using the NANO editor and compile/upload the code using a Makefile, GCC and Avrdude. The programmer is an Atmel AVR-ISP MK-II (a real one).
I made a programming cable that has a 6 pin connector on one end and an 8 pin "PDIP8" test clip on the other. The idea is to be able to program / test / program / test... the board. Across pins 2 and 3 of the test clip, I have a little SMD crystal of 16.000 MHz connected so that I can burn Tiny85 chips without needing an external clock. It all works fine.
Now, here's what I am wondering about: I was testing a new board I built, programming it with the little adapter (which, as usual, I left connected to the MCU). It slipped my mind that I had two crystals in parallel, and of two different frequencies (22.1 and 16.0).
My test code had a quick and dirty serial output using the 8 bit timer bit-banging an output pin - this also worked like a charm. However, when I first programmed the chip (leaving the test clip and it's 16 MHz crystal connected), I got serial gibberish on the terminal.
At first I thought I made a mistake with my bit-bang serial output code. I finally discovered that the 16 MHz crystal was "taking over" the 22.1 crystal. That is, with F_CPU in the Makefile set to 22118400UL and the programmer NOT connected, it all worked fine (at 115200 baud). If I left the programming cable connected (which placed it's 16 MHz crystal in parallel with the 22.1), the board ran at 16.0 (which I proved to myself by looking at the crystal on the 'scope and putting 16000000UL in the Makefile - then the serial output was perfect).
My questions are, how in heck did this thing work AT ALL? Why did the 16.0 seem to "take over" the 22.1?
Also, if this matters, I have a 105 (1 meg) resistor across the crystal and an 18pF NP0 from each terminal of the crystal to ground.
Any ideas or info will be appreciated. If you need any more circuit details to figure this out, let me know and I'll try to provide it.
(See attached pics for clarification)