Skip to content

Commit db9dcb8

Browse files
committed
STM32F7 : correct ST HAL API call
- RCC init: unused clock was enabled without any init parameters - RCC init: one PLL parameter was missing - GPIO: mode was not allowed by ST HAL API
1 parent 9dc5cd1 commit db9dcb8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

targets/TARGET_STM/TARGET_STM32F7/TARGET_DISCO_F746NG/device/system_stm32f7xx.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@
8383

8484
HAL_StatusTypeDef HAL_Init(void);
8585

86-
#if !defined (HSE_VALUE)
87-
#define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
88-
#endif /* HSE_VALUE */
86+
#define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
8987

9088
#if !defined (HSI_VALUE)
9189
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
@@ -801,7 +799,7 @@ uint8_t SetSysClock_PLL_HSI(void)
801799
__PWR_CLK_ENABLE();
802800

803801
// Enable HSI oscillator and activate PLL with HSI as source
804-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
802+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
805803
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
806804
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
807805
RCC_OscInitStruct.HSICalibrationValue = 16;

targets/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/device/system_stm32f7xx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
757757
RCC_OscInitStruct.PLL.PLLN = 432; // VCO output clock = 432 MHz (1 MHz * 432)
758758
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; // PLLCLK = 216 MHz (432 MHz / 2)
759759
RCC_OscInitStruct.PLL.PLLQ = 9; // USB clock = 48 MHz (432 MHz / 9) --> OK for USB
760+
RCC_OscInitStruct.PLL.PLLR = 2; // I2S clock
760761

761762
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
762763
{
@@ -801,7 +802,7 @@ uint8_t SetSysClock_PLL_HSI(void)
801802
__PWR_CLK_ENABLE();
802803

803804
// Enable HSI oscillator and activate PLL with HSI as source
804-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
805+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
805806
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
806807
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
807808
RCC_OscInitStruct.HSICalibrationValue = 16;
@@ -811,6 +812,7 @@ uint8_t SetSysClock_PLL_HSI(void)
811812
RCC_OscInitStruct.PLL.PLLN = 432; // VCO output clock = 432 MHz (1 MHz * 432)
812813
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; // PLLCLK = 216 MHz (432 MHz / 2)
813814
RCC_OscInitStruct.PLL.PLLQ = 9; // USB clock = 48 MHz (432 MHz / 9) --> OK for USB
815+
RCC_OscInitStruct.PLL.PLLR = 2; // I2S clock
814816

815817
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
816818
{

targets/TARGET_STM/TARGET_STM32F7/gpio_irq_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
304304
mode = STM_MODE_IT_FALLING;
305305
obj->event = EDGE_FALL;
306306
} else { // NONE or RISE
307-
mode = STM_MODE_IT_EVT_RESET;
307+
mode = STM_MODE_INPUT;
308308
obj->event = EDGE_NONE;
309309
}
310310
}
@@ -313,7 +313,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
313313
mode = STM_MODE_IT_RISING;
314314
obj->event = EDGE_RISE;
315315
} else { // NONE or FALL
316-
mode = STM_MODE_IT_EVT_RESET;
316+
mode = STM_MODE_INPUT;
317317
obj->event = EDGE_NONE;
318318
}
319319
}

0 commit comments

Comments
 (0)