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

SPI Interface in LabVIEW

Post by Sidd »

Hi
I'm using Sub-20 Multi Interface adapter as Master device. I want to transfer 4 bytes . The CS line should be low during the transfer of each byte and high in between. There is no SS_Mode available for this. Is it possible to add a custom mode.

Thanks
Sidd

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

Re: SPI Interface in LabVIEW

Post by xol »

HI,
The most simple solution is to split 4 bytes transfer into 4 transfer of 1 byte each with corresponding SS_mode.
Will it be good for you?

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

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
The delay between transfer of each byte is critical and by sending 1 byte with correcponding SS_mode this will not work. I have attached the waveform I have to genererate. Thanks
Attachments
SPI.jpg
SPI.jpg (62.82 KiB) Viewed 45523 times

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

Re: SPI Interface in LabVIEW

Post by xol »

Hi,
One option is to prepare custom firmware for you. Before we do it I need to understand details.
What is required SS high duration between bytes?
Are there any limitations in relation between last clock, SS high pulse and next clock?
What is your SPI slave device? I would like to see it's specification to be sure. Also perhaps such mode of operation is common for some devices in this case we can consider to include it into general SUB-20 firmware.

I still quite sure that slave device you are communicating to do not measure SS high duration and if you will split it into 4 transactions it will work. Have you tried at least? Before we start working on customization can you please try splited transaction?

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

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
Here are the details
CS (SS) is low for 56uS and then high for 2uS
SCLK is 500KHZ and 8 clock pulses are generated to transfer 1 byte
SCLK starts with a low and once the byte is transfered it goes low.
SPI slave device receive 4 bytes and then send 4 bytes to the Master device with same format.

The SS high time in between is critical and is used by the slave device to count bytes received. I tried to transfer the bytes in 4 transactions but then the duration is in mS (SS high duration) and the salve device is not detecting it.

Thanks
Sidd

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

Re: SPI Interface in LabVIEW

Post by xol »

Sidd wrote:Hi
Here are the details
CS (SS) is low for 56uS and then high for 2uS
And what if it would be 3uS? And if 4uS? ....
The right way is to see specification of the interface and implement it accordingly.
Sidd wrote: The SS high time in between is critical and is used by the slave device to count bytes received. I tried to transfer the bytes in 4 transactions but then the duration is in mS (SS high duration) and the salve device is not detecting it.
I asked you to tell what SPI slave device is it and provide it's specification.
Can you do it?

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

Re: SPI Interface in LabVIEW

Post by Sidd »

Hi
Thanks for your reply.
xol wrote: And what if it would be 3uS? And if 4uS? ....
The right way is to see specification of the interface and implement it accordingly.
The time (SS high) for this slave device can be anything between 2uS to 5uS. The slave device is looking for a narrow rising edge. This cannot be in mS.
xol wrote: I asked you to tell what SPI slave device is it and provide it's specification.
Can you do it?
The slave device is a custom data acquisation system based on blackfin DSP BF532. The slave device is configured through SPI interface. The four bytes are 1 preamble byte, 2 data bytes and 1 checksum byte. I'm using MOSI, MISO, SCLK (500KHZ) and SCS pins. The master device transmitts 4 bytes in this format and then receives 4 bytes in the same format. This transmission (8 bytes) is one frame and the minimum time between two frames is 5mS. Let me know if you need to know anything specific about this device.

Thanks
Sidd

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

Re: SPI Interface in LabVIEW

Post by xol »

Hi,
I have prepared custom FW for you. It make unconditional (regardless SS Config) SS high pulse.
Please check it and let us know.
Attachments
SUB20-0.2.5_SS_H_PULSE.inc
Custom firmware with SS High pulse between bytes
(48.18 KiB) Downloaded 3309 times

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

Re: SPI Interface in LabVIEW

Post by Sidd »

xol wrote:Hi,
I have prepared custom FW for you. It make unconditional (regardless SS Config) SS high pulse.
Please check it and let us know.
Hi
Thanks for preparing this custom firmware. I had a quick look at the waveform and I think it should work. I will do some testing and will let you know.

Thanks again for your help.
Sid

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

Re: SPI Interface in LabVIEW

Post by xol »

Any news?

Post Reply