Skip to content

Commit f662e9e

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 disabled CSS for LSE clock
1 parent 640171c commit f662e9e

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

variants/STM32L4xx/L496R(E-G)T_L4A6RGT/PeripheralPins_CBOT_L496.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ WEAK const PinMap PinMap_SPI_MISO[] = {
289289
WEAK const PinMap PinMap_SPI_SCLK[] = {
290290
// {PA_1, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
291291
// {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
292-
{PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_SPI2)},
292+
// {PA_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_SPI2)},
293293
// {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
294294
// {PB_3_ALT1, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
295295
// {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
296-
// {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
296+
{PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
297297
// {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
298298
{NC, NP, 0}
299299
};
@@ -392,7 +392,7 @@ WEAK const PinMap PinMap_QUADSPI_SSEL[] = {
392392
#if defined(HAL_PCD_MODULE_ENABLED) || defined(HAL_HCD_MODULE_ENABLED)
393393
WEAK const PinMap PinMap_USB_OTG_FS[] = {
394394
// {PA_8, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_SOF
395-
// {PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
395+
{PA_9, USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
396396
// {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_ID
397397
{PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
398398
{PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DP

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

+9-10
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ const PinName digitalPin[] = {
2020
PB_10, // SCL
2121
PB_11, // SDA
2222
PB_12, // SD_CS
23+
PB_13, // SCK
2324
PB_14, // MISO
2425
PB_15, // MOSI
25-
PA_9, // SCK
26+
PA_9, // USB_VBUS
2627
PA_11, // USB_DM
2728
PA_12, // USB_DP
2829
PA_13, // SWDIO
@@ -36,6 +37,7 @@ const PinName digitalPin[] = {
3637
PB_4, // SARA_RTS
3738
PB_5, // SARA_CTS
3839
PB_6, // Button_LED
40+
PA_10, // LED
3941
PB_9, // DONE (TPL5110 power timer)
4042
PC_1, // DETECT (AD5933 electrode)
4143
PC_9, // BAT_CHRG
@@ -64,23 +66,23 @@ WEAK void SystemClock_Config(void)
6466
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
6567
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
6668

67-
/* Configure the main internal regulator output voltage */
69+
/* Configure the main internal regulator output voltage */
6870
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2) != HAL_OK) {
6971
Error_Handler();
7072
}
7173

7274
/* Configure LSE Drive Capability */
7375
HAL_PWR_EnableBkUpAccess();
74-
// __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMHIGH);
76+
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
7577

7678
/*
7779
* Initializes the RCC Oscillators according to the specified parameters
7880
* in the RCC_OscInitTypeDef structure.
7981
*/
80-
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_LSI
81-
| RCC_OSCILLATORTYPE_HSE;
82+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSE
83+
| RCC_OSCILLATORTYPE_LSE;
8284
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
83-
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
85+
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
8486
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
8587
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
8688
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
@@ -107,15 +109,12 @@ WEAK void SystemClock_Config(void)
107109
/* Enables the Clock Security System */
108110
HAL_RCC_EnableCSS();
109111

110-
/* Enables the Clock Security System */
111-
// HAL_RCCEx_EnableLSECSS();
112-
113112
/* Initializes the peripherals clock */
114113
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB | RCC_PERIPHCLK_SDMMC1
115114
| RCC_PERIPHCLK_RTC;
116115
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
117116
PeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_HSI48;
118-
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
117+
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
119118
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
120119
Error_Handler();
121120
}

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

+27-24
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/*----------------------------------------------------------------------------
1616
* STM32 pins number
1717
*----------------------------------------------------------------------------*/
18+
1819
#define PA2 0 // GNSS_EN
1920

2021
#define PB1 1 // SD_DET
@@ -23,35 +24,37 @@
2324
#define PB11 3 // SDA
2425

2526
#define PB12 4 // SD_CS
26-
#define PB14 5 // MISO
27-
#define PB15 6 // MOSI
28-
#define PA9 7 // SCK
27+
#define PB13 5 // SCK
28+
#define PB14 6 // MISO
29+
#define PB15 7 // MOSI
2930

30-
#define PA11 8 // USB_DM
31-
#define PA12 9 // USB_DP
31+
#define PA9 8 // USB_VBUS
32+
#define PA11 9 // USB_DM
33+
#define PA12 10 // USB_DP
3234

33-
#define PA13 10 // SWDIO
34-
#define PA14 11 // SWCLK
35+
#define PA13 11 // SWDIO
36+
#define PA14 12 // SWCLK
3537

36-
#define PA15 12 // AVCC_EN
38+
#define PA15 13 // AVCC_EN
3739

38-
#define PC10 13 // SARA_RESET
39-
#define PC11 14 // SARA_ON
40-
#define PC12 15 // SARA_TXD
41-
#define PD2 16 // SARA_RXD
40+
#define PC10 14 // SARA_RESET
41+
#define PC11 15 // SARA_ON
42+
#define PC12 16 // SARA_TXD
43+
#define PD2 17 // SARA_RXD
4244

43-
#define PB3 17 // SWO
45+
#define PB3 18 // SWO
4446

45-
#define PB4 18 // SARA_RTS
46-
#define PB5 19 // SARA_CTS
47+
#define PB4 19 // SARA_RTS
48+
#define PB5 20 // SARA_CTS
4749

48-
#define PB6 20 // Button_LED
50+
#define PB6 21 // Button_LED
51+
#define PA10 22 // LED
4952

50-
#define PB9 21 // DONE (TPL5110 power timer)
51-
#define PC1 22 // DETECT (AD5933 electrode)
53+
#define PB9 23 // DONE (TPL5110 power timer)
54+
#define PC1 24 // DETECT (AD5933 electrode)
5255

53-
#define PC9 23 // BAT_CH
54-
#define PA8 24 // BAT_CON
56+
#define PC9 25 // BAT_CH
57+
#define PA8 26 // BAT_CON
5558

5659
// Alternate pins number
5760
#define PA0_ALT1 (PA0 | ALT1)
@@ -103,12 +106,12 @@
103106
#define PC10_ALT1 (PC10 | ALT1)
104107
#define PC11_ALT1 (PC11 | ALT1)
105108

106-
#define NUM_DIGITAL_PINS 25
109+
#define NUM_DIGITAL_PINS 27
107110
#define NUM_ANALOG_INPUTS 0
108111

109112
// On-board LED pin number
110113
#ifndef LED_BUILTIN
111-
#define LED_BUILTIN PNUM_NOT_DEFINED
114+
#define LED_BUILTIN PA10
112115
#endif
113116

114117
// On-board user button
@@ -127,7 +130,7 @@
127130
#define PIN_SPI_MISO PB14
128131
#endif
129132
#ifndef PIN_SPI_SCK
130-
#define PIN_SPI_SCK PA9
133+
#define PIN_SPI_SCK PB13
131134
#endif
132135

133136
// I2C definitions
@@ -166,7 +169,7 @@
166169
#define LSE_VALUE 32768U
167170

168171
// Extra HAL modules
169-
172+
// #define USBD_VBUS_DETECTION_ENABLE
170173
/*----------------------------------------------------------------------------
171174
* Arduino objects - C++ only
172175
*----------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)