Skip to main content
antonio rueda
Associate II
February 4, 2018
Question

STM32-MAT-TARGET Can not find which APB timer TIM1 is connected to.

  • February 4, 2018
  • 4 replies
  • 5770 views

Posted on February 04, 2018 at 11:08

Hi, I've been following the manual STM32-MAT/TARGET Hands On Rev 2.2 (see attached) and I am not able to get the timer 1 working (everything is working except this). I did everything like in the manual but when I load the .ioc file into simulink I get the next error:

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

I am using the STM32F767ZI nucleo.

Anybody knows how to solve this issue? Am I missing something?

Thanks in advance!

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
February 4, 2018
Posted on February 04, 2018 at 15:12

The Reference Manual is an authoritative source for such information.

The Data Sheet also has a diagram, Figure 2 Page 19

http://www.st.com/content/ccc/resource/technical/document/datasheet/group3/c5/37/9c/1d/a6/09/4e/1a/DM00273119/files/DM00273119.pdf/jcr:content/translations/en.DM00273119.pdf

 

APB2 (the faster bus)

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
antonio rueda
Associate II
February 4, 2018
Posted on February 04, 2018 at 17:04

Thanks for the quick response. Now I am able to use the tim1 but only if I configure it from the STMCubeMX tool. If I change the configuration using the STM Simulink blocks, the generated code doesn't match the Simulink configuration.

I need to output a PWM signal with a variable duty cycle, but since the code generation from Simulink is not properly working, how can I configure that externally and after that use Simulink to change the duty cycle? Any ideas or any examples? 

Thanks in advance.

Tesla DeLorean
Guru
February 4, 2018
Posted on February 04, 2018 at 17:34

The pulse width on channel one can be modulated via TIM1->CCR1

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
henry.dick
Associate II
February 4, 2018
Posted on February 04, 2018 at 18:01

'

I am using the STM32F767ZI nucleo.'

the right way is to look up the RCC section of the datasheet and find out where TIMEN bit is.

the quick way is to search TIM1EN in the device header file.

antonio rueda
Associate II
February 4, 2018
Posted on February 04, 2018 at 18:10

Isn't Simulink supposed to configure this? 

Tesla DeLorean
Guru
February 4, 2018
Posted on February 04, 2018 at 18:24

One might hope automated tools will handle all the details, but I wouldn't rely on it.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Sebastian K.
Associate III
February 5, 2018
Posted on February 05, 2018 at 22:05

Hello,

I also played around with the STM32 MAT Target in Simulink, and in my humble opinion it is hopelessly buggy and non-functional. I could not get even simple examples to work (that was about a year ago already though).

What I would recommend is keep the non-microcontroller-specific code in Simulink with a well-defined input and output interface, and generate C code from it with the generic Embedded Target in Simulink that you call as a function in your C project generated with CubeMX or whatever. That way you can manage all your peripheral settings in CubeMX or directly in C, which usually works pretty well.

Let me know if you want more detailed explanations.

antonio rueda
Associate II
February 6, 2018
Posted on February 06, 2018 at 15:38

Hello, 

Thanks for the info, I found a couple of bugs but I've managed to run some basic examples with the timers. I am really interested in using the generic Embedded Target for Simulink since STM MAT Target is just giving me headaches. I've been looking for some examples to use CubeMX+Embedded Target but I can't find anything. I have some manuals from mathworks but they are only useful to configure Simulink and to generate the code.

Do you know where I can find tutorials or examples to configure the I/O interface?

Thanks in advance!

Sebastian K.
Associate III
February 6, 2018
Posted on February 06, 2018 at 21:29

To generate the code for the peripherals I can only recommend to start with CubeMX, add the peripherals you need and generate a project for the toolchain of your choice. Some very basic code examples can also be found in the firmware package that CubeMX installs for your processor, but I would not try to compile those as-is, only use them as inspiration. If you need more details on a certain peripheral or function, look at the Reference Manual for the F767. With a decent IDE you can also easily trace through the code to learn what the libraries actually do.

When I generate the code from Simulink I basically just copy the *.c and *.h files over into the source directory created by CubeMX, and call the _initialize() and _step() functions created by Simulink from the C code. Apart from that you can treat the Simulink code pretty much like a black box.