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

NRF52840 SPI Clock configuration

Hi

According to nRF52840 Product Specification, the SPI master data rate can be set in the SPI frequency register. The configurable values are listed there. Is it possible to configure the SPI master data rate much lower than 125kbps, e.g 1200 bps? As i understand, the SPI clock frequency comes from the HFCLK. I did not find any information about a "clock divider" or similiar things.

Like i understand from specification, there is nothing said about range.

I tried to set custom valuet but was not able to set the SPI Clk frequency below 10kHz. Is this a wrong configuration done by me or is it not possible to go under 10kbps?

I am using the SDK 15 and the nrf_drv_spi_config_t where i override the frequency from the default config.

Best regards

Parents
  • Your <=10kHz  SPI clock won't be possible in hardware. The Frequency divider is based on the 64 (SPIM3) or 16MHz peripherial clock and has a limited number of dividing "bits" - 125kHz is the slowest available speed.

    Below that you either need bit-bangig (manually toggeling GPIOs in software) or you could try to use a PWM peripherial in case you don't need MISO data.

Reply
  • Your <=10kHz  SPI clock won't be possible in hardware. The Frequency divider is based on the 64 (SPIM3) or 16MHz peripherial clock and has a limited number of dividing "bits" - 125kHz is the slowest available speed.

    Below that you either need bit-bangig (manually toggeling GPIOs in software) or you could try to use a PWM peripherial in case you don't need MISO data.

Children
  • Thank you for your fast reply.

    Is there a documentation or schematic how exactly this divider is working?  Because i've seen the divider uses Bit number 31 to 19, therefore I am able to decrease the speed to 2000Hz (which i've measured). I did not find any information inside the product specification of the NRF52840

    Is it possible to change the peripherial clock (use PCLK32 instead) ?

Related