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

Custom board issue

Hi,

We just received our custom board based nRF52832, below nRF52832 schematic image description

I succeed to flash the board. but i have frequency troubles. I made a simple exemple to verify this:

#define TIMEOUT_VALUE                    10                           /**< 10 microsecond timer time-out value. */

#define PIN_OUT 12


void timeout_handler(void * p_context)
{
        nrf_drv_gpiote_out_toggle(PIN_OUT);

}
 
int main(void)
{
	  ret_code_t err_code;

    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    
    nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);

    err_code = nrf_drv_gpiote_out_init(PIN_OUT, &out_config);
    APP_ERROR_CHECK(err_code);

    err_code = app_simple_timer_init();
    APP_ERROR_CHECK(err_code);
                
		err_code = app_simple_timer_start(APP_SIMPLE_TIMER_MODE_REPEATED, 
													 timeout_handler, 
													 TIMEOUT_VALUE, 
													 NULL);            
		APP_ERROR_CHECK(err_code);    
    
    for (;;)
    {

    }    
}

When i run this example over Nordic DevKit PCA10040, i get a square wave with period of 20us. when i run the same example over our custom board, i get a square wave with period of ~17us.

Any idea of the cause of this trouble ? please.

Best regards.

Parents
  • Actually that's a very good question because .. I assumed the 32MHz crystal oscillator was running but looking at the code, unless the app_simple_timer.. starts it, it may actually not be at all and you are already getting the internal 64MHz RC oscillator (it's 64MHz on the nrf52).

    So perhaps you want to explicitly start the HF oscillator and wait for it to start, to ensure you are using the crystal and not the internal RC. You can also break in the code and check the CLOCK register to see if it says the HF oscillator is running.

    The internal RC has a tolerance of 6% max, so you shouldn't get anything worse than 18.5us even if it's at the edge of the range.

    So perhaps I got it the wrong way around, and you need to force the HF crystal oscillator ON in your test

Reply
  • Actually that's a very good question because .. I assumed the 32MHz crystal oscillator was running but looking at the code, unless the app_simple_timer.. starts it, it may actually not be at all and you are already getting the internal 64MHz RC oscillator (it's 64MHz on the nrf52).

    So perhaps you want to explicitly start the HF oscillator and wait for it to start, to ensure you are using the crystal and not the internal RC. You can also break in the code and check the CLOCK register to see if it says the HF oscillator is running.

    The internal RC has a tolerance of 6% max, so you shouldn't get anything worse than 18.5us even if it's at the edge of the range.

    So perhaps I got it the wrong way around, and you need to force the HF crystal oscillator ON in your test

Children
No Data
Related