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

Possible bug in nrf52832 LFCLK

[Bug Report] Possible bug in nRF52832 engineering release B. When LF XTAL oscillator is started, no event is generated.

NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)   { };      // STUCK HERE FOREVER!!

The oscillator is actually started but no event is generated.

Parents
  • updated with code that worked (29.01.2016)

    Maybe it needs one clk cycle or two between selection of the clock source and starting the lfclk, try this below

    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    __DSB();     //<-- This will wait until write buffers are emptied.
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
    }
    

    i do not have engineering sample B to test it with. If the above code works, then i should ask someone here to test out why the event missed.

  • Yes, It is possible. In that case inserting _DSB() in between setting the clock source and starting the clock should handle that. Do you think the below code fits?

    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; 
    __DSB();
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
    
Reply Children
No Data
Related