• 0
dumbguy

SPI Bus using Digital Discovery

Question

Hello, 

I am using the Digital Discovery to read an SPI transmission. The lines are as follows: 

1. CS ; 2. Clock; 3MOSI; 4 is MISO.

Please observe the transmission below. In several transmissions, the CS goes high in the middle of a 8 bit clock cycle and thereby signals the end of a communication. As can be seen below a "?h50" was recorded, in response, it seems that the slave-unit sent "?hF0".

image.thumb.png.0c4407642d3f987fd6fca2c2f1c0186a.png

Here are my questions. 

1. Why is the CS going to high suddenly in the middle of a communication ? 

2. What is "?h50"  & "hF0". 

3. Does this appear to be an error in reading ? 

 

 

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Hi @dumbguy

It looks like a glitch, a crosstalk between the signals.
1. Try separating the wires, twist the signal wires with a ground wire.
2. Use the high speed signal wires if you have, which are twisted and have termination.

Share this post


Link to post
Share on other sites
  • 0

Hello,

Thanks for your suggestion. So I have now got the high speed probing cable set form Digilent. I have connected the probes to the SPI bus. The graphic below slows clearly there is no differnce in the behaviour of the digital signals. 

 

image.thumb.png.f723ab3d32b44e10cea40438c6bae8e0.png

Is there something I am doing wrong ? 

 

 

Share this post


Link to post
Share on other sites
  • 0

So, I think I have found the solution. The ends of the digital probes (the dark colored lines) should be connected to the ground. (All the probe lines that are used). 

Also if SPI is being observed, then its preferable to increase the measurement frequency to 200 MHz or even 800 MHz. 

Share this post


Link to post
Share on other sites
  • 0

I am now trying to debug a SPI bus, where there appears to be more then 4 wires. If fact there are 7 or 8 wires and its not clear which is which. So after a lot of trying, it appears to me that the the SPI bus has 16 bits and it has several (3 or 4) chip selects running. Possibly to signal end of word and end of a sentence. 

 

I have read somewhere that 16 bit SPIs exist. Can some one share experience about it ?

 

Share this post


Link to post
Share on other sites
  • 0

Hi @dumbguy,

SPI was designed such that there are 3 primary lines that are shared between all connected devices; MOSI, MISO, and CLK. As you noted, there can be multiple chip selects that can individually signal different connected devices when the master device is communicating with them specifically. In terms of the number of bits that are transmitted at a time, each device will transfer a number of bytes to properly encompass the corresponding number of bits. My understanding is that any extra data signals are outside of the SPI protocol and are specific to the chip. 

What device are you attempting to monitor?

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Dear Colvin, 

Thanks for your message. What you have mentioned is valuable. There are possibly several serial sensors that are being probed (one after the other). This implies that the CSs are switching between the sensors. So all this appears to be happening really fast, the system does not stop at all !! (wow)

Unfortunately, I am not sure which µC is being read. It appears to me that there is a XILINX chip ( a large one) that is possible an FPGA which is working as a micro controller. I may be completely wrong (I am just a real novice, so I know less about these things). There is also a separate Motorola DSP on the board so a lot of data is being crunched very fast. A lot of guess work is needed.

So this appears to be a 16 bit transmission (I read 16 clock outs before one of the CS goes up again). 

Due to the fact that there are possibly 3 different CSs that are getting set again and again, its impossible to filter out the data from each individual sensor channel. Is there some way in the waveforms software to separate out the channels from each other ? 

Is there something you  can suggest, to help this process ?

Edited by dumbguy

Share this post


Link to post
Share on other sites
  • 0

Hi @dumbguy,

