LED blinking using Simulink and STM32-MAT/TARGET not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-16 3:13 AM
I have installed STM32-MAT/TARGET , generated configuration with CubeMx, made simulink model, generated c code for keil, and compiled with out errors but the port is not toggling. I have been trying for last two weeks to get it work. I have attached cubemx file and simulink model with this message, kindly someone help me
Matlab2019a
STMcubeMx 5.3
I have tried with the simpleGPIO example supplied also, but that too didn't worked, is there any compatibility issue between the cubeMX and Matlab2019 version?
The examples supplied are made with earlier version of cubeMX and Matlab
Solved! Go to Solution.
- Labels:
-
STM32-MatTarget
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-24 7:35 AM
Hi @vlal​ ,
Your main.c is not correct, stm32xxxx_it.c is missing.
It seems as if STM32\script\customRoutineProcess.tlc is not the correct one.
This file was strongly changed with the 5.1.0 version of STM32-MAT/TARGET (to fit with STM32CubeMX V5.1.0 and later).
Regards.
Cyril
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-17 12:51 AM
Hi @vlal​
Thank you for giving feedback on our delivery of version 5.1.0 of July 2019.
We will analyze the problem and come back with a solution the next day.
Regards.
Cyril
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-17 2:08 AM
Hi @vlal​
In your use-case MATLAB 2019a and STM32CubeMX 5.3.0 are in use, and it is not a problem.
The PIN0 of GPIOA is selected to be toggled and corresponding code is generated correctly:
/* Model step function */
void untitled_step(void)
{
/* S-Function Block: <Root>/GPIO_Write */
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_0);
}
All the GPIOs are used in your STM32CubeMX project.
I simply modified the GPIO settings for pins used for debug (enabling SYS Debug with Trace Asynchronous Sw).
I checked that LED2 can be toggled by PA5 GPIO.
I selected this pin in the GPIO_Write block of the Simulink model, I adjusted solver step size to 0.5s, then regenerated and compiled the project.
The LED is now blinking at the rate of 0.5 time per second.
Hoping it clarified.
Regards
Cyril
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-17 10:14 AM
So its working in your set up, It may be a problem in my setup
By the way, I am using Proteus to simulate, I didn't ran on hardware yet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-18 12:36 PM
I accidently flashed a stm32f103C8 with hex file generated with CubeMX HAL libraries for stm32f103C6. Now target cannot be detected from the flashing software, Did the mcu got damaged, can I recover the mcu?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-19 1:03 AM
​Hi @vlal​
I'm not sure posting this last issue here is the right place.
The STM32 ST-LINK Utility (STSW-LINK004) can be found on the ST website and can help you.
You should be able to connect your target (knowing that your ST LINK subsystem is still operational).
Regards.
Cyril
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-19 8:23 AM
OK, now its flashing, it was due to wrong GPIO setting, I am working on it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-20 9:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-23 2:28 AM
​Hi @vlal​ ,
You changed board for your project.
I took a look at your C files.
In the current situation, this can not work, calls to step () can not be made because the interrupt is not implemented correctly (remains AutoReloadTimerLoopVal_S not incremented).
I generated my side and got:
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
{
extern volatile uint32_t remainAutoReloadTimerLoopVal_S;
/* Manage number of loop before interrupt has to be processed. */
if (remainAutoReloadTimerLoopVal_S) {
remainAutoReloadTimerLoopVal_S--;
}
}
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
May you cleanup your Matlab session (remove generated folders of Simulink build, cleanup also path to avoid side effects).
Regards.
Cyril
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-23 9:23 AM
