File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1717*/ 
1818
1919#include  " pins_arduino.h" 
20+ #include  " lock_resource.h" 
2021
2122#ifdef  __cplusplus
2223extern  " C" 
@@ -99,9 +100,15 @@ WEAK void SystemClock_Config(void)
99100  RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
100101  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
101102
103+   /*  This prevents the CPU2 (M0+) to configure RCC */ 
104+   hsem_lock (CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
105+ 
102106  __HAL_RCC_LSEDRIVE_CONFIG (RCC_LSEDRIVE_LOW);
103107  __HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
104108
109+   /*  This prevents the CPU2 (M0+) to disable the HSI48 oscillator */ 
110+   hsem_lock (CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY);
111+ 
105112  /*  Initializes the CPU, AHB and APB busses clocks */ 
106113  RCC_OscInitStruct.OscillatorType  = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48
107114                                     | RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
@@ -149,6 +156,7 @@ WEAK void SystemClock_Config(void)
149156  /*  Select HSI as system clock source after Wake Up from Stop mode */ 
150157  LL_RCC_SetClkAfterWakeFromStop (LL_RCC_STOP_WAKEUPCLOCK_HSI);
151158
159+   hsem_unlock (CFG_HW_RCC_SEMID);
152160}
153161
154162#ifdef  __cplusplus
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments