[patch] add TIM12 and TIM14 support for STM32 TIMv1

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
tridge
Posts: 141
Joined: Mon Sep 25, 2017 8:27 am
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 20 times
Contact:

[patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby tridge » Sat Jun 09, 2018 2:28 am

The attached patch adds TIM12 and TIM14 support for STM32 TIMv1. TIM12 was tested on a STM32F765. TIM14 was tested on a STM32F427.
The patch is tested against stable_18.2.0. We also tested it against trunk, but on trunk we're getting some weird systick timing issues at the moment on a STM32F427, so we've backed off to 18.2.0 for testing.
Cheers, Tridge
Attachments
TIM12_TIM14_support.zip
(1.87 KiB) Downloaded 189 times

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby Giovanni » Sat Jun 09, 2018 6:31 am

Hi,

This has been proposed already several times, some timers are not supported because sharing of interrupts, it would fail, for example, if you enable TIM1 for PWM and a sharing timer for ICU, GPT or ST. There would be two conflicting ISR.

The correct way to handle this is to disable the ISR in the various drivers and add it to hal_isr.c under the platform directory, this way it would be shared. The mechanism are already in place but it has not yet implemented. The problem is that you have to do that for ALL platforms, not just in the driver.

Second problem, all mcuconf.h files in all demos and test applications have to be updated when introducing new configuration options, registry files have to be updated for all platforms and the thing has to work for all platforms.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby Giovanni » Sat Jun 09, 2018 6:43 am

Ah,

Just a note. I am added tools that re-align configuration files automatically, unfortunately it is not yet done for all kind of mcuconf.h files, probably it would be better to defer changes to configuration files to after the tool is available for all types.

Look under /chibios_trunk/tools/updater, I think it is interesting in itself.

The tool is not complex but it requires a new #define to be added to all files. When it is done, we need just to change the template (those .fmpp files) and the tool will re-align all instances to the new template.

Giovanni

tridge
Posts: 141
Joined: Mon Sep 25, 2017 8:27 am
Location: Canberra, Australia
Has thanked: 10 times
Been thanked: 20 times
Contact:

Re: [patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby tridge » Sat Jun 09, 2018 9:10 am

Giovanni wrote:The correct way to handle this is to disable the ISR in the various drivers and add it to hal_isr.c under the platform directory, this way it would be shared. The mechanism are already in place but it has not yet implemented. The problem is that you have to do that for ALL platforms, not just in the driver.

ahh, interesting!
So, now you have me worried that we may have an interrupt conflict on one of our boards without knowing it. We do use PWM, ICU, EICU and GPT. Which ones get used depends on both compile time and runtime options.
To check this I presume I need to know which vector each service is using, and check for conflicts. For example, TIM12 on all STM32F* boards where TIM12 exists is VectorEC, and that seems to be unique (ie. no other device uses that vector as far as I can see), so that one seems OK. TIM14_HANDLER is VectorF4 on everything except STM32F0, where it is Vector8C. That also seems unique.
It looks like these two are unique across all of STM32F*, is that correct? Or have I misunderstood the conflict?
When you say "all platforms", do you mean just STM32 for something like this, or do you mean other architectures?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby Giovanni » Sat Jun 09, 2018 10:13 am

By platform I mean the various STM32 variants, all those you see under /os/hal/ports/STM32. I need to make sure changes consider all of them because drivers are shared.

It happens continuously that I apply an apparently innocuous change and then something breaks somewhere else, see the recent bug introduced on F1 because UART differences for example.

STM32 HAL is an complex beast because all dependencies.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: [patch] add TIM12 and TIM14 support for STM32 TIMv1

Postby Giovanni » Sat Jan 05, 2019 1:08 pm

Hi,

See here: viewtopic.php?f=3&t=4956

Probably now it is possible.

Giovanni


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 11 guests