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

How to identify the application clock frequency in nrf5340

Hello,

I am working on nrf5340DK board and with sample example central_uart. I wan to find at what speed the application clock is configured and also want to change it to 128M.

Please help to provide information on how to find the current set frequency in sample example  and how to modify.

Best Regards,

SanketC

Parents
  • Hello,

    The default CPU frequency is 64 MHz after reset. But it doesn't look like we have implemented any driver APIs to control the frequency yet, so I think you have to write directly to the clock control register as shown in my code snippet below.

    	/* Set CPU frequency to 128 MHz.
    	 * https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/clock/doc/clock.html#concept_mcu_frequency_scaling
    	 *
    	 * Note: replace NRF_CLOCK_S with NRF_CLOCK_NS if CPU is running in the non-secure domain.
    	 * /
    	NRF_CLOCK_S->HFCLKCTRL = (CLOCK_HFCLKCTRL_HCLK_Div1 << CLOCK_HFCLKCTRL_HCLK_Pos);

    Best regards,

    Vidar

Reply
  • Hello,

    The default CPU frequency is 64 MHz after reset. But it doesn't look like we have implemented any driver APIs to control the frequency yet, so I think you have to write directly to the clock control register as shown in my code snippet below.

    	/* Set CPU frequency to 128 MHz.
    	 * https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/clock/doc/clock.html#concept_mcu_frequency_scaling
    	 *
    	 * Note: replace NRF_CLOCK_S with NRF_CLOCK_NS if CPU is running in the non-secure domain.
    	 * /
    	NRF_CLOCK_S->HFCLKCTRL = (CLOCK_HFCLKCTRL_HCLK_Div1 << CLOCK_HFCLKCTRL_HCLK_Pos);

    Best regards,

    Vidar

Children
Related