cancel
Showing results for 
Search instead for 
Did you mean: 

SPI communication between two discovery Board

manoritesameer
Associate II
Posted on August 12, 2014 at 19:18

Hello, 

       Can anyone help me with the an example of SPI communication between two STM32F4 Discovery Board. I have an example but with the HAL API which I dont want to use right now.

Regards

Sameer

#stm32 #spi
5 REPLIES 5
Posted on August 12, 2014 at 20:28

You'll probably have to port it a little, but

STM32F4xx_DSP_StdPeriph_Lib_V1.2.0\Project\STM32F4xx_StdPeriph_Examples\SPI\SPI_TwoBoards
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on October 09, 2014 at 17:24

Hi Sameer,

There are multiple examples based on STM32Cube_FW and HAL drivers, you have to check the following two boards SPI examples: Firmware\Projects\STM32F4-Discovery\Examples\SPI within the

http://www.st.com/web/en/catalog/tools/PF259243#

package.

Cheers,

Heisenberg.

joerg
Associate
Posted on October 09, 2014 at 19:37

I hope I don't appear as to be highjacking the thread, but believe it would be a usefull addition:

Over what distance can this work savely and what would be the technically correct way to connect two boards over a meter or two with high throughput and low overhead in hard- and software ... and a small amount of wires ? I would have used RS485, but unfortunately there doesn't seem to be support for the direction switching. Can SPI be used with some differential drivers (LVDS) or is there a RS422 solution with more wires, or ... ? I'm really stuck on this ...

(if this is not the right place I'll move it into a separate thread later). Thanks in advance.

Posted on October 09, 2014 at 20:56

Define high throughput. RS232 is certainly capable of going several hundred metres. And I've used RS422 drivers over fairly significant distances at 1Mbps. There are also things like CAN which has been used in building/office automation applications.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
joerg
Associate
Posted on October 09, 2014 at 22:10

I should rather have said ''low latency'' ... I have two boards with STM32F4 and one has the sensors, the other has the wireless communications. The sensor boards is close to the measurements, the com board is higher up where the antennae sees no metal arround ... Between them is a meter of cable. Data needs to be transmitted without much delay. I have also severe place and power constrains, so I look for a way to connect the two boards without much additional hardware and would have loved to use RS485 to have only 4 wires - GND, Power, +D, -D ... but I hate the idea to handle the direction switching in software over GPIO and interrupts. The data volume in itself is not very high ... lets say 100..200 bytes a 100 times per second ... ~200 kBaud ... but I would love to use only few wires and to use DMA on both sides if possible ... There are just so MANY options from Ethernet and USB down to single-wire ... I have trouble to home in on the most simple solution which does the job with low overhead.

Thanks for answering !