Cannot stop LFCLKSTAT from BYPASS EXTERNAL XTAL

Hello, i am having a weird behaviour at a NRF52832 device. 

To explain. Basically I am using an external RTC chip to source the clock of the LFCLK. 

During the initialization I call:

      NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) |
       (CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);

      NRF_CLOCK->EVENTS_LFCLKSTARTED = 0; 
      NRF_CLOCK->TASKS_LFCLKSTART = 1;
      while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
      {//do nothing
      }

However, during an investigation of a problem explained here I realized that after a Reset from byt J-LInk during a debug session the LFCLKSTAT start already with SRC as Xtal and State as Running. If I call NRF_CLOCK->TASKS_LFCLKSTOP = 1 it will stay as running and wont stop. Also If I try to change the source of the LFCLK to RC it wont change as the LFCLKSTAT State is running. 

I could not find any ERRATA explaining about this. 

Is there any solution? Am I doing anything wrong?

Parents Reply Children
  • Hello Kenneth, 

    In this specific test I already disabled the Watchdog. I run this right in the begin of my software

        int watchdog_is_running = 0;
        watchdog_is_running = NRF_WDT->RUNSTATUS;
        printf("WatchDog Status: %d\n", watchdog_is_running);
    
    ////EXT CLOCK
    
    
          if(nrf_clock_lf_is_running()){
            NRF_CLOCK->TASKS_LFCLKSTOP = 1; 
            while(nrf_clock_lf_is_running())
            {}
          }

    The watchdog_is_running returns 0 (so watchdog is not running) but the while(nrf_clock_lf_is_running()) never returns after the stop.

    This is somehting I see after reseting the firmware and I previously started the LFCLK as following. 

    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos)|(CLOCK_LFCLKSRC_BYPASS_Enabled << CLOCK_LFCLKSRC_BYPASS_Pos ) |
    (CLOCK_LFCLKSRC_EXTERNAL_Enabled << CLOCK_LFCLKSRC_EXTERNAL_Pos);
    
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART = 1;
    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {//do nothing
    }

     Any other ideas? Would you be able to replicate it?

  • Luis said:
     Any other ideas? Would you be able to replicate it?

    Just to double check: I assume you have verified that this problem only occurs when using LFCLK source with BYPASS enabled?

    If it only occurs with BYPASS enabled, then I am wondering if you can just confirm that the external clock is indeed stopped here also? Or are you still feeding the external clock when you are calling TASKS_LFCLKSTOP? Just wondering if the problem may also be related to the clock is still being provided or not.

    I assume you only experience the problem when doing soft reset during debug session, or do you see the problem also for other reset sources, ref:
    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html#unique_961802881 

    Kenneth

  • Hello Kenneth, 

    I tryed to disable the external clock, and still I could not stop it. 

    Any sugestions? 

    Best

  • You might have found an unknown issue then, and you can confirm this only occurs when using CLOCK_LFCLKSRC_BYPASS_Enabled? 

    Does the problem only occur when in debug session and/or when you reset from debug session?

    Does it happen for instance if you reset from watchdog or soft reset (after a power cycle, not when debug mode)?

    What happens if you allways start it with bypass enabled (even when you only want to stop it), so you first (always) start it, and then try to stop it?

    Kenneth

  • I only have checked with EXT/BYPASS enabled (i only have a full square wave ext clocK) and with internal RC. Internal RC has no problem. For now It happens evvertime even when not in a debug session. It will happen with a Soft Reset and a Debug Reset but not a Watchdog reset.

    I tryed to start with bypass enabled and stop after that and it also didn't work. 


Related