HAL - STM32F030 TIM attribute errors Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
thor.thau
Posts: 17
Joined: Thu Jul 07, 2016 12:37 pm
Has thanked: 2 times
Been thanked: 7 times

HAL - STM32F030 TIM attribute errors

Post by thor.thau »

I am implementing some PWM outputs on a STM32F030x8 microcontroller. I noticed some errors in channel count for TIM16 and TIM17 but ended up updating everything in the "TIM attributes" section for STM32F030x6, STM32F030x8 and STM32F030xC.

ChibiOS: 16.1.5
SVN: branches/stable_16.1.x@9852

Code: Select all

diff --git a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
index bf7a271..663221c 100644
--- a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
@@ -1306,30 +1306,45 @@
 #define STM32_TIM3_IS_32BITS                FALSE
 #define STM32_TIM3_CHANNELS                 4
 
+#if defined(STM32F030x8) || defined(STM32F030xC)
 #define STM32_HAS_TIM6                      TRUE
+#else
+#define STM32_HAS_TIM6                      FALSE
+#endif
 #define STM32_TIM6_IS_32BITS                FALSE
 #define STM32_TIM6_CHANNELS                 0
 
+#if defined(STM32F030xC)
+#define STM32_HAS_TIM7                      TRUE
+else
+#define STM32_HAS_TIM7                      FALSE
+#endif
+#define STM32_TIM7_IS_32BITS                FALSE
+#define STM32_TIM7_CHANNELS                 0
+
 #define STM32_HAS_TIM14                     TRUE
 #define STM32_TIM14_IS_32BITS               FALSE
 #define STM32_TIM14_CHANNELS                1
 
+#if defined(STM32F030x8) || defined(STM32F030xC)
 #define STM32_HAS_TIM15                     TRUE
+#else
+#define STM32_HAS_TIM15                     FALSE
+#endif
 #define STM32_TIM15_IS_32BITS               FALSE
 #define STM32_TIM15_CHANNELS                2
 
 #define STM32_HAS_TIM16                     TRUE
 #define STM32_TIM16_IS_32BITS               FALSE
-#define STM32_TIM16_CHANNELS                2
+#define STM32_TIM16_CHANNELS                1
 
 #define STM32_HAS_TIM17                     TRUE
 #define STM32_TIM17_IS_32BITS               FALSE
-#define STM32_TIM17_CHANNELS                2
+#define STM32_TIM17_CHANNELS                1
 
 #define STM32_HAS_TIM2                      FALSE
 #define STM32_HAS_TIM4                      FALSE
 #define STM32_HAS_TIM5                      FALSE
-#define STM32_HAS_TIM7                      FALSE
 #define STM32_HAS_TIM8                      FALSE
 #define STM32_HAS_TIM9                      FALSE
 #define STM32_HAS_TIM10                     FALSE


stm32_registry.patch.zip
(528 Bytes) Downloaded 445 times
thor.thau
Posts: 17
Joined: Thu Jul 07, 2016 12:37 pm
Has thanked: 2 times
Been thanked: 7 times

Re: HAL - STM32F030 TIM attribute errors

Post by thor.thau »

For easy verification of the changes check the datasheet in section 2 table 2 or section 3.11 table 5.

STM32F030x4/6/8/C datasheet
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: HAL - STM32F030 TIM attribute errors

Post by Giovanni »

Hi,

Thanks, we are not ignoring this bug, it is just in queue :)

Giovanni
thor.thau
Posts: 17
Joined: Thu Jul 07, 2016 12:37 pm
Has thanked: 2 times
Been thanked: 7 times

Re: HAL - STM32F030 TIM attribute errors

Post by thor.thau »

I do not think you are ignoring this bug. Maybe given it a very low priority because my guess is that it doesn't affect any drivers in the current HAL.

I see it as an error on my part not including what documentation I based my changes on in the initial bug report.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: HAL - STM32F030 TIM attribute errors

Post by Giovanni »

Hi,

Change committed in trunk, thanks.

Giovanni
thor.thau
Posts: 17
Joined: Thu Jul 07, 2016 12:37 pm
Has thanked: 2 times
Been thanked: 7 times

Re: HAL - STM32F030 TIM attribute errors

Post by thor.thau »

You forgot a part of the change. Selecting MCU type STM32F030xC will fail because STM32_HAS_TIM7 is then redefined.

ChibiOS: 16.1.6
SVN: branches/stable_16.1.x@10005

Code: Select all

diff --git a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
index 1c9688664..d75faee03 100644
--- a/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32F0xx/stm32_registry.h
@@ -247,7 +247,6 @@
 #define STM32_HAS_TIM2                      FALSE
 #define STM32_HAS_TIM4                      FALSE
 #define STM32_HAS_TIM5                      FALSE
-#define STM32_HAS_TIM7                      FALSE
 #define STM32_HAS_TIM8                      FALSE
 #define STM32_HAS_TIM9                      FALSE
 #define STM32_HAS_TIM10                     FALSE
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: HAL - STM32F030 TIM attribute errors

Post by RoccoMarco »

Fixed as bug #809
Post Reply