I need help setting up the processor clock on a board with a SAMD21 processor.
I have designed a board for a radio communications project and need reasonable accuracy for the Timer-Counter (on the order of 100ppm). The processor circuit is a virtual clone of the Adafruit ItsyBitsy-M0, and is clocked at 48MHz by the internal DFLL in USB clock-recovery mode. With the USB connected the clock wanders a bit, but is acceptable. When there is no USB the free-running frequency is quite imprecise. I am using the Adafruit boot-code, with a very small bit of modification.
For radio frequency-setting I have a 2 ppm 10 MHz oscillator and if available I use a GPSDO. These are not currently connected to the processor, but jumper wires are easy.
To get the accuracy I need, I figure I can set up the SAMD to use the 10 MHz clock as a clock reference (divide by 10 and then multiply by 48, or similar). I've looked at the ItsyBitsy boot code and studied examples, but I'm no expert and it shows -- I've not been able to get this to work. As a test I plan to attach a 32KHz resonator to the controller and see if I can make any of the many examples out there work, but I would rather use the existing 10 MHz reference.
Alternately, I can accept the "48 MHz" clock variability, and instead clock the TC from my 10 external MHz clock. I see that there is a two-stage synchronizer available at the input pins.
I was hoping to not have to become an expert in this, and would love a little bit of hand-holding. If it comes down to it, I would pay a reasonable price to have someone help me out -- I've got other tasks that I really need to be working on. I do need to retain USB functionality. I am currently using the Arduino IDE and various libraries from the usual sources, sometimes modified.
Suggestions greatly appreciated!