cancel
Showing results for 
Search instead for 
Did you mean: 

LED blinking using Simulink and STM32-MAT/TARGET

Sam Q.
Associate III
Posted on November 06, 2017 at 14:05

Hello all,

In my test project I want to use the STM32F4 Discovery Board (MCU: STM32F407VGTx) to realize the following simple functions with the help of Simulink and STM32-MAT/TARGET:

1) Making three user LEDs (PD12, PD13 and PD14 ) blink one by one, whereby each LED blinks 1 second.

2) Using the user button (PA0) to toggle LED PD15. 0690X00000608rgQAA.png

I made the following configurations for my project:

1) STM32CubeMX: I only changed the input mode of PA0 from GPIO_ETI0 to GPIO_Input. Other configurations stay as default.

2) Simulink: 

   a) Type of Solver: Fixed-step

   b) Solver: auto

   c) Fixed-step size(fundamental sample time): auto

3) Keil: Nothing changed

Simulink models *.slx in three different versions and the MCU configuration file *.ioc are availible in the attachment. You can check them for more details and use them to establish a new project again.

According to the simulation result below, the self-designed ''Counter'' counts up from 0 to 2 and then goes back to its initial value 0 at the end of the period. Therefor, three LEDs will be toggled one by one by using this counter.

0690X00000608qsQAA.png

However, after downloading the programm to the board, things are different from what they must be! These three LEDs are blinking too quickly as if they were always ON!

Is there anyone who can help me?

Thanks a lot!

#stm32-mat/target-matlab #simulink #led #cubemx
1 REPLY 1
Saunak_Bhalsod
Associate II

Could You Please Explain Steps for this project from beginning?