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

Update clock for SPI peripheral nrf9160

Hello,

I am working with SPI on the Nordic nrf9160. I am currently on the DK.

The board I need to interface through SPI works at 25MHz (minimal frequency) and I would like to have such frequency for the SPI I use. From the Nordic perspective, I need to use a master SPI. In my Zephyr device tree, I have

			spi1: spi@9000 {
				#address-cells = < 0x1 >;
				#size-cells = < 0x0 >;
				reg = < 0x9000 0x1000 >;
				interrupts = < 0x9 0x1 >;
				status = "okay";
				label = "SPI_Dev";
				compatible = "nordic,nrf-spim";
				sck-pin = < 0x1 >;
				mosi-pin = < 0xe >;
				miso-pin = < 0xf >;
			};

And in my C code, I program the SPI as follow

static struct spi_config gSpiConfig =
{
  .frequency = 25000000u,
  .operation = 0u,
  .slave = 0u, 
  .cs = NULL 
};

When I inspect it using a logic analyzer, I see that the clock does not exceed 8MHz

.

This code works fine for lower frequency than 8MHz and the logic analyzer shows that the frequency is correct.

In the documentation: https://infocenter.nordicsemi.com/pdf/nRF9160_PS_v1.0.pdf, section "6.13.7.1 SPIM master interface electrical specifications" shows that SPIM max Bit rates is 8Mbps, meaning that it cannot exceed 8MHz

Am I correct? Or is there any way to increase the clock frequency by changing the source of the SPI. If so, how can this be achieved? I saw in that same document that for the FREQUENCY register (6.13.6 Registers), the accuracy depends on the HFCLK source selected but the only HFCLK are 64 MHz oscillator (HFINT) and 64 MHz high accuracy oscillator (HFXO).

Thanks,

Related