|
17 | 17 | */
|
18 | 18 |
|
19 | 19 | #include"pins_arduino.h"
|
| 20 | +#include"lock_resource.h" |
20 | 21 |
|
21 | 22 | #ifdef __cplusplus
|
22 | 23 | extern"C" {
|
@@ -99,9 +100,15 @@ WEAK void SystemClock_Config(void)
|
99 | 100 | RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
|
100 | 101 | RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
|
101 | 102 |
|
| 103 | +/* This prevents the CPU2 (M0+) to configure RCC*/ |
| 104 | +hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY); |
| 105 | + |
102 | 106 | __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
|
103 | 107 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
104 | 108 |
|
| 109 | +/* This prevents the CPU2 (M0+) to disable the HSI48 oscillator*/ |
| 110 | +hsem_lock(CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY); |
| 111 | + |
105 | 112 | /* Initializes the CPU, AHB and APB busses clocks*/
|
106 | 113 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48
|
107 | 114 | | RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
|
@@ -149,6 +156,7 @@ WEAK void SystemClock_Config(void)
|
149 | 156 | /* Select HSI as system clock source after Wake Up from Stop mode*/
|
150 | 157 | LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
|
151 | 158 |
|
| 159 | +hsem_unlock(CFG_HW_RCC_SEMID); |
152 | 160 | }
|
153 | 161 |
|
154 | 162 | #ifdef __cplusplus
|
|