• 0

Reading SPI data from an external master in a script?


Question

Hi,

 

I am working with an I2C - SPI bridge chip.

I'd like to use a script to send I2C commands/data to it, and then read the SPI data it produces, and compare it with the original I2C data.  The I2C data is completely received by the bridge before any SPI data is sent.

 

Is this possible?

 

I do have a simple script that sends data to the bridge, and a logic analyzer window properly captures the SPI response.

 

image.thumb.png.3a3ecf4555e1bd7f3c3c2d451f355eac.png

 

Any guidance on reading in the SPI MOSI data shown is appreciated!

 

Thanks,

Alex

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @alexpeck

You could switch with Script the Protocol between I2C and SPI but this may require a few milliseconds in which you could loose your bridge response.
To overcome this you would have to add delay in your bridge between I2C reception and SPI transmission.

Another way would be using the Protocol with Logic Analyzer, option in top-right edge of the Protocol. Use the events in Logic Analyzer to verify the I2C and/or SPI data. These are returned as array of text (by default hex) that can be parsed like this:

var rgMosi = []
Logic.Channels.SPIMOSI.events.forEach(function(t){rgMosi.push(parseInt(t.substring(1),16))})

image.png.cc7d61f410015413f010d92887c54548.png

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