Page 1 of 1

SPI driver - configured 2 MHz, but 1 Mhz on the wire

Posted: Fri May 08, 2026 3:42 pm
by NikolaiBaschinski
Hi guys!

I have configured my SPI driver with 2 MHz clock. But on the wire I see just 1 MHz. Why?

Code: Select all

  spi_device_interface_config_t devcfg_bme = {
    .clock_speed_hz = 2 * 1000 * 1000,
    .mode = 0,
    .spics_io_num = GPIO_NUM_5, // CS Pin
    .queue_size = 1,
    .flags = 0,
    .command_bits = 0,
    .address_bits = 0,
    .dummy_bits = 0
  };

Re: SPI driver - configured 2 MHz, but 1 Mhz on the wire

Posted: Sat May 09, 2026 5:19 am
by Sprite
Because you're looking at the data. The definition of SPI is that with each cycle (up-down) of the clock signal, there will be one bit of data on the data output. You're measuring two bits of data here (one high, one low), so the corresponding clock had two cycles (high-low-high-low) and would be the 2MHz you expect. Measure SCLK directly if you're in doubt.

Re: SPI driver - configured 2 MHz, but 1 Mhz on the wire

Posted: Mon May 18, 2026 6:03 pm
by NikolaiBaschinski
You're right! Thank you! :roll: