Ignore:
Timestamp:
Dec 2, 2024, 10:55:02 AM (8 weeks ago)
Author:
Zed
Message:

RTC module was activated.

Location:
ctrl/firmware/Main/CubeMX
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified ctrl/firmware/Main/CubeMX/Core/Inc/stm32h7xx_hal_conf.h

    r13 r39  
    6868/* #define HAL_RAMECC_MODULE_ENABLED   */
    6969/* #define HAL_RNG_MODULE_ENABLED   */
    70 /* #define HAL_RTC_MODULE_ENABLED   */
     70#define HAL_RTC_MODULE_ENABLED
    7171/* #define HAL_SAI_MODULE_ENABLED   */
    7272/* #define HAL_SD_MODULE_ENABLED   */
  • TabularUnified ctrl/firmware/Main/CubeMX/Core/Src/main.c

    r38 r39  
    4242/* Private variables ---------------------------------------------------------*/
    4343
     44RTC_HandleTypeDef hrtc;
     45
    4446/* USER CODE BEGIN PV */
    4547
     
    4951void SystemClock_Config(void);
    5052static void MPU_Config(void);
     53static void MX_GPIO_Init(void);
     54static void MX_RTC_Init(void);
    5155/* USER CODE BEGIN PFP */
    5256
     
    97101
    98102  /* Initialize all configured peripherals */
     103  MX_GPIO_Init();
     104  MX_RTC_Init();
    99105  /* USER CODE BEGIN 2 */
    100106
     
    118124void SystemClock_Config(void)
    119125{
    120   RCC_OscInitTypeDef RCC_OscInitStruct {};
    121   RCC_ClkInitTypeDef RCC_ClkInitStruct {};
     126  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
     127  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
    122128
    123129  /** Supply configuration update enable
     
    127133  /** Configure the main internal regulator output voltage
    128134  */
    129   __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
     135  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
    130136
    131137  while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
     138
     139  /** Configure LSE Drive Capability
     140  */
     141  HAL_PWR_EnableBkUpAccess();
     142  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
    132143
    133144  /** Initializes the RCC Oscillators according to the specified parameters
    134145  * in the RCC_OscInitTypeDef structure.
    135146  */
    136   RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
    137   RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
    138   RCC_OscInitStruct.HSICalibrationValue = 64;
    139   RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
     147  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
     148  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
     149  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
     150  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
     151  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
     152  RCC_OscInitStruct.PLL.PLLM = 25;
     153  RCC_OscInitStruct.PLL.PLLN = 200;
     154  RCC_OscInitStruct.PLL.PLLP = 2;
     155  RCC_OscInitStruct.PLL.PLLQ = 2;
     156  RCC_OscInitStruct.PLL.PLLR = 2;
     157  RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_0;
     158  RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOMEDIUM;
     159  RCC_OscInitStruct.PLL.PLLFRACN = 0;
    140160  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
    141161  {
     
    148168                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
    149169                              |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
    150   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
     170  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
    151171  RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
    152172  RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1;
     
    162182}
    163183
     184/**
     185  * @brief RTC Initialization Function
     186  * @param None
     187  * @retval None
     188  */
     189static void MX_RTC_Init(void)
     190{
     191
     192  /* USER CODE BEGIN RTC_Init 0 */
     193
     194  /* USER CODE END RTC_Init 0 */
     195
     196  /* USER CODE BEGIN RTC_Init 1 */
     197
     198  /* USER CODE END RTC_Init 1 */
     199
     200  /** Initialize RTC Only
     201  */
     202  hrtc.Instance = RTC;
     203  hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
     204  hrtc.Init.AsynchPrediv = 127;
     205  hrtc.Init.SynchPrediv = 255;
     206  hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
     207  hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
     208  hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
     209  hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
     210  if (HAL_RTC_Init(&hrtc) != HAL_OK)
     211  {
     212    Error_Handler();
     213  }
     214  /* USER CODE BEGIN RTC_Init 2 */
     215
     216  /* USER CODE END RTC_Init 2 */
     217
     218}
     219
     220/**
     221  * @brief GPIO Initialization Function
     222  * @param None
     223  * @retval None
     224  */
     225static void MX_GPIO_Init(void)
     226{
     227/* USER CODE BEGIN MX_GPIO_Init_1 */
     228/* USER CODE END MX_GPIO_Init_1 */
     229
     230  /* GPIO Ports Clock Enable */
     231  __HAL_RCC_GPIOC_CLK_ENABLE();
     232  __HAL_RCC_GPIOH_CLK_ENABLE();
     233
     234/* USER CODE BEGIN MX_GPIO_Init_2 */
     235/* USER CODE END MX_GPIO_Init_2 */
     236}
     237
    164238/* USER CODE BEGIN 4 */
    165239
     
    170244void MPU_Config(void)
    171245{
    172   MPU_Region_InitTypeDef MPU_InitStruct {};
     246  MPU_Region_InitTypeDef MPU_InitStruct = {0};
    173247
    174248  /* Disables the MPU */
  • TabularUnified ctrl/firmware/Main/CubeMX/Core/Src/stm32h7xx_hal_msp.c

    r13 r39  
    7777}
    7878
     79/**
     80* @brief RTC MSP Initialization
     81* This function configures the hardware resources used in this example
     82* @param hrtc: RTC handle pointer
     83* @retval None
     84*/
     85void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
     86{
     87  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
     88  if(hrtc->Instance==RTC)
     89  {
     90  /* USER CODE BEGIN RTC_MspInit 0 */
     91
     92  /* USER CODE END RTC_MspInit 0 */
     93
     94  /** Initializes the peripherals clock
     95  */
     96    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
     97    PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
     98    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
     99    {
     100      Error_Handler();
     101    }
     102
     103    /* Peripheral clock enable */
     104    __HAL_RCC_RTC_ENABLE();
     105  /* USER CODE BEGIN RTC_MspInit 1 */
     106
     107  /* USER CODE END RTC_MspInit 1 */
     108
     109  }
     110
     111}
     112
     113/**
     114* @brief RTC MSP De-Initialization
     115* This function freeze the hardware resources used in this example
     116* @param hrtc: RTC handle pointer
     117* @retval None
     118*/
     119void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
     120{
     121  if(hrtc->Instance==RTC)
     122  {
     123  /* USER CODE BEGIN RTC_MspDeInit 0 */
     124
     125  /* USER CODE END RTC_MspDeInit 0 */
     126    /* Peripheral clock disable */
     127    __HAL_RCC_RTC_DISABLE();
     128  /* USER CODE BEGIN RTC_MspDeInit 1 */
     129
     130  /* USER CODE END RTC_MspDeInit 1 */
     131  }
     132
     133}
     134
    79135/* USER CODE BEGIN 1 */
    80136
  • TabularUnified ctrl/firmware/Main/CubeMX/charger.ioc

    r38 r39  
    1818Mcu.IP2=NVIC
    1919Mcu.IP3=RCC
    20 Mcu.IP4=SYS
    21 Mcu.IPNb=5
     20Mcu.IP4=RTC
     21Mcu.IP5=SYS
     22Mcu.IPNb=6
    2223Mcu.Name=STM32H723ZETx
    2324Mcu.Package=LQFP144
    24 Mcu.Pin0=VP_SYS_VS_Systick
    25 Mcu.Pin1=VP_MEMORYMAP_VS_MEMORYMAP
    26 Mcu.PinsNb=2
     25Mcu.Pin0=PC14-OSC32_IN
     26Mcu.Pin1=PC15-OSC32_OUT
     27Mcu.Pin2=PH0-OSC_IN
     28Mcu.Pin3=PH1-OSC_OUT
     29Mcu.Pin4=VP_RTC_VS_RTC_Activate
     30Mcu.Pin5=VP_SYS_VS_Systick
     31Mcu.Pin6=VP_MEMORYMAP_VS_MEMORYMAP
     32Mcu.PinsNb=7
    2733Mcu.ThirdPartyNb=0
    2834Mcu.UserConstants=
     
    4147NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
    4248NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
     49PC14-OSC32_IN.Mode=LSE-External-Oscillator
     50PC14-OSC32_IN.Signal=RCC_OSC32_IN
     51PC15-OSC32_OUT.Mode=LSE-External-Oscillator
     52PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
     53PH0-OSC_IN.Mode=HSE-External-Oscillator
     54PH0-OSC_IN.Signal=RCC_OSC_IN
     55PH1-OSC_OUT.Mode=HSE-External-Oscillator
     56PH1-OSC_OUT.Signal=RCC_OSC_OUT
    4357PinOutPanel.RotationAngle=0
    4458ProjectManager.AskForMigrate=true
     
    7286ProjectManager.UAScriptBeforePath=
    7387ProjectManager.UnderRoot=false
    74 ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
    75 RCC.ADCFreq_Value=129000000
    76 RCC.AHB12Freq_Value=64000000
    77 RCC.AHB4Freq_Value=64000000
    78 RCC.APB1Freq_Value=64000000
    79 RCC.APB2Freq_Value=64000000
    80 RCC.APB3Freq_Value=64000000
    81 RCC.APB4Freq_Value=64000000
    82 RCC.AXIClockFreq_Value=64000000
     88ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
     89RCC.ADCFreq_Value=100000000
     90RCC.AHB12Freq_Value=100000000
     91RCC.AHB4Freq_Value=100000000
     92RCC.APB1Freq_Value=100000000
     93RCC.APB2Freq_Value=100000000
     94RCC.APB3Freq_Value=100000000
     95RCC.APB4Freq_Value=100000000
     96RCC.AXIClockFreq_Value=100000000
    8397RCC.CECFreq_Value=32000
    8498RCC.CKPERFreq_Value=64000000
    85 RCC.CortexFreq_Value=64000000
    86 RCC.CpuClockFreq_Value=64000000
    87 RCC.D1CPREFreq_Value=64000000
    88 RCC.DFSDMACLkFreq_Value=129000000
    89 RCC.DFSDMFreq_Value=64000000
    90 RCC.DIVP1Freq_Value=129000000
    91 RCC.DIVP2Freq_Value=129000000
    92 RCC.DIVP3Freq_Value=129000000
    93 RCC.DIVQ1Freq_Value=129000000
    94 RCC.DIVQ2Freq_Value=129000000
    95 RCC.DIVQ3Freq_Value=129000000
    96 RCC.DIVR1Freq_Value=129000000
    97 RCC.DIVR2Freq_Value=129000000
    98 RCC.DIVR3Freq_Value=129000000
    99 RCC.FDCANFreq_Value=129000000
    100 RCC.FMCFreq_Value=64000000
     99RCC.CortexFreq_Value=100000000
     100RCC.CpuClockFreq_Value=100000000
     101RCC.D1CPREFreq_Value=100000000
     102RCC.DFSDMACLkFreq_Value=100000000
     103RCC.DFSDMFreq_Value=100000000
     104RCC.DIVM1=25
     105RCC.DIVM2=25
     106RCC.DIVM3=25
     107RCC.DIVN1=200
     108RCC.DIVN2=200
     109RCC.DIVN3=200
     110RCC.DIVP1Freq_Value=100000000
     111RCC.DIVP2Freq_Value=100000000
     112RCC.DIVP3Freq_Value=100000000
     113RCC.DIVQ1Freq_Value=100000000
     114RCC.DIVQ2Freq_Value=100000000
     115RCC.DIVQ3Freq_Value=100000000
     116RCC.DIVR1Freq_Value=100000000
     117RCC.DIVR2Freq_Value=100000000
     118RCC.DIVR3Freq_Value=100000000
     119RCC.FDCANFreq_Value=100000000
     120RCC.FMCFreq_Value=100000000
    101121RCC.FamilyName=M
    102 RCC.HCLK3ClockFreq_Value=64000000
    103 RCC.HCLKFreq_Value=64000000
    104 RCC.I2C123Freq_Value=64000000
    105 RCC.I2C4Freq_Value=64000000
    106 RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1Freq_Value,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,QSPIFreq_Value,RNGFreq_Value,RTCFreq_Value,SAI1Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
    107 RCC.LPTIM1Freq_Value=64000000
    108 RCC.LPTIM2Freq_Value=64000000
    109 RCC.LPTIM345Freq_Value=64000000
    110 RCC.LPUART1Freq_Value=64000000
    111 RCC.LTDCFreq_Value=129000000
     122RCC.HCLK3ClockFreq_Value=100000000
     123RCC.HCLKFreq_Value=100000000
     124RCC.I2C123Freq_Value=100000000
     125RCC.I2C4Freq_Value=100000000
     126RCC.IPParameters=ADCFreq_Value,AHB12Freq_Value,AHB4Freq_Value,APB1Freq_Value,APB2Freq_Value,APB3Freq_Value,APB4Freq_Value,AXIClockFreq_Value,CECFreq_Value,CKPERFreq_Value,CortexFreq_Value,CpuClockFreq_Value,D1CPREFreq_Value,DFSDMACLkFreq_Value,DFSDMFreq_Value,DIVM1,DIVM2,DIVM3,DIVN1,DIVN2,DIVN3,DIVP1Freq_Value,DIVP2Freq_Value,DIVP3Freq_Value,DIVQ1Freq_Value,DIVQ2Freq_Value,DIVQ3Freq_Value,DIVR1Freq_Value,DIVR2Freq_Value,DIVR3Freq_Value,FDCANFreq_Value,FMCFreq_Value,FamilyName,HCLK3ClockFreq_Value,HCLKFreq_Value,I2C123Freq_Value,I2C4Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPTIM345Freq_Value,LPUART1Freq_Value,LTDCFreq_Value,MCO1PinFreq_Value,MCO2PinFreq_Value,PLLSourceVirtual,QSPIFreq_Value,RNGFreq_Value,RTCClockSelection,RTCFreq_Value,SAI1Freq_Value,SAI4AFreq_Value,SAI4BFreq_Value,SDMMCFreq_Value,SPDIFRXFreq_Value,SPI123Freq_Value,SPI45Freq_Value,SPI6Freq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,SYSCLKSource,Tim1OutputFreq_Value,Tim2OutputFreq_Value,TraceFreq_Value,USART16Freq_Value,USART234578Freq_Value,USBFreq_Value,VCO1OutputFreq_Value,VCO2OutputFreq_Value,VCO3OutputFreq_Value,VCOInput1Freq_Value,VCOInput2Freq_Value,VCOInput3Freq_Value
     127RCC.LPTIM1Freq_Value=100000000
     128RCC.LPTIM2Freq_Value=100000000
     129RCC.LPTIM345Freq_Value=100000000
     130RCC.LPUART1Freq_Value=100000000
     131RCC.LTDCFreq_Value=100000000
    112132RCC.MCO1PinFreq_Value=64000000
    113 RCC.MCO2PinFreq_Value=64000000
    114 RCC.QSPIFreq_Value=64000000
     133RCC.MCO2PinFreq_Value=100000000
     134RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
     135RCC.QSPIFreq_Value=100000000
    115136RCC.RNGFreq_Value=48000000
    116 RCC.RTCFreq_Value=32000
    117 RCC.SAI1Freq_Value=129000000
    118 RCC.SAI4AFreq_Value=129000000
    119 RCC.SAI4BFreq_Value=129000000
    120 RCC.SDMMCFreq_Value=129000000
    121 RCC.SPDIFRXFreq_Value=129000000
    122 RCC.SPI123Freq_Value=129000000
    123 RCC.SPI45Freq_Value=64000000
    124 RCC.SPI6Freq_Value=64000000
    125 RCC.SWPMI1Freq_Value=64000000
    126 RCC.SYSCLKFreq_VALUE=64000000
    127 RCC.Tim1OutputFreq_Value=64000000
    128 RCC.Tim2OutputFreq_Value=64000000
     137RCC.RTCClockSelection=RCC_RTCCLKSOURCE_LSE
     138RCC.RTCFreq_Value=32768
     139RCC.SAI1Freq_Value=100000000
     140RCC.SAI4AFreq_Value=100000000
     141RCC.SAI4BFreq_Value=100000000
     142RCC.SDMMCFreq_Value=100000000
     143RCC.SPDIFRXFreq_Value=100000000
     144RCC.SPI123Freq_Value=100000000
     145RCC.SPI45Freq_Value=100000000
     146RCC.SPI6Freq_Value=100000000
     147RCC.SWPMI1Freq_Value=100000000
     148RCC.SYSCLKFreq_VALUE=100000000
     149RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
     150RCC.Tim1OutputFreq_Value=100000000
     151RCC.Tim2OutputFreq_Value=100000000
    129152RCC.TraceFreq_Value=64000000
    130 RCC.USART16Freq_Value=64000000
    131 RCC.USART234578Freq_Value=64000000
    132 RCC.USBFreq_Value=129000000
    133 RCC.VCO1OutputFreq_Value=258000000
    134 RCC.VCO2OutputFreq_Value=258000000
    135 RCC.VCO3OutputFreq_Value=258000000
    136 RCC.VCOInput1Freq_Value=2000000
    137 RCC.VCOInput2Freq_Value=2000000
    138 RCC.VCOInput3Freq_Value=2000000
     153RCC.USART16Freq_Value=100000000
     154RCC.USART234578Freq_Value=100000000
     155RCC.USBFreq_Value=100000000
     156RCC.VCO1OutputFreq_Value=200000000
     157RCC.VCO2OutputFreq_Value=200000000
     158RCC.VCO3OutputFreq_Value=200000000
     159RCC.VCOInput1Freq_Value=1000000
     160RCC.VCOInput2Freq_Value=1000000
     161RCC.VCOInput3Freq_Value=1000000
    139162VP_MEMORYMAP_VS_MEMORYMAP.Mode=CurAppReg
    140163VP_MEMORYMAP_VS_MEMORYMAP.Signal=MEMORYMAP_VS_MEMORYMAP
     164VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
     165VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
    141166VP_SYS_VS_Systick.Mode=SysTick
    142167VP_SYS_VS_Systick.Signal=SYS_VS_Systick
Note: See TracChangeset for help on using the changeset viewer.