Showing results for 
Search instead for 
Did you mean: 

SPI communication between STM32H743ZI2 and Adafruit MAX31865 using Simulink encoder



I would like to read the temperature value from PT1000 (AT103), to ease the reading, I am using an Adafruit MAX31865 (configured as 2 wires RTD reader). 

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:

  • PB3 = SPI1_SCK
  • PB4 = SPI1_MISO
  • PB5 = SPI1_MOSI
  • D7 = CS 

On Simulink side, I am using SPI Controller Transfer blocks configured as follow: 

  • SPI module = SPI1
  • Clock Polarity = Low
  • Clock Phase = 1 Edge (as required by MAX31865 board) 
  • Register Address = 0x00 (to configure MAX board) and then 0x01 and 0x02 to read RTD data
  •  Data bits = 8
  • Chip select calling method = Explicit GPIO calls
  • Chip select polarity = Active Low 
  • Chip select port name = GPIOD
  • Chip select pin number = 7 

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: 

  • Yellow = SCK 
  • Blue = MOSI
  • Purple = MISO 

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)?  




Senior II

 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.