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

  • 0

Hi @JAlaj

The sampling rate Logic Analyzer should be more at least twice of the SPI clock frequency !
image.png

Only the SPI transfers in the loop function are packed !
The loop Rate should be less than SPI Frequency/ SPI bits in loop cycle ! above 8-9MHz for 16bit * 500kHz
Do you want to read or write or.. ?

image.png

Currently the Protocol only supports the 16 DIOs.
I could add support for DINs as input but the data streaming need for 500kHz rate (72MBps) is beyond the USB bandwidth (45MBps). At this rate the device memory is sufficient only for about one minute.

image.png

Link to comment
Share on other sites

  • 0

Thanks Attila

Is there a way to dump data in text file and capture simultaneously so that i never hit the memory limit, something like filling/emptying FIFO

Also, how do you dump the 15 MISOs data in text file

Regarding your question on read/write in my SPI commands....my part works on below SPI format 

bit15 , bit[14:0]

if bit 15 is 0, then its a read command for part

if bit 15 is 1, then its a write command for part...

so if give Write (16, 0x0055), then i am reading address 55

if i give Write (16, 0x0055) followed by another Write (16, 0x00AA)....here i am writing register 55 with data AA

 

Regards

JAlaj

Link to comment
Share on other sites

  • 0

Hello @attila

In Sensor tab, when the commands are mentioned outside the "function loop()", there is a huge delay between each command. The similar commands written in the "function loop() have smaller delay. Please maintain smaller delay between the commands written outside the "function loop ()". I have attached the screenshots below for your reference. 

Thanks and Regards,

Shalin

image.thumb.png.a484c08ed9ec96288e276855541c6365.png

image.thumb.png.d6d937d6105acc804a4065f1ae66a65b.png

 

Edited by Shalin
Link to comment
Share on other sites

  • 0

Thanks @attila . 

Further, we are planning to use Digital discovery for SPI interfacing in our upcoming project as we earlier did with SWD. 

I wanted to know that do you have the support of SPI interface with LabView. Previously, you had provided the same for SWD.

I will be grateful if you can provide me the LabVIEW support for SPI interfacing as well. 

Shalin

Link to comment
Share on other sites

  • 0

Hello @attila

I tried calling API functions in LabView. However, I am not able to generate the correct pattern using API functions. In LabView, I am trying to write 0091 in hex. In the output, I am unable to see the clock and getting invalid MOSI and MISO response. I am attaching the labview VI which I have created and its output captured by logic analyzer.

Thanks,

Shalin

image.thumb.png.cd994bb1d101c6b4ae757d9a0056327b.png

SPI_Read.vi

Link to comment
Share on other sites

  • 0

Hello @attila

I have extensively checked the API functions of SPI in LabView. These developed API functions are not operating correctly. As an example, I have also attached the sample LabView VI for reference in my previous post. 

I would be grateful if this issue can be rectified. 

Also. let me know if you require some additional information from our end.

Thanks,

Shalin 

Link to comment
Share on other sites

  • 0

Thanks @attila. I will try it.

Also, I want to know that how do you record the patterns in waveform GUI when you send command through LabView. I was trying the same but the waveforms GUI app says that the device Digilent digital discovery is being used by other application (labview). As a result, I am not able to record the labview pattern in waveforms GUI. 

Link to comment
Share on other sites

  • 0
On 9/7/2023 at 7:49 PM, attila said:

Hi @Shalin

See the following example where 3 words of 16bit are set on TX and 4 words received on RX dwfvi.zip

 

 

Captured with an AD3:

image.png

have LV 2022 installed so I can't open your project.

Hello @attila

The API functions of the latest waveform version 3.20.31 is different in comparison to the API functions listed in the dwfvi.zip file.  One of the functions listed in the dwfvi.zip file with name "F DWF digital SPI write read 16" has got array unsigned type of "rgTX" parameter whereas the same function listed in the latest SDK version 3.20.31 does not have array unsigned type of "rgTX" parameter. Could you please make it array type in the latest SDK versions API as well ?   

Most importantly, I am sending a long sequence using "read write 16"  API function listed in dwf.vi. However, the output captured in LA is inappropriate. Similarly, I am receiving dissimilar output captured by MISO LA and MISO rgRX. I am attaching the VI below for your reference and some screenshots of LA. 

image.thumb.png.35d7aed1cefac492f099d09175187850.png

image.png.219432afc6a037007efd89dee4310d38.png

Thanks,

Shalin

 

 

 

dwfvi.vi

Edited by Shalin
This is a new query @Attila
Link to comment
Share on other sites

  • 0
On 9/1/2023 at 9:41 PM, attila said:

Hi @Shalin

The VIs provide simple usage and for advanced usage all the API functions can be called from LabVIEW, just like from Python...
The newly added multi-miso option is only available in the WF application.

 

Hello @attila

In the labview, I am not able to receive MISO data for the input data. I am only able to see the data written through MOSI (rgTX) but the output obtained on the MISO channel (rgRX) is incorrect. On the other hand, I have compared the same by using waveform GUI application where you can see that for 0100, the output in MISO channel is 00D0.  I am attaching some screenshots below for your reference.  

Please optimize the API functions so that they work and deliver similar output as the waveforms GUI application. 

Thanks,

Shalin

image.png.2aa077ebc89602c52b58a881a65a1ba6.png

image.thumb.png.19eb2c47dea54ce630958e190c4c0417.png

Link to comment
Share on other sites

  • 0

Hello @attila

I am facing an issue while I probe signal of MISO line on logic analyzer. In the  labview, when I write 0100, the MISO output (rgRX) reads value 00D0. Further, when I probe this output on logic analyzer, I am able to see the input (0100) written on the MOSI whereas I am not able to see 00D0 on the MISO channel. A wrong value FF is shown there. Please help regarding the same. 

Thanks,

Shalin

image.png.767db54439c4be70ff888ab237cb60fe.png

image.png

Link to comment
Share on other sites

  • 0

Hello @attila

I have checked the connections of the MISO pin connecting to the logic analyzer. The connections are perfectly fine. The labview is showing correct response of 00D0 whereas in LA it is showing FFFF. I am attaching the screenshot of Labview response and LA output below. 

Thanks,

Shalin

image.png.8a24bc9925c2266092d17a700ebcfe0f.png

image.thumb.png.5dbf4fed18374bb32061054a61c390e3.png

Link to comment
Share on other sites

  • 0

Hello @attila,

The noise was within the Logic analyzer. I have switched to a new LA and the problem is resolved now.

Further, I am trying to write a command 0000. I am not able to receive any response against this command in the rgRX. Could you please help, I am attaching the developed VI below.  

Moreover, is it possible to write the 4 words in a single row rather than writing them individually in a separate row ? I am attaching the screenshot below to understand better. 

Thanks,

Shalin

 

 

Capture.JPG

Capture.JPG

SPI_read_3.vi

Edited by Shalin
attached VI
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...