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

sysclk not showing up on GPIO pin

I am trying to probe sysclk signal on one of the unused GPIO pins on a nRF52 board. I modified the ble_app_template example provided in SDK 11.0.0 and added a sysclk function to see the sysclk signal on P0.11. The project builds and loads with no errors, but when I probe the GPIO pin with a digital scope, I do not see any signals showing up. What could be the problem? Here is the function I added, which I call after ble_stack_init() :

static void sysclk_init( void ) {
  uint32_t running;
	nrf_gpio_cfg_output( 11 );
  // Start high frequency clock with SoftDevice
  APP_ERROR_CHECK(sd_clock_hfclk_request());
  APP_ERROR_CHECK(sd_clock_hfclk_is_running(&running));
	//Wait for clock to start
  while(!running) {
    APP_ERROR_CHECK(sd_clock_hfclk_is_running(&running));
  }
  // Configure GPIOTE to toggle pin P0.11
  NRF_GPIOTE->CONFIG[0] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
    GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos |
    11 << GPIOTE_CONFIG_PSEL_Pos | 
    GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos;
  // Set up timer
  NRF_TIMER1->PRESCALER = 0;
  NRF_TIMER1->CC[0] = 16;
  NRF_TIMER1->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos;
  NRF_TIMER1->TASKS_START = 1;
  // Set up PPI to connect the timer compare event with the GPIOTE toggle task
  NRF_PPI->CH[0].EEP = (uint32_t) &NRF_TIMER1->EVENTS_COMPARE[0];
  NRF_PPI->CH[0].TEP = (uint32_t) &NRF_GPIOTE->TASKS_OUT[0];
	NRF_PPI->CHENSET = PPI_CHENSET_CH0_Enabled << PPI_CHENSET_CH0_Pos;
}
  • Tested this on nRF52 DK and it works. What hardware are you using? Is the BLE part of the application working (is it advertising)?

    And btw: it is good practise to add parenthesis around each bitshift operation:

    NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos) |
        (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos) |
        (11 << GPIOTE_CONFIG_PSEL_Pos) | 
        (GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos);
    
Related