SPI speed for High speed data acquisition

Thread Starter

zhangz64

Joined May 1, 2013
7
Hi
guys,

Our team is using the SPI interface on the raspberry pi to communicate with the GP22 chip(Time to digital converter)
Data sheet of GP22 http://www.acam.de/fileadmin/Download/pdf/TDC/English/DB_GP22_en.pdf
The GP22chip is used to measure the time difference between 2 stop signals.
For the best performance ,Our project requires a measurement rate of 500Khz which is the maximum measurement rate the chip can offer
In order to reach that, We contacted the supplier and they give us a timing model which we need to follow closely in order to reach that rate.(Attachment below)


We are able to configure the chip to follow the Timing between the Fake_Start and the interrupt, However , we failed to get the SPI to work as fast as they have required.(Transfer 3 bytes with in 1.2uS == 20Mhz SPI clock speed!) We only got 5 Mhz SPI clock speed.(We set to 15.6 Mhz)

My question is that Did the SPI on raspberry pi reached its speed limit or i simply measured the SPI speed wrong?
Based on the information i found here , the max speed he got is 32Mhz

The way i measure the spi speed is to use this while loop below to iterate 100000 times then use this time function to get the running time .

Rich (BB code):
clock_t begin=clock();
while(t--)
     {
          char buf11 [] = { 0xB0, 0xff, 0xff, };    //read result 
          bcm2835_spi_transfern(buf11, 5);
     }
clock_t end=clock();
Then i calculate spi speed using. SPI_Speed= 100000/*Time_Diff *3*8 (3 means 3 bytes, 8 for 8 bits for each byte)
We are using the bcm2835 library with a divider of 16(15.6 Mhz)

The result we got is the rate of sending 3 bytes is 200 Khz which equals to 5Mhz SPI speed (200k*3*8).
Did i measure it wrong?
Also, when i try to use a divider of 8(32Mhz) The spi on raspberry PI is not working properly.(I shorted MOSI adn MISO to test the SPI, the transmitted is not the same as received :( )

We used the modified version of spidev_test.c before but the ioctl is too slow for our project, so we switched to BCM2835 library.
We found this thread
and followed it closely to remove all the 10 uS delays in the source code. But still the SPI speed is not even close to what we wanted

Also, if there is any PI user, It would be great if you can share your experience of increasing SPI speed.

First of all, please excuse me if my question is seemly easy or my bad English. I am a first year undergraduate ECE student doing summer research . There is a lot of stuff i have to learn. I tried to research this topic on the internet and could not find a affirmative answer for my case. I found my self stucked near end of the project and hope i can get some help here.

Please advise, Thanks ahead

Best Regards,

Zhen
 

Attachments

simo_x

Joined Dec 23, 2010
200
Regarding SPI clock speed, you should check the datasheet of the IC device mounted on the board.

Your answer is there.
 
Top