This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF51822 with 32MHz crystal in system OFF mode

Hi all

We use an external 32MHz crystal for the nRF51822 and set the register NRF_CLOCK->XTALFREQ to 0xFFFFFF00 according the reference manual V3.0, chapter 13.3. Afterwards the HFCLK is started and we wait for the corresponding event. See the following code snippet:

NRF_CLOCK->XTALFREQ = 0xFFFFFF00U;
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) {}

It looks like the UART interface, the softdevice and the BLE communication work correctly. But if we try to activate the system OFF mode, the debugger stops suddenly on address 0xFFFFFFFE. We use the softdevice S130 V1.0.0 and the IAR compiler V7.40.3 and the J-Link V4.98e.

If we use a 16MHz crystal instead (and remove the code line NRF_CLOCK->XTALFREQ = 0xFFFFFF00U;) everything works correctly.

If we set the frequency of the HFCLK in the register UICR->XTALFREQ instead of NRF_CLOCK->XTALFREQ, there is also no problem. The reference manual describes that with the UICR->XTALFREQ register the reset-value for the HFCLK is defined. According to this thread, it should be possible to set the frequency of the crystal in both ways.

Does anyone know this behavior? Am I missing something? Many thanks in advance!

Related