2014-08-12 10:18 AM
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.RegardsSameer #stm32 #spi2014-08-12 11:28 AM
You'll probably have to port it a little, but
STM32F4xx_DSP_StdPeriph_Lib_V1.2.0\Project\STM32F4xx_StdPeriph_Examples\SPI\SPI_TwoBoards2014-10-09 08:24 AM
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 package.Cheers,Heisenberg.2014-10-09 10:37 AM
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.2014-10-09 11:56 AM
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.
2014-10-09 01:10 PM
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 !