AnsweredAssumed Answered

Error: "Can not find which APB timer TIM1" with Matlab/Simulink

Question asked by Juan Manuel Jacinto Villegas on May 2, 2018

I have the next error in the command window of Matlab 2018a"TIMERS_Config function : Can not find which APB timer TIM1 is connected to.Default preference value STM32TIMAPB set to APB1 is used."

 

Hello community! first, I know there is a similar question in the community but this one does not solve my problem or my question.

 

I'm testing the "Target Suport Package -STM32 Adpater toolbox" for Matlab 2018a (i'm using this toolbox because is general for any type of STM32 microcontroller, and avoid to install one toolbox for each type of board/microcontroller), and using STM32CUBEMX 4.25.0 with System Workbench for STM32 (eclipse).

 

So, I created two simple projects: one for testing the Discovery - STM32F407VGTx, using STMCUBE i created a project with one GPIO as input other as output and TIM4 as PWM generation CHI1/CH2/CH3. Then, I proceed to create the Simulink, Matlab model without having any problems with the TIM4 to be assigned to APB1 (I guess is the default clock configured in the "STM Timer block" for simulink) by the Timer block of the "Target Suport Package", because according to the datasheet (STM32F407VGTx) http://www.st.com/resource/en/datasheet/DM00037051.pdf  TIMER4 is assigned to APB1 clock. I also configured the APB1/2 clock frequencies in the STMCUBE project based on the datasheet of the microcontroller. Finally, I imported the c files generated and compiled by Matlab into the IDE System Workbench for STM32 to program the Discovery board. (See Files attached, To compile the program generated by Matlab (INC, SRC) you have to manually add the folder with the INC and SRC files of matlab into the Workbench project go to the tab: /project/properties/C/C++ General/Paths and Symbols/Source Location/Link Folder option). 

TIM4 Discovery working and compiled in WORKBENCH STM32

 

Then, in the second project I was trying to test the Nulceo board with the STM32F746ZGTx microcontroller, I also create a simple STMCUBE project using a GPIO as input and other as output, but this time the TIM1 as PWM generator. However, in this type of microcontroller TIM1 is assigned to APB2 according to the datasheet Cortex M7. I also set the proper clock configuration for APB1/2 in the STMCUBE project. Then I proceed to create the Simulink model, the GPIO block works fine without any problem, but when i tried to implement the "STM Timer block" i got the next error in the command window of Matlab.

"TIMERS_Config function : Can not find which APB timer TIM1 is connected to. Default preference value STM32TIMAPB set to APB1 is used."

 

To try to solve the issue, I have tried different frequencies configurations for APB1/2, I also check the ioc files using Notepad++ to see what is inside of the script and APB2 is assigned, but i could not find any solution still the same error in the command window.

Matlab error, Can not find which APB timer TIM1 is connected to

 

So, my question is How the "TIMER block" of Simulink automatically recognize the type of clock assigned (APB1/APB2) according to the CUBE configuration ioc file? 

Is there something missing in my ioc CUBE project that i need to set to assigned TIM1 to APB2 for the Cortex M7?

Is there a kind of button or check to select or enable APB2 for TIM1?

 

Find Attached the STMCUBE project for the Nucleo-STM32F746ZGT board and the Simulink project.

 

best

 

 

 

 

 

 

 

Outcomes