mirror of https://github.com/ARMmbed/mbed-os.git
STM32L1 : correct ST HAL API call
- RCC init: unused clock was enabled without any init parameters - RCC init: one PLL parameter was missing - ADC: a parameter setting was missing to init clock - GPIO: mode was not allowed by ST HAL API - ll_utils: compilation issuepull/3409/head
parent
12d2795871
commit
3ab5dce41d
|
@ -529,7 +529,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSE and HSI48 oscillators and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 8 MHz xtal on OSC_IN/OSC_OUT */
|
||||
|
@ -586,7 +586,7 @@ uint8_t SetSysClock_PLL_HSI(void)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
// SYSCLK = 32 MHz ((16 MHz * 4) / 2)
|
||||
|
|
|
@ -526,7 +526,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSE and HSI48 oscillators and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 8 MHz xtal on OSC_IN/OSC_OUT */
|
||||
|
@ -583,7 +583,7 @@ uint8_t SetSysClock_PLL_HSI(void)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
|
|
|
@ -97,10 +97,7 @@
|
|||
/** @addtogroup STM32L1xx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)16000000) /*!< Default value of the External oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSE_VALUE */
|
||||
#define HSE_VALUE ((uint32_t)16000000) /*!< NZ32-SC151 has a 16MHz External crystal */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)16000000) /*!< Default value of the Internal oscillator in Hz.
|
||||
|
@ -526,7 +523,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSE and HSI48 oscillators and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 16 MHz xtal on OSC_IN/OSC_OUT */
|
||||
|
@ -584,7 +581,7 @@ uint8_t SetSysClock_PLL_HSI(void)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
// SYSCLK = 32 MHz ((16 MHz * 4) / 2)
|
||||
|
|
|
@ -98,10 +98,7 @@
|
|||
/** @addtogroup STM32L1xx_System_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((uint32_t)24000000) /*!< Default value of the External oscillator in Hz.
|
||||
This value can be provided and adapted by the user application. */
|
||||
#endif /* HSE_VALUE */
|
||||
#define HSE_VALUE ((uint32_t)24000000) /*!< XDOT-L151CC has a 24MHz External crystal */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)16000000) /*!< Default value of the Internal oscillator in Hz.
|
||||
|
@ -527,7 +524,7 @@ uint8_t SetSysClock_PLL_HSE(uint8_t bypass)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSE and HSI48 oscillators and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
if (bypass == 0)
|
||||
{
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON; /* External 24 MHz xtal on OSC_IN/OSC_OUT */
|
||||
|
@ -585,7 +582,7 @@ uint8_t SetSysClock_PLL_HSI(void)
|
|||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/* Enable HSI oscillator and activate PLL with HSI as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_OFF;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
// SYSCLK = 32 MHz ((16 MHz * 4) / 2)
|
||||
|
|
|
@ -70,6 +70,7 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
AdcHandle.Instance = (ADC_TypeDef *)(obj->adc);
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
#include "stm32l1xx_ll_utils.h"
|
||||
#include "stm32l1xx_ll_system.h"
|
||||
#include "stm32l1xx_ll_pwr.h"
|
||||
#ifdef USE_FULL_ASSERT
|
||||
#include "stm32_assert.h"
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif
|
||||
|
||||
/** @addtogroup STM32L1xx_LL_Driver
|
||||
* @{
|
||||
|
|
|
@ -304,7 +304,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
|
|||
mode = STM_MODE_IT_FALLING;
|
||||
obj->event = EDGE_FALL;
|
||||
} else { // NONE or RISE
|
||||
mode = STM_MODE_IT_EVT_RESET;
|
||||
mode = STM_MODE_INPUT;
|
||||
obj->event = EDGE_NONE;
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
|
|||
mode = STM_MODE_IT_RISING;
|
||||
obj->event = EDGE_RISE;
|
||||
} else { // NONE or FALL
|
||||
mode = STM_MODE_IT_EVT_RESET;
|
||||
mode = STM_MODE_INPUT;
|
||||
obj->event = EDGE_NONE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue