2014-02-19 01:34 AM
Hello everyone,
I would like to use SPI protocol in order to communicate between two µC STM32f429.
One will be a master, and the other one will be slave.
I would like to perform very easy operation to begin with (the master always sends DATA1 and the slave always sends DATA2, and each of them displays the data it receives).
For the master, I have used this code :
http://eliaselectronics.com/stm32f4-tutorials/stm32f4-spi-tutorial/
For the slave, I’ve tried to write the code by myself by changing the master code but it doesn’t work for the moment. The slave does not receive anything. What I have changed:
-
SPI_InitStruct.SPI_Mode = SPI_Mode_Slave instead of Master.
-
PE7 for chip select is INPUT in the slave instead of OUTPUT and so it does not have to be set high or low.
What other changes do I have to apply? How to manage the slave selection with PE7?
Could I try to use only one µC and to make SPI1 of it communicate with its own SPI2 ?
Thank you very much.
2014-02-20 04:47 AM
Hi
Why did you not start by looking at the examples from ST Micro? Try https://my.st.com/st-extranet-web-active/active/catalog/tools/FM147/CL1794/SC961/SS1743/PF257901 This is the Standard Peripheral Library (Drivers for all the STM32 internal peripherals). As part of the download, there are examples for ALL the peripherals. There are 2 examples for board to board SPI - DMA and IRQ. The examples handle both sides (master and device).