I'm designing my project around an ATSAMD51J20A MCU and I found a problem, for which I've not yet found a solution. I want to use the internal 32KHz oscillator as a clock source for the PLL that produces 96MHz for the system. But here's the twist: I have an external 32.768KHz reference that I would like to use as a reference to calibrate the internal clock generator on the fly if it's off the frequency.
My problem is the in the datasheet I see "Bits 13:8 – CALIB[5:0] Oscillator Calibration These bits control the oscillator calibration. These bits are loaded from Flash Calibration at startup.", so I presumed that this register cannot be written to while the device is operating. Is it so?
In my project, I want to use many devices at once and having to have just one stable reference clock would help a lot in reducing costs.
Bonus question (I'd be glad if someone answerd this one): I'd like to use the chip without any bootloader in the future, so I'll need a JTAG programmer which can use SWD for debugging/programming. Do you know of any debugger supported by Atmel Studio 7 that costs around or under $20?
ferihun:
Do you know of any debugger supported by Atmel Studio 7 that costs around or under $20?
For non-commercial use, the Segger J-Link EDU Mini sells for that price. There are also some J-Link clones for a bit less, but I have never used mine for anything beyond flashing a bootloader to a SAMD21, so I can't say whether it's capable of doing what you need.
A lower cost option, which I have used for debugging, is here:
but unfortunately the description says:
The debugger is compatible with any ARM CMSIS-DAP tools. This includes edbg, OpenOCD, IAR and Keil, for example. Note that Atmel Studio is not supported.
pert:
For non-commercial use, the Segger J-Link EDU Mini sells for that price. There are also some J-Link clones for a bit less, but I have never used mine for anything beyond flashing a bootloader to a SAMD21, so I can't say whether it's capable of doing what you need.
I've found a few documents that mention Atmel Studio as an example of supported softwares so it may work. If it can flash the software, I'm more than happy with it. Thank you for your help!
You could possibly just use your reference clock as the clock. Pretty sure you can just start using the ULP32K as the default and use it to configure the XOSC32K input using your reference clock. This must be how the boards with the external 32K crystal work, all that would be different for you is configuring for external clock instead of crystal.
Otherwise, the datasheet says
"OSCULP32K.CALIB is automatically loaded from Flash Factory Calibration during start-up. The calibration value canbe overridden by the user by writing to OSCULP32K.CALIB."
microsootys:
You could possibly just use your reference clock as the clock. Pretty sure you can just start using the ULP32K as the default and use it to configure the XOSC32K input using your reference clock. This must be how the boards with the external 32K crystal work, all that would be different for you is configuring for external clock instead of crystal.
I don't want to use the reference as the clock signal, that's only there for occasional calibration, and it just gives the system some redundancy in case some internal clock source fails.
microsootys:
Otherwise, the datasheet says
"OSCULP32K.CALIB is automatically loaded from Flash Factory Calibration during start-up. The calibration value canbe overridden by the user by writing to OSCULP32K.CALIB."
So I guess you can update it at any time?
I hope I can update any time. I think I'll get an adafruit board and a programmer and test it first.