How do I share a single crystal (not a complete oscillator module) between two micros? Is it OK to just connect everything as normal for the first micro and also directly connect its XO to the XI of the second microcontroller? I expect to place the micros very close together on the board.
What I have done when I needed to share a clock between micros is to have the crystal drive the oscillator on one micro and then use the oscillator output pin (typically CLKOUT or OSCOUT) from that micro to drive the second micro.
I would expect problems trying to drive two oscillators from the same crystal, if for no other reason than that the capacitance of the long PCB traces required to go between the two processors would cause a malfunction.
That is not quite what you want. When you use a crystal to form an oscillator, you are using an inverter internal the the microcontroller to drive the crystal. If you connect both micros to the same crystal, they will fight and not work.
Therefore you will want to pick one of the two micros to serve as the crystal driver (configure as shown in section 6.2.6 of the datasheet) and the other micro to use an external clock input (6.2.1 of data sheet). Then change your schematic connection like this:
Alternatively, if symmetry is desired you can use an external oscillator as opposed to a crystal. Then both could operate in external clock mode.
The problem with that approach is that the connection to the second oscillator input will affect the capacitance on that pin, and alter the frequency slightly as well as reducing the crystal drive. It might not matter, though, and is very unlikely to prevent oscillation. When I've needed to do that for a product I've used a crystal oscillator module for both MCUs.
Make an oscillator out of your crystal and an inverter like BarsMonster suggested, and feed it into the input of a fanout distribution buffer IC. One fanout buffer output goes to the clock input of each MCU.
I can't really recommend a specific part without knowing what micros you're using, but you'd want to start with these filters:
- Type: Fanout Buffer (Distribution)
- Number of Circuits: 1
- Ratio - Input:Output: 1:2