Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6977

Interfacing (DSI, CSI, I2C, etc.) • The impact of packet size on spidev behavior.

$
0
0
Hello!

Raspberry Pi Zero 2 W.

I'm outputting data via SPI using spidev and encountered strange behavior.
When I transmit between 2 and 95 bytes, the bytes are sent with a gap of one clock pulse between them.
When I transmit 96 bytes or more, the bytes are sent without any gap.

Any ideas why this happens and how to control it?

Here are SCLK oscilloscope screenshots and the Python source code.

Code:

import spidevimport timespi = spidev.SpiDev()spi.open(0, 0)spi.max_speed_hz = int(2.4*1000000)dat = [0x92]*95try:  while True:    spi.writebytes(dat)    time.sleep(0.2)except KeyboardInterrupt:  print("Exit")finally:  spi.close()
spidev.jpg

Statistics: Posted by kapachinskij — Tue Sep 02, 2025 7:27 pm — Replies 0 — Views 13



Viewing all articles
Browse latest Browse all 6977

Trending Articles