SPI Interface in LabVIEW

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
Sorry for a very late reply. I was busy and in some other projects. I recently tested the firmware but unfortunately it is not working. I think the problem may be with the width of the SCS high pulse. The pulse width is about 1uS (current driver) and the actual pulse width required is 2.8uS. The other thing is the delay between the 8 clock pulses. This delay is 2uS (Current driver) while the actual required delay is 23uS.

Rest of the waveform is identical. For now we can ignore the lines MOSI and MISO.

Thanks

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Here the actual waveform with details. The clock frequency (SCK) is 250KHZ and not 25KHZ
SPI Interface.JPG
SPI Interface.JPG (121.66 KiB) Viewed 26996 times

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: SPI Interface in LabVIEW

Post by xol »

Hi,
I'm not sure what you want me to do about it?
Should I increase SS high pulse duration an byte to byte time?
Give me exact numbers.

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
Here are the details
SCK (Clock)
8 cycles [Frequency 250KHZ, High time 2.2uS, Low time 1.8uS] (Total time for 8 cycles will be 32uS)
Clock idle time 23uS (Clock remains low during this time)
The above pattern will transfer 1 byte and this pattern needs to be generated 3 more times in order to transfer 4 bytes all together. The clock should remain low once the 4 bytes are transfered. (refer to the figure above)

SCS (Chip Select)
The idle state is high.
This line goes low and remains low for 50uS and then goes high for 4uS [first bytes is transfered during this time i.e. 8 clock cycles and clock idle time]
This pattern is repeated 3 more times while the bytes 2, 3 and 4 are transfered. Once the 4 bytes are transfered the SCS line goes high and remains high.

Is it possible that a control be added so that the user can specify the number of bytes to be transmitted (in future we intend to upgrade the system to receive 6 bytes). The clock and chip select pattern can then be generated number of times equal to the bytes transfered.

Thanks

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: SPI Interface in LabVIEW

Post by xol »

So, compared to what was done before I need to add following:
1. Delay of 23us after 8'th SCK clock
2. Longer SS high time of 4us
Correct?

As for number of bytes it is totally under your control. Te changes I make just override defined behavior of SCK and SS. If you use SS_LO and I force SS high pulses between bytes you are not limited to 4 bytes.
You can send and receive bytes at the same time.
http://www.xdimax.com/sub20/doc/HTML/su ... ansfer.htm

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
This is correct. Thanks for the explaination about sending more bytes

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: SPI Interface in LabVIEW

Post by xol »

Try this and let me know
Attachments
SUB20-0.2.6_SS_H_PULSE-1.inc
(53.91 KiB) Downloaded 1542 times

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Thanks. I will let you know

Sidd
Posts: 14
Joined: Fri May 28, 2010 2:11 pm

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
I tried it and it is still not working. The SCS line should remain high once the four bytes are transfered but there is a low pulse which i think is creating problems. I tried all the possible configurations but this (low pulse) remains there. I have attached the waveform.

Thanks again
Attachments
final.jpg
final.jpg (32.93 KiB) Viewed 26986 times

xol
Site Admin
Posts: 241
Joined: Sat Aug 29, 2009 8:04 am

Re: SPI Interface in LabVIEW

Post by xol »

OK,
I can clean it.
Tell me if all the rest is OK.

Post Reply