PIL question: having problem connecting to STM32 board

20 views (last 30 days)
Hi folks,
I'm currently following this link to do code verification with PIL. Instead of running PIL block on QEMU, I wanted to run PIL part on my STM32 Nucleo board. By following the instructions in Task1, I can deploy the subsystem to hardware but every time I tried to run the model with my PIL block, I got the same problem: "Error:The STM32 board is not detected. Please check that the board is connected. If the board is connected, please install drivers for the board"
The quirky part is after clicking deploy subsystem to hardware, it does generate a PIL block for me but I don't think it flush any .elf or .hex files to the STM32 board, as I noticed my MCU was still running my previous programs instead of this new generated executable.
What I've done:
  • Checked serial com port is not used by other programs.
  • Checked board is connected and driver is installed.
Any advice is much appreciated!

Answers (1)

Saurav Shandilya
Saurav Shandilya on 22 Jul 2025
Edited: Saurav Shandilya on 22 Jul 2025
Hi @YE
Most likely the board detection issue will be due to due to ST-Link version on board. You may need to update ST-Link firmware on board and try. You can follow below steps:
  1. Check if port is not opened in any other application STM32CubeIDE or STM32 Cube programmer.
  2. Check version of Cube programmer. For R2024b, supported version of STM32CubeProgrammer is 2.6.0. Please install the version, connect the board and upgrade the firmware on board.
Once firmware upgrade is done, you can verify if device is detected in Simulink by opening Model Settings -> Hardware Implementation.
  1. Select desired "Hardware board" (Example: STM32F4xx Based)
  2. Expand Target hardware resources -> Build options
  3. Select "STM32CubeMX project file" (should be for same desired Hardware board)
  4. Ensure Hardware board is connected to PC
  5. Untick "Auto detect board to download and run"
  6. Device list dropdown should list the connected board.

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!