• 0

SPI sensor script ReadWrite not working (3.6.8)


In Waveforms 2015 3.6.8 on a Mac OS 10.11.6 with an Analog Discovery 2, I am not able to get the SPI sensor scripts to work.  I'm having no trouble with Master or Custom scripts, but with the Sensor scripts the ReadWrite() commands always return an array of zeros, even if I'm not in Debug mode.  (I tried starting from a fresh run of Waveforms, to make sure that the debug setting was not just being excessively sticky.)

Can anyone else duplicate this behavior?  Or is it just me?

Incidentally, the documentation for the protocol instrument and the scripts is woefully inadequate—I had to figure out how things worked by trial and error, because of the extreme lack of information in the documentation.

Edited by gasstationwithoutpumps
Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I tried many different versions of the sensor script, but I've discarded them all, as none did anything useful (I always got 0s from ReadWrite).

It took me a while to figure out exactly what Read and ReadWrite did—what they expected as arguments and what they returned.  It did not help that turning on "debug" caused them to return 0 (is that documented?).  (Why can't both the logic analyzer and the script see the data?)  

I ended up having to guess what functionality was available and how to use it by reverse-engineering the few examples given.  I managed to get a working custom script that way, but never managed to get a sensor script that did anything.  It didn't help that I was trying to use the protocol tool to debug an SPI slave that I was building—I was never certain whether the problem was with my understanding of the protocol tool or a bug in my own SPI interface.

It would have been nice to know about the huge delay between a Write and Read—it took me a while to realize why they were behaving differently from the same series of transactions as ReadWrite.  I ended up using the custom tool and the logic analyzer to do all my debugging, but I would have liked to then transition to doing a large sequence of reads with the sensor tool, to look for intermittent problems, but no matter what I tried, I always got 0s from the ReadWrite in the sensor tool (I think—it was not clear how to add debugging outputs to the sensor script, since only a single line of output was ever visible).

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now