Digital I/O

Showing results for 
Search instead for 
Did you mean: 

NI USB-8452 - Achieving maximum SPI write speed

Go to solution



I have a USB-8452 with the latest software (2.1.2) installed. The host computer is a Core i7. I am trying to achieve the maximum SPI write speed possible with the device. I have tried the SPI Basic Read/Write block, SPI Scripting blocks, and SPI Streaming, but the first two have large delays between CS falling and data being written (along with while loop delays), and the last appears to be useful exclusively for read operations.


Can anyone tell me if there is either a way to a) reduce the setup times for SPI Basic / SPI Scripting or b) write different values within a single SPI Stream? Thanks in advance for any help on this issue, even if it's just confirmation that yes these are hard limitations that can't be overcome with the LabVIEW 8452 interface at this time.


Here is the best I'm able to currently do, as shown on my logic analyzer. Changing the SPI clock speed doesn't affect the setup and delay times that are the primary and secondary bottlenecks:


SPI Basic Read/Write -


Program: Basic setup followed by SPI Write/Read block by itself in a while loop

Primary bottleneck: ~450 us delay between while loop iterations (see capture 2)

Secondary bottleneck: ~6 us delay between falling edge of CS and first clock pulse (see capture 1)


Capture 1 - Highlighting delay between CS falling and first SCLK pulse

001 - Delay from CS fall to write start.png


Capture 2 - Highlighting delay between while loop iterations

002 - SPI write-read loop.png




SPI Scripting -

Program: Basic setup followed by two Run Script blocks in a while loop (to check both block to block and loop iteration delays)


SPI Scripting block diagram for capture 2.PNG


Primary bottleneck: ~450 us delay between while loop iterations (see capture 3, space between second and third captured frames)

Secondary bottleneck: ~250 us delay between consecutive Run Script blocks (see capture 3, space between first and second captured frames)


Capture 3 - Highlighting consecutive Run Script delays and delays between while loop iteration

003 - SPI scripting.png




SPI Streaming - This is the closest to achieving a reasonably fast write speed, but unfotunately it seems to be exclusively useful for read (e.g. ADC) operations, not write.


Program: Basic stream setup followed by Stream Start block

Primary bottleneck: Can't write anything other than single data value to 'Waveform 1 -> MOSI Data' property. I can write an array of bytes to this property, but it will simply put all of those bytes in one frame and repeat this frame (see capture 4) rather than cycling through each value.


Capture 4 - Two bytes sent repeatedly using SPI Stream. CS delay is finally good, but no ability to change MOSI data frame to frame.

004 - SPI stream.png

Message 1 of 7
Accepted by JBender1

Hi JBender1,


This performance sounds like what we would expect for an 8452.


If you need higher performance, I would encourage you to look into using an R Series or FlexRIO FPGA card for your implementation.

Joey S.
Senior Product Manager, Software
National Instruments
0 Kudos
Message 2 of 7

Hi Joey,


Okay, thank you for the quick reply.


Jonathan Bender

0 Kudos
Message 3 of 7

Can you please post the source file for this example.

0 Kudos
Message 4 of 7



We have some examples available if you download USB-8452 drivers. I haven't been able to find the exact example pictured though. You can find examples in the example finder, which you can access via "Help>>Example Finder". You can find SPI examples under "Hardware Input and Output>>I2C and SPI"


Drivers for USB 845x


I know that isn't exactly what you need, but let me know if that helps. It will at least get you started and get you the API for the USB-8452.

0 Kudos
Message 5 of 7

I'm using LabView 2017 and a NI USB-8452 and would also like to send SPI data via the 8452 as fast as possible to a SPI device.


Are the limitations discussed in this thread strictly for the USB-8452 hardware or could I expect any improvements with a newer version of LabView but still using the USB-8452?


Also, in LabView 2015 (and maybe prior versions) there were LV blocks under Instrument IO/NI-845x (also shown in the original post of this thread in SPI Scripting) but I can not find where these are or how to add these to LabView 2017.   


NI-845x in LV2015.gif


Has this been replaced with the SPI Digital Waveform palette?


SPI in LV2017.gif


Will the SPI Digital Waveform blocks work with the USB-8452?   If not, what LV blocks (functions/vi) can I use in LabView 2017 to work with my USB-8452?


I appreciate any help.


0 Kudos
Message 6 of 7

The NI-845x 17.0 driver should install functions in Instrument I/O >> NI-854x




Please try reinstalling the NI-845x 17.0 driver and restart your computer and look for these functions. 

Dane S.
Product Support Engineer
National Instruments
0 Kudos
Message 7 of 7