Stable SAM D21 to 32U4 SPI communication dependent on XIAO Tx or Rx LED being ON

Hello, I am NOT new to microcontrollers (45+ years). I designed and built a small commercial device using XIAO SAMD21 to quickly download one of five programs stored on the XIAO to a separate Arduino Pro Micro student learning board via SPI. Code and board work perfectly… IF. Here is where it gets strange. Originally only worked if Serial.print statement was included waiting for SPI transaction to clear. Tracing through source code for the SAMD21 in Arduino it seemed the only thing that made a difference was turning on one of the TX or RX LED in USB code. So I removed all the Serial code and just turned on the blue LED (Pin 12) on the last line in setup with digitalWrite(12, LOW) and everything works perfectly. Remove that line leaving the LED off and SPI write to 32U4 flash eventually fails at any speed. I don’t mind the tiny blue LED light being on all the time, but this just seems like a bug I don’t care to track down, but someone at SEEED might. I looked through variant.h and could see that those are the only ports using PWM3 and TC3, but changes there didn’t make any difference, the LED still needs to be ON for SPI to be stable communicating with the 32U4. Nothing in wiring_digital.c made any difference either (digitalWrite). If it is something I am doing wrong, I am clueless as to why the LED wouild make a difference other than maybe some internal conflicts within the XIAO SPI Arduino software.

November 1, 2023