Jump to content
  • 0

Externally triggered SPI read0


Burkhard

Question

Hi,

I am a new user and might ask silly questions but this is where I am ?

I do have an Analog Discovery 2 system and I need to perform an SPI read0 every time an external logical trigger signal appears. I tried to implement it with an SPI protocol script and it works conceptually. My problem with that solution is that the script reaction time to the incoming logic signal change is very slow (~100ms range) and the incoming trigger signal for the next available SPI data byte to be read is in the 1ms range.

Is there a way to trigger a single byte read faster than with the script?

Thanks in advance for any help!

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

On 2/12/2020 at 1:22 AM, JColvin said:

Hi @Burkhard,

I apologize for the delay; I have moved your thread to a more appropriate section of the forum where the engineer with much more experience using the WaveForms software will be able to see and respond to your question.

Thanks,
JColvin

And where is this thread now? I didn't find it.
@Burkhard, could you post the script?

Thank you.

Link to comment
Share on other sites

Here you go (by the way, I moved on and am currently not working with the tool anymore)

=======================================================================

//Test script using Protocol spi for analog discovery tool to read a byte after a trigger signal at I/O port 0

clear()

if(!('Protocol' in this)) throw "Please open the Protocol tool";

if(!('StaticIO' in this)) throw "Please open the StaticIO instrument";

Protocol.Mode.text = "SPI" // make sure SPI tab is selected

StaticIO.Channel0.Mode.text = "IOs";

Protocol.SPI.Start() // activate select

while (StaticIO.Channel0.DIO0.Input.value == 0) {} //waiting on the I/O value at port 0 to go high 

var rg = Protocol.SPI.Read0(8, 1) // read 1 byte of 8 bit length

print(rg)

Protocol.SPI.Stop() // deactivate select

 

Link to comment
Share on other sites

Hi @Burkhard

The Protocol tool does not have trigger option.
The software polling could be improved to have ~1-10ms response by adding StaticIO.read() in the loop.

You could use the Pattern Generator to create a custom SPI signal (CS, CLK).
This can trigger for instance on External trigger (interrupt) instantly (within nanoseconds) to generate the SPI pattern.
Then have the Protocol SPI/Spy to receive the read data.

image.png.67afdd2de203a08c079a31165f260e25.png

Link to comment
Share on other sites

Thanks for the response! I actually did use the static IO in my script and it turned out to be very slow. And yes, creating a custom SPI control with the pattern generator looked like the path to use. But I managed to solve my problem differently ? so I did not pursue that solution.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...