Hi there, I'm having some truble to understand how to set a synthetice 32khz clock from the 16Mhz external crystal. Right now I have the next code working fine:
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Synth << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { /* Do nothing */ }
But I'm a litle confuce. Somewhere I read thath it is possible to synthetice the 32khz with the internal 16Mhz clock. So, I suposse that it's necesary to start the 16 external clock first? Like this:
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) { /* Do nothing */ }
NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Synth << CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { /* Do nothing */ }
So, the question is, which is the right way to start the synth clock, and how to know if is running with the external clock. Thanks!