From a1e9722ab1b1c40113c407e91b62f53e04641526 Mon Sep 17 00:00:00 2001 From: Jake Read <jake.read@cba.mit.edu> Date: Fri, 29 Dec 2023 15:16:53 -0500 Subject: [PATCH] begin spi --- rpi_spi/2023-12-29_pi-spi-rates.md | 10 ++++++++++ rpi_spi/code/pi_spi.py | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 rpi_spi/2023-12-29_pi-spi-rates.md create mode 100644 rpi_spi/code/pi_spi.py diff --git a/rpi_spi/2023-12-29_pi-spi-rates.md b/rpi_spi/2023-12-29_pi-spi-rates.md new file mode 100644 index 0000000..642d644 --- /dev/null +++ b/rpi_spi/2023-12-29_pi-spi-rates.md @@ -0,0 +1,10 @@ +## 2023 12 29 + +OK, SPI is looking pretty good; actual bit times are identical to what-they-should-be, so I'm not even going to note them down (whereas UART out of the PI has some drift, probably strange BAUD fractional maths). + +So, there's just the question of waveform integrity, and (probably) the ability of the RP2040 to keep up, and there's the actually-delineating-and-echoing-etc test. + +I'd like to look at some scope traces first, but I should probably do it in context (i.e. actually driving a pin, not free air), so I'll setup my little test rig... + +- female-to-male, +- usb-to-image-capture-on-the-scope ? \ No newline at end of file diff --git a/rpi_spi/code/pi_spi.py b/rpi_spi/code/pi_spi.py new file mode 100644 index 0000000..fb90f52 --- /dev/null +++ b/rpi_spi/code/pi_spi.py @@ -0,0 +1,10 @@ +import spidev + +spi = spidev.SpiDev() +spi.open(0, 0) +spi.max_speed_hz = 12000000 + +for i in range(100000): + spi.xfer([12, 14, 95]) + +spi.close() \ No newline at end of file -- GitLab