Jump to content
  • 0

Digital Discovery to collect 16 bit SPI data - multiple slaves with same CS, CLK, MOSI and individual MISO


JAlaj

Question

Hello 

I am looking to use Digital Discovery to capture 16 bit SPI data on multiple slaves, all slaves will have CS, MOSI and CLK shorted, and MISO line will be individual for each slave. I want to capture continuous data for 24 hrs and dump it in a  text file

I also want to power up the part using same HW, so that i can capture SPI right after power up

Pls suggest, 

Thanks,

Jalaj

Link to comment
Share on other sites

Recommended Posts

  • 1

Hi @JAlaj

Using the latest version:


Create a custom pattern for SPI control. Use pattern frequency, wait and/or pattern length to adjust the timing:

image.png

 

You can also configure Pattern to wait for the Protocol/SPI reading to start by selecting Logic, uncheck Trigger-repeat.

image.png

 

Configure the Protocol/SPI/Spy like here:

image.png

 

Start Patterns, then press receive "to File", select text or the newly added Binary for better performance, press Cancel to stop.

The sustainable rate depends on the USB port, computer... the log in the progress window will show "samples lost" on device buffer overflow.
For me binary record was working for 24x16bit capture below 500kHz, wait+run more than 2us.

 

Link to comment
Share on other sites

  • 0

Thanks Attila, this works

how do i dump all the MISO data in a file read via Sensor tab

Also, how do i capture multiple MISO via this sensor tab and dump all data in csv

Edited by JAlaj
Link to comment
Share on other sites

  • 0

Thanks Attila

Where can i see the details about commands used in example menu. Basically, i am trying to understand about the commands used and intent in this example

function loop(){

var rg = CmdRead(8, 0xF2, 0, 8, 6); // DATA X Y Z

// convert data bits to signed value relative to gravitational constant

var x = data2g(rg[1], rg[0]);

var y = data2g(rg[3], rg[2]);

var z = data2g(rg[5], rg[4]);

// total acceleration

var s = sqrt(sqr(x)+sqr(y)+sqr(z));

if(!FileAppendLine("~/Desktop/default.csv", [s, z, y, z])) return "File write failed";

rgG.push(s);

return true;

Link to comment
Share on other sites

  • 0

Hello

Using Sensor tab, i was following 3rd example. I couldn't understand example 1 and 2. 

In example 3, how do i read the reg 0x330, hex address is 330. Please suggest. 

Moreover, the max limit on number of samples is 1M. How do i go beyond that

Link to comment
Share on other sites

  • 0

Hello Attila, 

There is a bug in Waveforms version 3.20.26. While capturing the waveform in Logic window and exporting the complete capture, only SPI MOSI and SPI MISO data is shown in the excel. I am not able to see the detailed data of each SPI channel such as Select, Clock, MOSI, and MISO. Please add the detailed data of each SPI channel to the export excel. I have also attached a screenshot below for your reference. 

Thanks,

Shalin

image.thumb.png.0146aecdefed0cf7bd1e7afb4a04e47c.png

Link to comment
Share on other sites

  • 0

Hi @Shalin

See the various Source options, events or the SPI channel, but for logging the interpreted SPI transfers better use the Protocol/SPI/Spy

The Logic events got fixed in the latest version v3.20.27
It was broken earlier after introducing the variable capture resolution to allow 64bit captures, "Scope to Digital" digitization...

image.png

image.png

Link to comment
Share on other sites

  • 0

Hello Attila,

I have 2 queries,

1. In SPI Mode. how to write to a address ? For example, I need to write 0001 to address h0012. Please explain. 

2. The master window of SPI interface is showing constant read output of 0000 for all read/write address commands. I have attached a screenshot below.

image.thumb.png.e1c895725e0d2211b25008d32b999f20.png

 

Thanks,
Shalin

Link to comment
Share on other sites

  • 0

Hello Attila 

Thanks for sharing the command help

My objective is to read data from 24 MISOs. 24 slaves will have common CS, CLK and MOSI

This Digilent 16 bit SPI Master will keep sending commands to 24 slaves and i need to capture 24 MISOs. Need to capture this data in file. This communication need to run continuously for 24 hrs. The sampling rate needs to be around 200us , means CS falling to falling edge is 200us.

I am struggling to achieve this via Digilent as i am still not able to do this for 1 slave (MISO)

Would appreciate if you can suggest some script.

I tried following Sensor examples you mentioned earlier, but couldn't follow much.

 

Regards

Jalaj

Link to comment
Share on other sites

  • 0

Hello Attila

i tried the Sensor tab as you suggested

Attached is my script. i want to configure my part first and then read data iteratively

I see there is huge delay between commands outside the loop function(refer attached logic analyzer snap). Please suggest how it can be minimized

Additionally it would be nice if the logic analyzer displays correct data even if i zoom after capturing large data

digilent spi.PNG

digilent spi_script.PNG

Edited by JAlaj
added details added regarding logic analyzer capture
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...