Page 1 of 1

HAL - STM32F030 TIM attribute errors

Posted: Fri Oct 07, 2016 2:15 pm
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 446 times

Re: HAL - STM32F030 TIM attribute errors

Posted: Fri Oct 14, 2016 11:26 am
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

Re: HAL - STM32F030 TIM attribute errors

Posted: Fri Oct 14, 2016 12:09 pm
by Giovanni
Hi,

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

Giovanni

Re: HAL - STM32F030 TIM attribute errors

Posted: Fri Oct 14, 2016 12:42 pm
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.

Re: HAL - STM32F030 TIM attribute errors

Posted: Mon Oct 17, 2016 10:56 am
by Giovanni
Hi,

Change committed in trunk, thanks.

Giovanni

Re: HAL - STM32F030 TIM attribute errors

Posted: Wed Jan 04, 2017 4:56 pm
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

Re: HAL - STM32F030 TIM attribute errors

Posted: Wed Jan 04, 2017 5:05 pm
by RoccoMarco
Fixed as bug #809