2018-04-11 08:50 PM
Hi everyone, i'm trying to use two stm32 boards (STM32F411DISC &STM32F407VGT) for SPI communication. How to interface the SPI with Two stm32 boards, one act as master another one act as Slave and declare their pins on the cubemx?
2018-04-11 09:46 PM
Hello,
in the STM32CubeF4 package, you have an example with SPI_2boards. You may use it as a reference.
Best regards,
Tilen
2018-04-11 11:56 PM
thx for your responding, Tilen. I have used SPI1 on two stm32 boards. One act full duplex master another act full slave. I've generated their code using MDK5. But I still confused how to display their SPI results?
2018-04-12 01:43 AM
Hi
devieandriyani9
,As it is suggested by Tilen, ready examples thatshow how to ensure SPI data buffer transmission/reception between
two boards ,are included in our STM32cubeF4 firmware package:STM32Cube_FW_F4_V1.0\Projects\STM32F411E-Discovery\Examples\SPI
I recommend you to start with these examples to develop you own application
You canget the
STM32CubeF4 package via this
-Nesrine-
2018-04-12 03:28 AM
nothing is easy,
everyone here has to work though so many issues, don't be discouraged.
nice to see you join the club,
to view SPI data:
can you get an LCD project running ?
or you will have to use a serial port.
try an example LCD project and set up a text window.
send your SPI data to the LCD text window or to the serial port.
You can view the serial data on a terminal emulator.
or I guess you could use a break point in your code, if your IDE supports it.
2018-04-12 03:42 AM
I don't use an LCD project, only use terminal emulator to view SPI data. Many thanks
Majerle.Tilen
for your answers and suggestions2018-04-12 03:46 AM
How do you use a terminal emulator to view SPI data??
Terminal emulators (generally) work with async - 'U(S)ART' - comms; not SPI!
2018-04-12 03:50 AM
thx a lot for your recommendation,
ELMHIRI.Syrine
. I'll try that later.2018-04-12 03:57 AM
T J wrote:
nothing is easy,
everyone here has to work though so many issues
Indeed.
A very common beginner's mistake is to jump in too deep, and try to do too much all at once.
A classic example is trying to write both an SPI slave and an SPI master all at once and then expect it all to 'just work'.
But then, When it doesn't work, how can you tell if the problem is with the master, or the slave - or both?!
The way to approach a project is always to break it down into small steps; eg, first get your Master working with a known-good slave. Then, once you know the Master is good, move on to making the Slave.
It is also important to think about how you will debug a project from the start.
Hence I suggest the following for getting started - on any microcontroller:
https://www.avrfreaks.net/comment/1138166&sharpcomment-1138166
This is the approach that I would take myself when starting any new project.
2018-04-12 04:00 AM
I use Analyzer2Go software as terminal emulator. So, I have two stm32 boards. Early, I use them as master and slave. But i don't have saleae logic analyzer