I'm evaluating the nRF52840 using the DK. I find that the hfxtal in the 52840DK is GSX-223, which is not included in the data sheets characterization of HFXTAL ramp-up time.
My question is, I'm having problem when enabling the HFXTAL then going directly ramping up the radio.
// Enable the HFCLK
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 0x00000001;
while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
// Enable the Radio
NRF_RADIO->EVENTS_READY = 0;
NRF_RADIO->TASKS_TXEN = 1;
while (NRF_RADIO->EVENTS_READY == 0);
as of the moment, what i'm doing is arm the RTC clock to fire 250us before enabling the HFCLK. I read somewhere that the BLE softdevice disables the HFCLK whenever the radio is not needed. I'm basically doing the same thing. Am I missing something?
I'm sorry, but can you please be a bit more specific as to what you're having trouble with in your project? Have you tried to debug the application to see where exactly the code is incorrectly enabled? Please check out the radio test example in our SDK for an example on how to start the HF clock and the radio without using the SoftDevice.
Please note that if you have flashed the SoftDevice onto your board while trying to manually configure the HF clock and/or radio, the SoftDevice will hinder you from doing so.
I already solve the problem.
In the application I'm working, the HFCLK is disabled and only enabled when the radio is needed. The problem I'm seeing is enabling the HFCLK then turning on the radio would cause the radio not transmit anything. Because of this, I thought that when the HFCLKSTARTED event is triggered, the HFXO is still starting up so when I immediately enable the radio and start transmitting, its not transmitting anything.
Although from the spec sheet it seems like after the HFXO startup, I still need to wait a couple of us because of the HFXO debounce time. My guess is the HFXO debounce given by HFXODEBOUNCE is the debounce time to switch from HFINT to HFXO. to solve this, what I simply did is use time and flag an interrupt after 256us or wait until HFCLKSTAT[STATE] to be '1'.