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?
Hello,
We usually recommend using the available API's in the SDK to make easier the development of your own application.
I would recommend you to check the rf_osc_startup function available in I believe all the examples on the SDK which just give you our implementation of what you are trying to achieve, you can find it in the fsl_xcvr.c file.
Regards,
Estephania