From 30ed1b741767e4f67152b2efd5737fb7e20517c5 Mon Sep 17 00:00:00 2001 From: gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> Date: Sun, 11 Aug 2013 09:35:15 +0000 Subject: Fixed bug bug #425. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6131 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/TIMv1/gpt_lld.c | 15 ++++++++------- os/hal/platforms/STM32/TIMv1/gpt_lld.h | 2 ++ os/hal/platforms/STM32F0xx/platform.mk | 7 ++++--- os/hal/platforms/STM32F1xx/platform.mk | 7 ++++--- os/hal/platforms/STM32F30x/platform.mk | 7 ++++--- os/hal/platforms/STM32F37x/platform.mk | 7 ++++--- os/hal/platforms/STM32F4xx/platform.mk | 7 ++++--- os/hal/platforms/STM32L1xx/platform.mk | 7 ++++--- readme.txt | 2 ++ 9 files changed, 36 insertions(+), 25 deletions(-) diff --git a/os/hal/platforms/STM32/TIMv1/gpt_lld.c b/os/hal/platforms/STM32/TIMv1/gpt_lld.c index 35268fbe5..4d669be18 100644 --- a/os/hal/platforms/STM32/TIMv1/gpt_lld.c +++ b/os/hal/platforms/STM32/TIMv1/gpt_lld.c @@ -607,7 +607,7 @@ void gpt_lld_start(GPTDriver *gptp) { /* Timer configuration.*/ gptp->tim->CR1 = 0; /* Initially stopped. */ - gptp->tim->CR2 = TIM_CR2_CCDS; /* DMA on UE (if any). */ + gptp->tim->CR2 = STM32_TIM_CR2_CCDS; /* DMA on UE (if any). */ gptp->tim->PSC = psc; /* Prescaler value. */ gptp->tim->DIER = 0; } @@ -712,14 +712,15 @@ void gpt_lld_stop(GPTDriver *gptp) { void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) { gptp->tim->ARR = interval - 1; /* Time constant. */ - gptp->tim->EGR = TIM_EGR_UG; /* Update event. */ + gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */ gptp->tim->CNT = 0; /* Reset counter. */ + /* NOTE: After generating the UG event it takes several clock cycles before SR bit 0 goes to 1. This is because the clearing of CNT has been inserted before the clearing of SR, to give it some time.*/ gptp->tim->SR = 0; /* Clear pending IRQs (if any). */ - gptp->tim->DIER = TIM_DIER_UIE; /* Update Event IRQ enabled. */ - gptp->tim->CR1 = TIM_CR1_URS | TIM_CR1_CEN; + gptp->tim->DIER = STM32_TIM_DIER_UIE; /* Update Event IRQ enabled. */ + gptp->tim->CR1 = STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN; } /** @@ -750,10 +751,10 @@ void gpt_lld_stop_timer(GPTDriver *gptp) { void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) { gptp->tim->ARR = interval - 1; /* Time constant. */ - gptp->tim->EGR = TIM_EGR_UG; /* Update event. */ + gptp->tim->EGR = STM32_TIM_EGR_UG; /* Update event. */ gptp->tim->SR = 0; /* Clear pending IRQs (if any). */ - gptp->tim->CR1 = TIM_CR1_OPM | TIM_CR1_URS | TIM_CR1_CEN; - while (!(gptp->tim->SR & TIM_SR_UIF)) + gptp->tim->CR1 = STM32_TIM_CR1_OPM | STM32_TIM_CR1_URS | STM32_TIM_CR1_CEN; + while (!(gptp->tim->SR & STM32_TIM_SR_UIF)) ; } diff --git a/os/hal/platforms/STM32/TIMv1/gpt_lld.h b/os/hal/platforms/STM32/TIMv1/gpt_lld.h index ecb1dcb35..0c63a6489 100644 --- a/os/hal/platforms/STM32/TIMv1/gpt_lld.h +++ b/os/hal/platforms/STM32/TIMv1/gpt_lld.h @@ -25,6 +25,8 @@ #ifndef _GPT_LLD_H_ #define _GPT_LLD_H_ +#include "stm32_tim.h" + #if HAL_USE_GPT || defined(__DOXYGEN__) /*===========================================================================*/ diff --git a/os/hal/platforms/STM32F0xx/platform.mk b/os/hal/platforms/STM32F0xx/platform.mk index c04d85c76..8e49a2e86 100644 --- a/os/hal/platforms/STM32F0xx/platform.mk +++ b/os/hal/platforms/STM32F0xx/platform.mk @@ -4,12 +4,12 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F0xx/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32F0xx/adc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32F0xx/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/uart_lld.c @@ -19,4 +19,5 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F0xx \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2 \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2 diff --git a/os/hal/platforms/STM32F1xx/platform.mk b/os/hal/platforms/STM32F1xx/platform.mk index a1959cf34..3940dedbe 100644 --- a/os/hal/platforms/STM32F1xx/platform.mk +++ b/os/hal/platforms/STM32F1xx/platform.mk @@ -5,15 +5,15 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F1xx/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32F1xx/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/can_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/mac_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/sdc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv1/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv1/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv1/rtc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/uart_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -25,6 +25,7 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F1xx \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv1 \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv1 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1 diff --git a/os/hal/platforms/STM32F30x/platform.mk b/os/hal/platforms/STM32F30x/platform.mk index ce219fa15..ef55085b8 100644 --- a/os/hal/platforms/STM32F30x/platform.mk +++ b/os/hal/platforms/STM32F30x/platform.mk @@ -5,13 +5,13 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F30x/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32F30x/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/can_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2/rtc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/uart_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -23,5 +23,6 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F30x \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2 \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2 \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1 diff --git a/os/hal/platforms/STM32F37x/platform.mk b/os/hal/platforms/STM32F37x/platform.mk index 47cc548aa..8fd96632c 100644 --- a/os/hal/platforms/STM32F37x/platform.mk +++ b/os/hal/platforms/STM32F37x/platform.mk @@ -5,13 +5,13 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F37x/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32F37x/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/can_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2/rtc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2/uart_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -23,5 +23,6 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F37x \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv2 \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv2 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv2 \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1 diff --git a/os/hal/platforms/STM32F4xx/platform.mk b/os/hal/platforms/STM32F4xx/platform.mk index 813630b87..99c3263a7 100644 --- a/os/hal/platforms/STM32F4xx/platform.mk +++ b/os/hal/platforms/STM32F4xx/platform.mk @@ -5,16 +5,16 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32F4xx/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32F4xx/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/can_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/mac_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/sdc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv1/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/OTGv1/usb_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2/rtc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/uart_lld.c @@ -26,4 +26,5 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32F4xx \ ${CHIBIOS}/os/hal/platforms/STM32/OTGv1 \ ${CHIBIOS}/os/hal/platforms/STM32/RTCv2 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1 diff --git a/os/hal/platforms/STM32L1xx/platform.mk b/os/hal/platforms/STM32L1xx/platform.mk index dfb4b7c35..4678792a5 100644 --- a/os/hal/platforms/STM32L1xx/platform.mk +++ b/os/hal/platforms/STM32L1xx/platform.mk @@ -4,12 +4,12 @@ PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/STM32L1xx/stm32_dma.c \ ${CHIBIOS}/os/hal/platforms/STM32L1xx/adc_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32L1xx/ext_lld_isr.c \ ${CHIBIOS}/os/hal/platforms/STM32/ext_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/gpt_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/icu_lld.c \ - ${CHIBIOS}/os/hal/platforms/STM32/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2/pal_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv1/i2c_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1/spi_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/gpt_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/icu_lld.c \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1/pwm_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/serial_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1/uart_lld.c \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1/usb_lld.c @@ -20,5 +20,6 @@ PLATFORMINC = ${CHIBIOS}/os/hal/platforms/STM32L1xx \ ${CHIBIOS}/os/hal/platforms/STM32/GPIOv2 \ ${CHIBIOS}/os/hal/platforms/STM32/I2Cv1 \ ${CHIBIOS}/os/hal/platforms/STM32/SPIv1 \ + ${CHIBIOS}/os/hal/platforms/STM32/TIMv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USARTv1 \ ${CHIBIOS}/os/hal/platforms/STM32/USBv1 diff --git a/readme.txt b/readme.txt index 71fc1cbe5..a5d35f765 100644 --- a/readme.txt +++ b/readme.txt @@ -91,6 +91,8 @@ *** 2.7.0 *** - FIX: Fixed UART4 and 5 marked as not present in STM32F30x devices (bug #426) (backported to 2.6.1). +- FIX: Fixed warning in STM32 ICU/PWM drivers when used on STM32F3xx + (bug #425)(backported to 2.6.1). - FIX: Fixed conditional code error in STM32 PWM driver (bug #424)(backported to 2.6.1). - FIX: Fixed error in Guards of pwm_lld.h from STM32 (bug #423)(backported to -- cgit v1.2.3