SPI maximum number of bytes to transfer in one transaction | LabJack
 

SPI maximum number of bytes to transfer in one transaction

3 posts / 0 new
Last post
mina
Synapticon's picture
SPI maximum number of bytes to transfer in one transaction

Hello, I am trying to figure out what is the maximum number of bytes to transfer in one SPI transaction and what determines this? 

Using your SPI example in PythonLJM library, i can transfer up to 50 bytes in one transaction. When i attempt to transfer more, it gives me one of the 2 errors:

Address -1, LJM library error code 1278 LJME_PACKET_SIZE_TOO_LARGE

Address 5051, LJM library error code 1202 LJME_MBE2_ILLEGAL_DATA_ADDRESS: 5051

The reason I am asking for this maximum number is the following. I have a continuous square wave signal (at 10kHz to 15kHz) that is being processed by the external ADC. I would like to sample this square wave somewhat like in the streamburst maner. I would like to sample enough data such that I could extract the frequency of the signal out of this data. I will likely perform multiple SPI transactions consecutively, but I would like to know my maximum transaction size. 

LabJack Support
labjack support's picture
SPI is limited to 100 bytes.

SPI is limited to 100 bytes. You may be encountering the USB packet size limit of 64 bytes (50 plus some overhead). Switching to Ethernet would allow up to 100 bytes. Another option is to use a Lua script to run the SPI operations and store data in a FIFO to be read out by the host computer.

mina
Synapticon's picture
Got it. I did verify that

Got it. I did verify that with Ethernet connection I am able to transfer a maximum of 100 bytes, and with USB a maximum of 50 bytes. 

Thanks for yet again a very quick reply! :)