Jump to content
  • 0

Question about SPI on Analog Discovery 2 with Waveforms GUI and Python


rafa_uy

Question

Hello,

I have two separate questions:

1-Is there a way to use the AD2 as an SPI slave and send bytes through the MISO while the Master is transmitting?

2-I am experimenting with the Python examples of the SPI Spy (Digital_Spi_Spy.py). I have a microcontroller sending a byte every second (at 159kb/s), so when reading 300 samples I get (each number represents the binary state of the digital pins of the AD2, e.g. "1" means only "D0" set):

[1, 1, 1, 3, 1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 3, 1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 3, 1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 3, 1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]

The byte ("0x11") is being detected properly (underscored numbers) but I dont understand how the captures works. Why all the 5 when no trigger is active in the clock line?

The trigger configuration is:

dwf.FDwfDigitalInTriggerSet(hdwf, c_int(0), c_int(0), c_int((1<<idxClk)|(1<<idxCS)), c_int(0))

Is there any command to adjust the sample rate of the trigger? Or is it working as fast as it can?

Thank you,

R

 

 

Edited by rafa_uy
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @rafa_uy

1. only sequentially

image.png

2. In this example, with sync streaming mode, one sample (state of DIO15:0) is stored for each CLK or CS rising edge. The following code then packs the MOSI/MISO bits into 8 bit values determined by the CS level.
It is working as fast as it can, resampling from the 100MHz system clock. The data streaming over USB limits average rate to a few M samples / sec.

Link to comment
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
×
×
  • Create New...