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

Power Supply and Crystal Configuration

I am using the nRF51822.  I am using the regulator (not the DC/DC) connection and am not using the low-power (1.2V) mode.  All supplies are 3.3V.

Additionally, I am only using the 32MHz crystal and not a 32kHz crystal.  I will use the internal RC oscillator for 32kHz.  

How do I this up in the software.  Is there a tutorial which goes over the initiation of the device within the software?

Thanks,
Dave

Parents
  • Hi,

     

    No changes are needed for LDO (non-DC/DC) operation, this is done by default. For 32 kHz you need to modify nrf_clock_lf_cfg_t  used when enabling the softdevice. E.g. for SDK 12.3

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                     .rc_ctiv       = 16,                                \
                                     .rc_temp_ctiv  = 2,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

     

    For the 32 MHz  crystal you need to update the XTALFREQ register before the oscillator is started by the application, e.g.

     

    // Set the external high frequency clock source to 32 MHz
        NRF_CLOCK->XTALFREQ = 0xFFFFFF00;

     

    The other option is to change the reset value of NRF_CLOCK->XTALFREQ to 32 MHz. Reset value is defined by NRF_UICR->XTALFREQ 

     

    Best regards,

    Andreas

Reply
  • Hi,

     

    No changes are needed for LDO (non-DC/DC) operation, this is done by default. For 32 kHz you need to modify nrf_clock_lf_cfg_t  used when enabling the softdevice. E.g. for SDK 12.3

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,            \
                                     .rc_ctiv       = 16,                                \
                                     .rc_temp_ctiv  = 2,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

     

    For the 32 MHz  crystal you need to update the XTALFREQ register before the oscillator is started by the application, e.g.

     

    // Set the external high frequency clock source to 32 MHz
        NRF_CLOCK->XTALFREQ = 0xFFFFFF00;

     

    The other option is to change the reset value of NRF_CLOCK->XTALFREQ to 32 MHz. Reset value is defined by NRF_UICR->XTALFREQ 

     

    Best regards,

    Andreas

Children
No Data
Related