CLOCK_SetPLL0Freq(&pll0Setup); /*!< Configure PLL0 to the desired values */
CLOCK_SetPll0MonitorMode(kSCG_Pll0MonitorDisable); /* Pll0 Monitor is disabled */
CLOCK_SetupOsc32KClocking(kCLOCK_Osc32kToVbat); /* OSC_32 kHz output clock to Vbat enabled */
vbat_osc_config_t g_vbatOscConfig_BOARD_BootClockPLL150M = {
.coarseAdjustment = kVBAT_OscCoarseAdjustment05,
.enableInternalCapBank = true,
.enableCrystalOscillatorBypass = true,
.xtalCap = kVBAT_OscXtal12pFCap,
.extalCap = kVBAT_OscExtal12pFCap,
};
VBAT_SetOscConfig(VBAT0, &g_vbatOscConfig_BOARD_BootClockPLL150M);
SYSCON->CLOCK_CTRL |= SYSCON_CLOCK_CTRL_FRO1MHZ_CLK_ENA_MASK; /*!< Enable FRO_1M is on */
CLOCK_EnableClock(kCLOCK_Rtc0);
RTC0->CTRL |= RTC_CTRL_CLK_SEL_MASK; (HANGS HERE!)
If I skip that line in the debugger, MCU startup continues until any other code tries to access any register on the RTC0.
I have tried everything I can think of so far. Systick and MRT are also running, with higher priority Interrupts, but even when disabled, it just seems to be a clock issue with RTC0.
Strangely, when MCUxpresso stops connecting, it opens a tab for "ADC0_IRQHandler() at 0x0" and displays "No source available for "ADC0_IRQHandler() at 0x0" "
I am using an external 32768 crystal, if I change the clock to the internal 16k one, the code runs a bit further, to:
status_t IRTC_Init(RTC_Type *base, const irtc_config_t *config)
{
assert(NULL != config);
and fails at the "assert". "config" = the configuration, not NULL, so what's up with that? Ugh!
Any fresh eyes or ideas, much appreciated!