2016-08-12 03:12 AM
Hi,
I want to transmit and receive data between two STM32F401RE NUCLEO boards. Performance does not matter, so the simplest approach seems to be using the blocking HAL_SPI_TransmitReceive(..) function on both sides. One board is setup as master, one as slave, code and config are generated via CubeMX. I am pretty sure to have a correct wiring (using the same setup for SPI-bootloader communication with hardly any problems). The strange thing is that when I debug the code on the master, I receive a bit-shifted version of the data that I send on MISO. Example: I send 0xA6 on the slave, but I receive 0x9A (same byte shifted by 2 bits) on the master. This shift occurs randomly with each reboot of the MCU and then stays persistent. So if the shift once is 2 bits, it stays 2 bits even when I resend the byte many many times. When I reset the master MCU, the shift differs randomly. Do I have to flush something prior to communication? What else could I do wrong? (CPOL and all other settings are the same on master/slave.) Thanks for the help :) Janis2016-08-12 04:29 AM
Hey,
I updated CubeMX and recreated the projects. Now everything seems to work like a charm, but I have no idea what actually caused the problem :( Thanks anyway