One thing that you can do is add multiple SPI bus analyzers each with their own individual chip select associated with it. The MOSI, MISO, and CLK can be all be shared between the individual bus channels (much like SPI in actual hardware) so you can more easily differentiate which data is associated with which sensor based on the status of the CS line. I have attached a picture of how this might look in WaveForms (I don't have a Digital Discovery with me at home so my screenshot is from demo mode).

I wouldn't be surprised if the sensors were continually being read, especially if they were set up so that they (the sensors) automatically collecting data and then sending the data as soon it was inquired, then between multiple sensors, it could be very easily set up to read data from one sensor (then letting it collect more data) as data is read from the next sensor, then the next sensor, effectively in a round-robin fashion with no downtime.

Thanks,
JColvin

adding additional SPI bus.png

Share this post


Link to post
Share on other sites
  • 0

Hello Colvin, 

In attachment you will find the WaveForm capture from 8 channels that I am monitoring. It appears to me that none of these is a MOSI or MISO. 

The DIN01 is possibly the Clock. DIN01 and all others appear to be either a chip select or an inverted CS (Ex. DIN03).

Either I am not observing the correct channel or there is a cross talk due to which I am not able to read off the MOSI/ MISO correctly ? 

I am using the high speed cables and adapter as recommended. However I am not sure if I am using them correctly. The red line is the probe, what should be done with the black-colored-line (marked in circle below). Should this end also be grounded ?

Is there some reason due to which I may not be observing the MISO/ MOSI correctly ?

Thanks for your kind feedback.

 

 

new---001.dwf3work1.thumb.jpg.04447a8a671ce57323ca987549fdaa43.jpg

 

 

Share this post


Link to post
Share on other sites
  • 0

Hi @dumbguy,

None of these signals in your workspace seem to indicate a SPI protocol. DIN0 and DIN3 seem to be inverse polarity of each other, DIN1 and DIN2 seem to pulse about 8 uSec apart from each other with 16 pulses between the synchronous pulses between DIN0 and DIN3. It also generally (with exception to the 7th pulse on DIO8 and the entirety of DIO11) seems to follow that on every falling edge causes a change on a higher order clock; i.e. every falling edge on DIO8 corresponds with a change on DIO9, and every falling edge on DIO9 corresponds with a change on DIO10.

The rapid pulses on DIN1 and DIN2 occur after transitions on DIO8-DIO11 so I do not think they are clocking those longer pulses. I am not certain what protocol represented in general might be though DIN8-DIN10 (aside from the odd 7th pulse on DIO8) is reminiscent of a decimal counter. Either way, I agree with you that there is not any line indicative of being MOSI or MISO or any data line.

I would probably ground the black wire to help prevent any spurious issues, though I am not seeing any evidence of problems of cross talk in your attached workspace.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0

Hello Colvin, 

Thanks for your feedback. 

Yes, this does appear to be a decimal counter and the MOSI signal is missing. 

I have now tried an Oscilloscope (60 MHz) to see if there is a data signal  some where

I could find the following pins on the flat ribbon cable: 

A. 1.8 KHz  B 900 Hz 

C. 480 Hz  D. 240 Hz 

E. 120 Hz  F. 60 Hz 

G. & H : Both at 60 Hz 

Besides that there appears to be a line that is further down on the ribbon-cable that appears to be at 64 Khz and yet another one at 3.2 KHz ! 

Also, it appears that some of these signals are at 5 V and some around 3V and one of them even appeared to be a 12V signal. So, I assume that that the 12V is a power signal and that there are two logic levels in the sensors. Sounds plausible ?

It is definitive that the MOSI signal is somewhere on this cable.

I have now tried to use the Digital Discovery High Speed Connector (Channel 0) at 800 MHz to capture each of the pins individually (40 in total). The black line on the high speed probe was grounded back to the DD.

No it appears that all the pins are some kind of data signals, as the signal falls suddenly and the rises. Except for 2 pins all others now appear to be data signals.

However, I am assume that this is only cross talk. The reason for that is:

1. The fall appears to be really short lived (and V shaped some times). 

2. This behavior is not seen as soon as I scope an additional HS Data line (example Channel  1). 

Strange! 

My question: 

1. If I use only 1 high speed channel on the DD to read a signal, is it possible that it suffers from cross talk from other lines (which are not even connected to the DD) ?

2. Is there another way to definitely isolate the data signal form a clock signal ? 

Thanks for your kind help. 

Looking forward to hear from you. 

Share this post


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