2023-12-06 05:51 AM - last edited on 2023-12-11 02:11 AM by Mike_ST
Hello,
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:
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)?
Regards,
Mathieu
2023-12-06 05:59 AM
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.
2023-12-06 07:27 AM
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.
2024-09-13 04:28 AM
Hi @mhostyn
thank you for your exhaustive and well detailed post.
I think I am experiencing a similar issue with MAX31865, coupled to a STM32L051 though(but I guess the issue is more on the MAX device side)
Long story short, I am sending as per MAX datasheet address and data to configure the chip and later I am sending the read commands to 0x01 and to 0x02 to retrieve temperature conversion.
I never get anything meaningful back from MAX31865.
The best I could get by setting different clock polarity, pull up options, speed in my SPI driver was a MISO going low from MAX31865. So no answer from the Resistance to Digital converter!
Have you found your solution? Maybe you can share it here?
One thing that I noticed in your post, the write command for the configuration register should be 0x80 while 0x00 is for a read.
Thanks, bye
2024-09-18 11:59 PM
Hi _alaBaster,
Unfortunately we did not found a solution to this issue. We even thought at some point that we broke STM32's ADC.
As a last test we changed the Adafruit device and went from MAX31865 to MAX31855.
However, as we used an MBSE approach to implement the data reading, we had to decode the Adafruit data bit per bit according to its datasheet.
Regards,
2024-09-19 04:09 AM
Hi there,
okay, thank you for sharing.
In my opinion the issue is with timing between adjacent send with respect to /CS. I am working with LL libraries, where I need explicit control over such pin (/CS). It may be better with HAL driver for SPI.
I am onto that today, will keep you posted.
Regards
2024-09-20 02:38 AM
HI mhostyn
the problem that i see is with timing.
Clock generated with SPI transmit call and subsequent send of the word on MOSI line is not respecting the constraint tDC, data to SCLK setup, of 35 ns from MAX32865 datasheet. Not sure how to solve this now.
Regards