Skip to content

Commit a93ce82

Browse files
committed
Update variants\STM32L4xx\L496R(E-G)T_L4A6RGT\PeripheralPins_CBOT_L496.c
updated pinout to latest hardware revision enabled LSE as RTC clock enabled CSS for HSE and LSE clocks
1 parent 69d52af commit a93ce82

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

variants/STM32L4xx/L496R(E-G)T_L4A6RGT/variant_CBOT_L496.cpp

+18-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const PinName digitalPin[] = {
3636
PB_4, // SARA_RTS
3737
PB_5, // SARA_CTS
3838
PB_6, // Button_LED
39+
PB_9, // DONE (TPL5110 power timer)
40+
PC_1, // DETECT (AD5933 electrode)
41+
PC_9, // BAT_CHRG
42+
PA_8, // BAT_CON
3943
};
4044

4145
// Analog (Ax) pin number array
@@ -65,15 +69,19 @@ WEAK void SystemClock_Config(void)
6569
Error_Handler();
6670
}
6771

72+
/* Configure LSE Drive Capability */
73+
HAL_PWR_EnableBkUpAccess();
74+
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
75+
6876
/*
6977
* Initializes the RCC Oscillators according to the specified parameters
7078
* in the RCC_OscInitTypeDef structure.
7179
*/
72-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_LSI
73-
| RCC_OSCILLATORTYPE_HSE;
80+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE
81+
| RCC_OSCILLATORTYPE_LSE;
7482
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
83+
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
7584
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
76-
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
7785
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
7886
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
7987
RCC_OscInitStruct.PLL.PLLM = 1;
@@ -96,12 +104,18 @@ WEAK void SystemClock_Config(void)
96104
Error_Handler();
97105
}
98106

107+
/* Enables the Clock Security System */
108+
HAL_RCC_EnableCSS();
109+
110+
/* Enables the Clock Security System */
111+
HAL_RCCEx_EnableLSECSS();
112+
99113
/* Initializes the peripherals clock */
100114
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB | RCC_PERIPHCLK_SDMMC1
101115
| RCC_PERIPHCLK_RTC;
102116
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
103117
PeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_HSI48;
104-
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
118+
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
105119
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
106120
Error_Handler();
107121
}

variants/STM32L4xx/L496R(E-G)T_L4A6RGT/variant_CBOT_L496.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747

4848
#define PB6 20 // Button_LED
4949

50+
#define PB9 21 // DONE (TPL5110 power timer)
51+
#define PC1 22 // DETECT (AD5933 electrode)
52+
53+
#define PC9 23 // BAT_CH
54+
#define PA8 24 // BAT_CON
55+
5056
// Alternate pins number
5157
#define PA0_ALT1 (PA0 | ALT1)
5258
#define PA1_ALT1 (PA1 | ALT1)
@@ -97,7 +103,7 @@
97103
#define PC10_ALT1 (PC10 | ALT1)
98104
#define PC11_ALT1 (PC11 | ALT1)
99105

100-
#define NUM_DIGITAL_PINS 21
106+
#define NUM_DIGITAL_PINS 25
101107
#define NUM_ANALOG_INPUTS 0
102108

103109
// On-board LED pin number
@@ -157,6 +163,7 @@
157163

158164
// Value of the External oscillator in Hz
159165
#define HSE_VALUE 8000000U
166+
#define LSE_VALUE 32768U
160167

161168
// Extra HAL modules
162169

0 commit comments

Comments
 (0)