Posts: 1
Joined: Wed Sep 04, 2019 1:35 pm

Reading SPI commands

Wed Sep 04, 2019 1:40 pm

Good afternoon guys!!

I'm currently trying to use a raspberry pi to transmit some SPI commands but am not sure if they're being sent correctly.

I also have a second Pi laying around and I want to use it as a health checking monitor for all the information getting sent.

How would I go about recording what has been sent on the second Pi?

(it's preferable to be using the second Pi for readings due to location issues)

All I want to do is open a channel to read the GPIO traffic from the SPI specific pins (SCLK, CE0 and MOSI).

If anyone could advise I'll be eternally grateful.


User avatar
Posts: 14601
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Reading SPI commands

Wed Sep 04, 2019 2:33 pm

If you can drop the SPI speed to 50kbps or so then you can monitor the GPIO on the Pi you are using for SPI.

or ... monitor_py

or ... SPI_mon_py

User avatar
Posts: 1782
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Reading SPI commands

Thu Sep 05, 2019 9:39 am

In addition to using Pi itself for that, you can use usb logic analyzer.

Cheap 8CH 24Msps ones start at 4$ (5$ with free shipping): ... _new_app=y

My 100Msps one did cost 20$, the 400Msps one 68$ (with free shipping).

I used logic analyzer sofar nearly only to analyze I2C traffic (from Raspberry to v1/v2 camera), but you can specify protocols as USB or SPI as well. The software does the decoding for you then.

I2C sample: ... 0#p1237647
Image Image

Code: Select all

Time	[s]	Analyz.	Name	Decoded	Protocol	Result	
1.21379535	I2C	Setup	Write	to	[l]	+	NAK
1.21390535	I2C	Setup	Read	to	[m]	+	NAK
1.21402639	I2C	Setup	Write	to	[l]	+	NAK
1.21413639	I2C	Setup	Read	to	[m]	+	NAK
1.21425728	I2C	Setup	Write	to	[l]	+	NAK
1.21436727	I2C	Setup	Read	to	[m]	+	NAK
1.21549542	I2C	Setup	Write	to	[l]	+	ACK
1.21558542	I2C	0	+	ACK			
1.21567542	I2C	\n	+	ACK			
1.21578542	I2C	Setup	Read	to	[m]	+	ACK
1.21587542	I2C	V	+	ACK			
1.21596542	I2C	G	+	NAK			
1.21658899	I2C	Setup	Write	to	[l]	+	ACK
1.21667899	I2C	'1'	+	ACK			
1.21676899	I2C	'3'	+	ACK			
1.21685899	I2C	'1'	+	ACK			
1.21697899	I2C	Setup	Write	to	[l]	+	ACK
1.21706899	I2C	'1'	+	ACK			
1.21715899	I2C	'0'	+	ACK			
1.21724898	I2C	'0'	+	ACK			

Return to “Interfacing (DSI, CSI, I2C, etc.)”