I plugged all components to an Arduino (both UNO and MEGA) and everything works perfectly, however I am required to do it over an STM32H743ZI2 board and here comes troubles...
I am using the Embedded Coder Support Package for STM32 add-on for Simulink alongside STM32CubeMX to configure my board.
I am using SPI1 with the following pinout configuration:
On Simulink side, I am using SPI Controller Transfer blocks configured as follow:
With all those configuration, it should work but, when I plug in my scope here is what I observe:
In order to debug, I tried to plug the Arduino over the scope and here is what is observed:
For both captures, the signals are:
The first question that comes to my mind is: Why when the Arduino is plugged, the MOSI is always set to '1' except when transmitting data while STM32 is always set to '0' even when transmitting data? Do I need to pull up the MOSI? Why do I never receive data while the register address appears to be properly send (regardless of the register address)?
MOSI being '1' when not transmitting data might be a result of how the STM32 SPI is configured or potentially due to an issue with the configuration in Simulink. Ensure that the STM32 SPI configuration and Simulink settings for SPI communication are correct.
MOSI is set to '1' while not transmitting data only when I am using the Arduino setup (which is the properly working setup).
On Simulink-STM32 side, MOSI is set to '0' when not transmitting data and both data and register address are not transmitted to the "slave" board.