I have an application that uses 3-wire SPI (on USART 0) to talk to a CAN controller. I recently uncovered an oscillator startup bug that was causing the MCLK to revert from XT2 (6 MHz) to DCO (2 MHz). In this situation the USART clock is sourced by SMCLK (6 MHz).
Without the bug USART operates normally. When the oscillator startup bug occurs byte transfers are all doubled up. (ie load the Tx buffer once, and two identical bytes are transferred).
I fixed the original bug and the problem goes away but I can re-create the SPI issue by manually changing the MCLK source to DCO.
What might cause the USART to send two bytes out, for each Tx load ?