AnsweredAssumed Answered

MKW41Z register RSIM->CONTROL requires reading GENFSK register first

Question asked by Gauthier Östervall on Mar 4, 2019
Latest reply on Mar 6, 2019 by Estephania Martinez

I am having trouble reading the RF_OSC_READY field of RSIM->CONTROL.

 

I noticed my firmware unexpectedly reports that the oscillator is not ready if I check like this:

if (!(RSIM->CONTROL & RSIM_CONTROL_RF_OSC_READY_MASK)) {
    return RADIO_RESULT_ERROR; /* Error, OSCERCLK is not running! */
}

However, reading a register from the GENFSK module solves the issue, and RSIM->CONTROL reports RF_OSC_READY as expected:

 

+ volatile uint32_t dummy_read; 
+
+ /* RSIM control does not have OSC_READY if we don't make this read
+ first. It's unclear if it's a problem with the RSIM register updating its
+ value, or the clock actually not starting without the read. Read of any
+ GENFSK register makes it work (actually only tested with
+ GENFSK->NTW_ADR_0 besides PACKET_CFG). */
+ dummy_read = GENFSK->PACKET_CFG;
+
if (!(RSIM->CONTROL & RSIM_CONTROL_RF_OSC_READY_MASK)) {
     return RADIO_RESULT_ERROR; /* Error, OSCERCLK is not running! */
}


Is this known behavior? Should I do it another way? My guess is that the oscillator is ready although the register reports it isn't, is it the case?

Outcomes