Simulink STM32 package to write code for my STM32 F411 Discovery Board but SPI is not working

27 views (last 30 days)
I am trying to use embedded coder to to read data off of the gyroscope SPI peripheral on my stm32 f411 discovery board. I have tried many things but I am not able to get the data when I try to read it. I have attached pictures of the block diagrams and am unsure what I need to do to fix the issue. The first picture is configuring the gyroscope, the following ones are trying to read the data from the registers on the gyroscope. Any help would be appreciated. Thanks!

Answers (1)

Naga
Naga on 26 Nov 2024 at 10:22
Hi Dylan,
It sounds like you're facing an issue with the SPI communication on your STM32 F411 Discovery Board. Here are some steps and considerations that might help you troubleshoot and resolve the problem:
  1. If you are using a MATLAB version earlier than R2024a, note that SPI Transmit, SPI Recieve, SPI controller transmit blocks are not supported. Supporyt for these blocks is added in R2024a. Refer to this Releases Notes for more info:https://in.mathworks.com/help/ecoder/release-notes.html
  2. To ensure your setup is correct, follow the official documentation or tutorials provided by MathWorks. A good starting point is the "Make LED Blink at Single Rate" example, which verifies that your basic hardware setup and Simulink communication are functioning correctly. You can find this example here: https://in.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/Getting-started-stm32cubemx.html
  3. SPI Configuration:
  • Clock Settings: Ensure that the SPI clock settings (polarity, phase, and speed) match those required by your gyroscope.
  • Pin Configuration: Double-check that the correct pins are configured for SPI communication on your STM32 board.
  • Mode Settings: Verify that both the master (STM32) and the slave (gyroscope) are set to the same SPI mode.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!