SPI Examples

Applications, development tools, FPGA, C, WEB
Post Reply
ayarema
Posts: 8
Joined: Sat Mar 25, 2017 1:35 am

SPI Examples

Post by ayarema » Fri Apr 21, 2017 12:59 am

The example on github https://github.com/RedPitaya/RedPitaya/ ... /spi/spi.c is not sufficient enough to actually show how to use the SPI.

The write i can sorta put together but the read function means nothing to me, how am i supposed to read specified number of bytes from an external source?

Can i make the Redpitaya into an SPI slave?

Can i use the SPI in the same application as the ADC api with the fpga_0.94.bit loaded?

What is the max SPI speed that RedPitaya can handle (Search of github source showed different numbers like 50Mhz, 25Mhz etc)?

My goal is to have it this way. On the PC side i have a USB to SPI Ftdi cable that i connect to the RedPitaya board. Then on the RedPitaya i write a single C Application that listens on the SPI as a slave for commands from the PC. There would be 2 commands, StartCapturing(0), and SendData(1). The StartCapturing i have gotten to work in C with the RedPitaya api. I am able to setup the trigger, trigger the values and read the fast ADC values into a buffer. Now i need to figure out how to send that data and receive commands from the PC over SPI.

Note: UART is too slow to send 4k samples in few milliseconds. And i dont want to have an Ethernet cable connected. On the PC end i would write a simple application that would communicate over the same USB to SPI cable.

pyzahl
Posts: 2
Joined: Tue May 29, 2018 5:07 am

Re: SPI Examples

Post by pyzahl » Thu Dec 27, 2018 1:26 am

Hi!
I do have a similar problem and need to figure out how to configure the RP Linux SPI driver to go into "slave" mode, ideally at boot/startup already as I have hardware build with serial line drivers for longer transmission lines and the RP has to be the slave to use the external clock provided by an McBSP (SPI mode) port on a DSP acting as master on the other end.

Did you figured it out? I need to listen to SPI incoming requests (ideally via ISR on kernel level?!?!?) and transmit data packages as answer. Sending valued read via GPIO.

Initially I intend to do all of this on the FPGA, but turned out I can not use the same pins if I setup my own FPGA SPI core.... so gave up on this for now.
thanks
-P

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 1 guest