T7 SPI Clock Incorrect | LabJack
 

T7 SPI Clock Incorrect

4 posts / 0 new
Last post
JohnCunningham
JohnCunningham's picture
T7 SPI Clock Incorrect

I am trying to get SPI working with a TI DRV8301 Motorware device. The Labjack will act as master, and the motorware is acting as slave.

My code for setting up the SPI parameters is below. When I hook up either a logic analyzer, or even to an oscilloscope to measure the signals, I am not getting anything close to what I am expecting.

Take for instance my clock signal, I have tried each of the different speed values that are listed, and I'm not seeing the correct signals on my end. I have tried with, and without including the capacitor that is recommended in the SPI documentation, to no avail.

File Attachment: 
LabJack Support
labjack support's picture
I added a loopback test to

I added a loopback test to your program and it seems to send and receive data properly. To run the test all you have to do is connect FIO6 to FIO7. Using an oscilloscope I calculate the clock frequency to be 115 kHz.

JohnCunningham
JohnCunningham's picture
I am able to do the example

I am able to do the example loopback test just fine, however, when I measure the clock speed on either an SPI enabled oscilloscope, or a digital logic analyzer, I see that the clock is actually reading at 10 Hz. 

LabJack Support
labjack support's picture
10 Hz. I am not sure what

10 Hz. I am not sure what going on there. I've attached a scope capture of multi-byte portion of the test. My scope calculates the clock frequency to be 117 kHz. 

There must be some shorted lines interfering or we are not measuring what we think we are. For me the clock line is on FIO5.

Also, it may help to disconnect your SPI slave device(s) while we make sure that the SPI bus is working properly.