Changeset 55 for trunk/fw_g473rct/Core/Src
- Timestamp:
- Apr 1, 2026, 9:33:58 AM (5 weeks ago)
- Location:
- trunk/fw_g473rct/Core/Src
- Files:
-
- 1 added
- 12 edited
-
adc.c (modified) (12 diffs)
-
crc.c (modified) (1 diff)
-
dma.c (modified) (2 diffs)
-
gpio.c (modified) (3 diffs)
-
i2c.c (modified) (1 diff)
-
iwdg.c (modified) (1 diff)
-
main.c (modified) (21 diffs)
-
rtc.c (modified) (1 diff)
-
spi.c (modified) (1 diff)
-
stm32g4xx_hal_msp.c (modified) (1 diff)
-
stm32g4xx_it.c (modified) (5 diffs)
-
tim.c (added)
-
usart.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fw_g473rct/Core/Src/adc.c
r26 r55 61 61 hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV; 62 62 hadc1.Init.LowPowerAutoWait = DISABLE; 63 hadc1.Init.ContinuousConvMode = ENABLE;63 hadc1.Init.ContinuousConvMode = DISABLE; 64 64 hadc1.Init.NbrOfConversion = 1; 65 65 hadc1.Init.DiscontinuousConvMode = DISABLE; 66 hadc1.Init.ExternalTrigConv = ADC_ SOFTWARE_START;67 hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_ NONE;66 hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T3_TRGO; 67 hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; 68 68 hadc1.Init.DMAContinuousRequests = DISABLE; 69 69 hadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; … … 80 80 /** Configure the ADC multi-mode 81 81 */ 82 multimode.Mode = ADC_DUALMODE_REGSIMULT; 83 multimode.DMAAccessMode = ADC_DMAACCESSMODE_12_10_BITS; 84 multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE; 82 multimode.Mode = ADC_MODE_INDEPENDENT; 85 83 if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK) 86 84 { … … 129 127 hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV; 130 128 hadc2.Init.LowPowerAutoWait = DISABLE; 131 hadc2.Init.ContinuousConvMode = ENABLE;129 hadc2.Init.ContinuousConvMode = DISABLE; 132 130 hadc2.Init.NbrOfConversion = 1; 133 131 hadc2.Init.DiscontinuousConvMode = DISABLE; 132 hadc2.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T3_TRGO; 133 hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; 134 134 hadc2.Init.DMAContinuousRequests = DISABLE; 135 135 hadc2.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; … … 226 226 /** Configure Regular Channel 227 227 */ 228 sConfig.Channel = ADC_CHANNEL_ 12;228 sConfig.Channel = ADC_CHANNEL_5; 229 229 sConfig.Rank = ADC_REGULAR_RANK_2; 230 230 if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK) … … 235 235 /** Configure Regular Channel 236 236 */ 237 sConfig.Channel = ADC_CHANNEL_ 5;237 sConfig.Channel = ADC_CHANNEL_12; 238 238 sConfig.Rank = ADC_REGULAR_RANK_3; 239 239 if (HAL_ADC_ConfigChannel(&hadc3, &sConfig) != HAL_OK) … … 270 270 hadc4.Init.EOCSelection = ADC_EOC_SINGLE_CONV; 271 271 hadc4.Init.LowPowerAutoWait = DISABLE; 272 hadc4.Init.ContinuousConvMode = ENABLE;272 hadc4.Init.ContinuousConvMode = DISABLE; 273 273 hadc4.Init.NbrOfConversion = 1; 274 274 hadc4.Init.DiscontinuousConvMode = DISABLE; 275 hadc4.Init.ExternalTrigConv = ADC_ SOFTWARE_START;276 hadc4.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_ NONE;277 hadc4.Init.DMAContinuousRequests = ENABLE;275 hadc4.Init.ExternalTrigConv = ADC_EXTERNALTRIG_T3_TRGO; 276 hadc4.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING; 277 hadc4.Init.DMAContinuousRequests = DISABLE; 278 278 hadc4.Init.Overrun = ADC_OVR_DATA_PRESERVED; 279 279 hadc4.Init.OversamplingMode = ENABLE; … … 477 477 PA7 ------> ADC2_IN4 478 478 */ 479 GPIO_InitStruct.Pin = ADC2_IN3_UBAT__Pin| GPIO_PIN_7;479 GPIO_InitStruct.Pin = ADC2_IN3_UBAT__Pin|ADC2_IN4_UBAT__Pin; 480 480 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 481 481 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 531 531 PB13 ------> ADC3_IN5 532 532 */ 533 GPIO_InitStruct.Pin = ADC3_IN12_MOSFET_TEMP_Pin|ADC3_IN1_SHUNT_TEMP_Pin|ADC3_IN5_RESERVIERT_Pin;533 GPIO_InitStruct.Pin = LTC_CHARGE_CURRENT_MON_Pin|ADC3_IN1_SHUNT_TEMP_Pin|ADC3_IN5_LTC_DISCHARGE_CURRENT_MON_Pin; 534 534 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 535 535 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 598 598 hdma_adc4.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; 599 599 hdma_adc4.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; 600 hdma_adc4.Init.Mode = DMA_ CIRCULAR;600 hdma_adc4.Init.Mode = DMA_NORMAL; 601 601 hdma_adc4.Init.Priority = DMA_PRIORITY_LOW; 602 602 if (HAL_DMA_Init(&hdma_adc4) != HAL_OK) … … 707 707 PA7 ------> ADC2_IN4 708 708 */ 709 HAL_GPIO_DeInit(GPIOA, ADC2_IN3_UBAT__Pin| GPIO_PIN_7);709 HAL_GPIO_DeInit(GPIOA, ADC2_IN3_UBAT__Pin|ADC2_IN4_UBAT__Pin); 710 710 711 711 /* ADC2 DMA DeInit */ … … 731 731 PB13 ------> ADC3_IN5 732 732 */ 733 HAL_GPIO_DeInit(GPIOB, ADC3_IN12_MOSFET_TEMP_Pin|ADC3_IN1_SHUNT_TEMP_Pin|ADC3_IN5_RESERVIERT_Pin);733 HAL_GPIO_DeInit(GPIOB, LTC_CHARGE_CURRENT_MON_Pin|ADC3_IN1_SHUNT_TEMP_Pin|ADC3_IN5_LTC_DISCHARGE_CURRENT_MON_Pin); 734 734 735 735 /* ADC3 DMA DeInit */ … … 790 790 791 791 /* USER CODE END 1 */ 792 -
trunk/fw_g473rct/Core/Src/crc.c
r25 r55 92 92 93 93 /* USER CODE END 1 */ 94 -
trunk/fw_g473rct/Core/Src/dma.c
r23 r55 43 43 __HAL_RCC_DMAMUX1_CLK_ENABLE(); 44 44 __HAL_RCC_DMA1_CLK_ENABLE(); 45 __HAL_RCC_DMA2_CLK_ENABLE(); 45 46 46 47 /* DMA interrupt init */ … … 66 67 HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0); 67 68 HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn); 69 /* DMA2_Channel1_IRQn interrupt configuration */ 70 NVIC_SetPriority(DMA2_Channel1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); 71 NVIC_EnableIRQ(DMA2_Channel1_IRQn); 72 /* DMA1_Channel8_IRQn interrupt configuration */ 73 NVIC_SetPriority(DMA1_Channel8_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); 74 NVIC_EnableIRQ(DMA1_Channel8_IRQn); 68 75 69 76 } -
trunk/fw_g473rct/Core/Src/gpio.c
r38 r55 56 56 57 57 /*Configure GPIO pin Output Level */ 58 HAL_GPIO_WritePin( GPIOA, LED_FUNCTION_Pin|LED_ERROR_Pin, GPIO_PIN_RESET);58 HAL_GPIO_WritePin(LED_FUNCTION_GPIO_Port, LED_FUNCTION_Pin, GPIO_PIN_RESET); 59 59 60 60 /*Configure GPIO pin Output Level */ 61 HAL_GPIO_WritePin(GPIOB, BUZZER_Pin|DISCHARGE_ENABLE_Pin|CHARGE_ENABLE_Pin, GPIO_PIN_RESET);61 HAL_GPIO_WritePin(GPIOB, LED_ERROR_Pin|BUZZER_Pin, GPIO_PIN_RESET); 62 62 63 63 /*Configure GPIO pins : AUX_EN_Pin ADC_START_CONV_Pin ADC_RESET_Pin */ … … 68 68 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); 69 69 70 /*Configure GPIO pin s : LED_FUNCTION_Pin LED_ERROR_Pin */71 GPIO_InitStruct.Pin = LED_FUNCTION_Pin |LED_ERROR_Pin;70 /*Configure GPIO pin : LED_FUNCTION_Pin */ 71 GPIO_InitStruct.Pin = LED_FUNCTION_Pin; 72 72 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 73 73 GPIO_InitStruct.Pull = GPIO_NOPULL; 74 74 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 75 HAL_GPIO_Init( GPIOA, &GPIO_InitStruct);75 HAL_GPIO_Init(LED_FUNCTION_GPIO_Port, &GPIO_InitStruct); 76 76 77 /*Configure GPIO pins : BUZZER_Pin DISCHARGE_ENABLE_Pin CHARGE_ENABLE_Pin */78 GPIO_InitStruct.Pin = BUZZER_Pin|DISCHARGE_ENABLE_Pin|CHARGE_ENABLE_Pin;77 /*Configure GPIO pins : LED_ERROR_Pin BUZZER_Pin */ 78 GPIO_InitStruct.Pin = LED_ERROR_Pin|BUZZER_Pin; 79 79 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 80 80 GPIO_InitStruct.Pull = GPIO_NOPULL; 81 81 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 82 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); 83 84 /*Configure GPIO pins : OVERWRITE_DISCHARGE_CTRL_Pin OVERWRITE_CHARGE_CTRL_Pin COM_POWERPRO_RES_Pin */ 85 GPIO_InitStruct.Pin = OVERWRITE_DISCHARGE_CTRL_Pin|OVERWRITE_CHARGE_CTRL_Pin|COM_POWERPRO_RES_Pin; 86 GPIO_InitStruct.Mode = GPIO_MODE_INPUT; 87 GPIO_InitStruct.Pull = GPIO_NOPULL; 82 88 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); 83 89 … … 100 106 HAL_GPIO_Init(FAULT_INT_GPIO_Port, &GPIO_InitStruct); 101 107 102 /*Configure GPIO pin : COM_POWERPRO_RES_Pin */103 GPIO_InitStruct.Pin = COM_POWERPRO_RES_Pin;104 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;105 GPIO_InitStruct.Pull = GPIO_NOPULL;106 HAL_GPIO_Init(COM_POWERPRO_RES_GPIO_Port, &GPIO_InitStruct);107 108 108 /* EXTI interrupt init*/ 109 109 HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0); -
trunk/fw_g473rct/Core/Src/i2c.c
r28 r55 240 240 241 241 /* USER CODE END 1 */ 242 -
trunk/fw_g473rct/Core/Src/iwdg.c
r38 r55 55 55 56 56 /* USER CODE END 1 */ 57 -
trunk/fw_g473rct/Core/Src/main.c
r54 r55 22 22 #include "crc.h" 23 23 #include "dma.h" 24 #include "fdcan.h"25 24 #include "i2c.h" 26 25 #include "iwdg.h" 27 26 #include "rtc.h" 28 27 #include "spi.h" 28 #include "tim.h" 29 #include "ucpd.h" 29 30 #include "usart.h" 30 #include "usb.h" 31 #include "usbpd.h" 32 #include "usb_device.h" 31 33 #include "gpio.h" 32 34 … … 53 55 #include "efficiency.h" 54 56 #include "self_discharge.h" 57 #include "ltc_current.h" 55 58 56 59 /* USER CODE END Includes */ … … 65 68 66 69 #define MAX_OVERCURRENT_RETRYS 3 70 #ifdef DEBUG 71 #define MX_IWDG_Init DoNothing 72 #endif 67 73 68 74 /* USER CODE END PD */ … … 81 87 modbus_t modbusData __attribute__((section(".RAM1"))); 82 88 83 __IO uint16_t adc12Data[SAMPLE_ARRAY_SIZE][2] __attribute__((section(".RAM1"))); 84 __IO uint32_t adc1Data[ 1] __attribute__((section(".RAM1")));85 __IO uint32_t adc2Data[ 1] __attribute__((section(".RAM1")));89 90 __IO uint32_t adc1Data[SAMPLE_ARRAY_SIZE] __attribute__((section(".RAM1"))); 91 __IO uint32_t adc2Data[SAMPLE_ARRAY_SIZE] __attribute__((section(".RAM1"))); 86 92 __IO uint32_t adc3Data[3] __attribute__((section(".RAM1"))); 87 __IO uint32_t adc4Data[ 1] __attribute__((section(".RAM1")));93 __IO uint32_t adc4Data[SAMPLE_ARRAY_SIZE] __attribute__((section(".RAM1"))); 88 94 __IO uint32_t adc5Data[4] __attribute__((section(".RAM1"))); 89 95 int silentmode =0; 90 static volatile uint32_t newADC12 Data = 0;96 static volatile uint32_t newADC124Data = 0; 91 97 static volatile uint32_t newADC3Data = 0; 92 static volatile uint32_t newADC4Data = 0;93 98 static volatile uint32_t newADC5Data = 0; 94 99 … … 104 109 void SaveBackupRegister(void); 105 110 void JumpToBootloader(void); 111 void DoNothing(void){}; 106 112 /* USER CODE END PFP */ 107 113 … … 117 123 int main(void) 118 124 { 125 119 126 /* USER CODE BEGIN 1 */ 120 127 … … 160 167 MX_ADC4_Init(); 161 168 MX_ADC5_Init(); 162 MX_FDCAN2_Init();163 MX_FDCAN3_Init();164 169 MX_I2C3_Init(); 165 170 MX_I2C4_Init(); … … 167 172 MX_USART1_UART_Init(); 168 173 MX_USART2_UART_Init(); 169 MX_USB_PCD_Init();170 174 MX_CRC_Init(); 171 175 MX_RTC_Init(); 172 176 MX_IWDG_Init(); 177 MX_TIM3_Init(); 178 MX_USB_Device_Init(); 179 MX_UCPD1_Init(); 173 180 /* USER CODE BEGIN 2 */ 174 181 printf("Test debug io\r\n"); … … 178 185 179 186 startType_t startType = EEPROM_isFirstStart(); 180 187 181 188 switch(startType) 182 189 { … … 212 219 HAL_ADCEx_Calibration_Start(&hadc5, ADC_SINGLE_ENDED); 213 220 HAL_IWDG_Refresh(&hiwdg); 214 221 215 222 //SET_BIT(hadc2.Instance->CFGR, ADC_CFGR_DMAEN); //Enable DMA transfer for ADC slave (ADC12_CCR.MDMA = 0b00 -> MDMA mode disabled) 216 223 //HAL_DMA_Start(hadc2.DMA_Handle,(uint32_t)&hadc2.Instance->DR, (uint32_t)adc2Data,1); //Start ADC slave DMA 217 224 //SET_BIT(hadc1.Instance->CFGR, ADC_CFGR_DMAEN); //Enable DMA transfer for ADC master (ADC12_CCR.MDMA = 0b00 -> MDMA mode disabled) 218 219 //HAL_ADC_Start_DMA(&hadc2, (uint32_t*)adc2Data, 1); 220 if (HAL_ADCEx_MultiModeStart_DMA(&hadc1,(uint32_t *)adc12Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 225 if (HAL_ADC_Start_DMA(&hadc1,(uint32_t *)adc1Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 221 226 { 222 227 /* Start Error */ 223 228 Error_Handler(); 224 229 } 225 226 if (HAL_ADC_Start_DMA(&hadc 3, (uint32_t *) adc3Data , 3))230 231 if (HAL_ADC_Start_DMA(&hadc2,(uint32_t *)adc2Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 227 232 { 228 233 /* Start Error */ … … 230 235 } 231 236 232 if (HAL_ADC_Start_DMA(&hadc4, (uint32_t *) adc4Data , 1)) 237 if (HAL_ADC_Start_DMA(&hadc3, (uint32_t *) adc3Data , 3)) 238 { 239 /* Start Error */ 240 Error_Handler(); 241 } 242 243 if (HAL_ADC_Start_DMA(&hadc4, (uint32_t *) adc4Data , SAMPLE_ARRAY_SIZE)) 233 244 { 234 245 /* Start Error */ … … 265 276 /* USER CODE END 2 */ 266 277 278 /* USBPD initialisation ---------------------------------*/ 279 MX_USBPD_Init(); 280 267 281 /* Infinite loop */ 268 282 /* USER CODE BEGIN WHILE */ … … 270 284 { 271 285 /* USER CODE END WHILE */ 286 USBPD_DPM_Run(); 272 287 273 288 /* USER CODE BEGIN 3 */ 274 289 HAL_IWDG_Refresh(&hiwdg); 275 if (newADC12Data == 1) 276 { 290 if (newADC124Data == 1) 291 { 292 SHUNT_VOLTAGE_Exec( adc4Data[0]); 277 293 //Mit ADC_DIV2,Sample time 12,5Cycklen, ADC Clock 50Mhz, Oversampling 256 278 294 //Tconv = 6400 Takte = 0,128ms Pro Konvertierung. Also für 100 messwerte 12,8mS 279 BATTERY_VOLTAGE_Exec( adc 12Data[SAMPLE_ARRAY_SIZE-1][1]);280 FAST_CURRENT_Exec(adc1 2Data[SAMPLE_ARRAY_SIZE-1][0]);295 BATTERY_VOLTAGE_Exec( adc2Data[SAMPLE_ARRAY_SIZE-1]); 296 FAST_CURRENT_Exec(adc1Data[SAMPLE_ARRAY_SIZE-1]); 281 297 ESR_FAST_Exec(); 282 298 sys_data.s.values.batteryPower = ((int64_t) sys_data.s.values.batteryVoltage * (int64_t)sys_data.s.values.batteryCurrent) / 1000LL; 283 299 sys_data.s.values.power_Fast = ((int64_t) sys_data.s.values.batteryVoltage * (int64_t)sys_data.s.values.fast_current) / 1000LL; 284 newADC12Data = 0; 300 newADC124Data = 0; 301 302 285 303 286 304 287 if (HAL_ADCEx_MultiModeStart_DMA(&hadc1,(uint32_t *)adc12Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 288 { 289 /* Start Error */ 290 Error_Handler(); 291 } 305 if (HAL_ADC_Start_DMA(&hadc1,(uint32_t *)adc1Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 306 { 307 /* Start Error */ 308 Error_Handler(); 309 } 310 311 if (HAL_ADC_Start_DMA(&hadc2,(uint32_t *)adc2Data,SAMPLE_ARRAY_SIZE)) //Start ADC interleaved mode 312 { 313 /* Start Error */ 314 Error_Handler(); 315 } 316 317 // if (HAL_ADC_Start_DMA(&hadc4, (uint32_t *) adc4Data , SAMPLE_ARRAY_SIZE)) 318 // { 319 // /* Start Error */ 320 // Error_Handler(); 321 // } 322 323 324 292 325 293 326 } … … 296 329 { 297 330 SHUNT_TEMPERATURE_Exec(adc3Data[0]); 298 } 299 300 301 if (newADC4Data == 1) 302 { 303 SHUNT_VOLTAGE_Exec( adc4Data[0]); 304 } 331 LTC_CURRENT_Exec(adc3Data[1], adc3Data[2]); 332 333 } 334 335 336 337 338 339 305 340 306 341 … … 317 352 { 318 353 ADS1260_ConversionFinished(); 319 sys_data.s.values.esrCalcStatus = ESR_Exec();354 //sys_data.s.values.esrCalcStatus = ESR_Exec(); 320 355 321 356 newCurrentValue = 0; … … 343 378 printf("SHORT_CIRCUIT_PROTECTION\n"); 344 379 sys_data.s.values.lvpState = OUTPUTS_LVP_SHORT_PROTECTION; 345 HAL_GPIO_WritePin(DISCHARGE_ENABLE_GPIO_Port, DISCHARGE_ENABLE_Pin, OUTPUTS_DISCHARGE_NOT_ALLOWED);380 OUTPUTS_OverwriteDischargeCtrl_DischargeDisabled(); 346 381 347 382 sys_data.s.values.lvpState = OUTPUTS_OVP_SHORT_PROTECTION; 348 HAL_GPIO_WritePin(CHARGE_ENABLE_GPIO_Port, CHARGE_ENABLE_Pin, OUTPUTS_CHARGE_NOT_ALLOWED);383 OUTPUTS_OverwriteChargeCtrl_ChargeDisabled(); 349 384 } 350 385 … … 410 445 case COMMAND_BATTERY_CURRENT_OFFSET_CAL: 411 446 ADS_1260_BatteryCurrentOffsetCalibrationStart(&sys_data); 412 CurrentOffsetCal(adc1 2Data[SAMPLE_ARRAY_SIZE - 1][0]);447 CurrentOffsetCal(adc1Data[SAMPLE_ARRAY_SIZE - 1]); 413 448 break; 414 449 case COMMAND_BATTERY_CURRENT_OFFSET_COMMONMODE_CAL: ADS_1260_BatteryCurrentOffsetCommonModeErrorComepensationStart(&sys_data); break; … … 416 451 case COMMAND_BATTERY_CURRENT_GAIN_CAL: 417 452 ADS_1260_BatteryCurrentGainCalibrationStart(&sys_data); 418 CurrentGainCal(adc1 2Data[SAMPLE_ARRAY_SIZE - 1][0]);453 CurrentGainCal(adc1Data[SAMPLE_ARRAY_SIZE - 1]); 419 454 break; 420 455 case COMMAND_BATTERY_CURRENT_GAIN_TEMP_SHUNT_CAL: ADS_1260_BatteryCurrentGainTemperatureCalibrationShuntStart(); break; … … 499 534 * in the RCC_OscInitTypeDef structure. 500 535 */ 501 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_LSI 502 |RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE; 536 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI48 537 |RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE 538 |RCC_OSCILLATORTYPE_LSE; 503 539 RCC_OscInitStruct.HSEState = RCC_HSE_ON; 504 540 RCC_OscInitStruct.LSEState = RCC_LSE_ON; 541 RCC_OscInitStruct.HSIState = RCC_HSI_ON; 542 RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; 505 543 RCC_OscInitStruct.LSIState = RCC_LSI_ON; 506 544 RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; … … 616 654 if (hadc->Instance==ADC1) 617 655 { 618 newADC12 Data=1;656 newADC124Data=1; 619 657 } 620 658 … … 622 660 { 623 661 newADC3Data=1; 624 }625 626 627 if (hadc->Instance==ADC4)628 {629 newADC4Data=1;630 662 } 631 663 -
trunk/fw_g473rct/Core/Src/rtc.c
r25 r55 108 108 109 109 /* USER CODE END 1 */ 110 -
trunk/fw_g473rct/Core/Src/spi.c
r25 r55 132 132 133 133 /* USER CODE END 1 */ 134 -
trunk/fw_g473rct/Core/Src/stm32g4xx_hal_msp.c
r22 r55 18 18 */ 19 19 /* USER CODE END Header */ 20 21 20 /* Includes ------------------------------------------------------------------*/ 22 21 #include "main.h" -
trunk/fw_g473rct/Core/Src/stm32g4xx_it.c
r38 r55 21 21 #include "main.h" 22 22 #include "stm32g4xx_it.h" 23 #include "usbpd.h" 23 24 /* Private includes ----------------------------------------------------------*/ 24 25 /* USER CODE BEGIN Includes */ … … 58 59 59 60 /* External variables --------------------------------------------------------*/ 61 extern PCD_HandleTypeDef hpcd_USB_FS; 60 62 extern DMA_HandleTypeDef hdma_adc1; 61 63 extern DMA_HandleTypeDef hdma_adc2; … … 197 199 /* USER CODE END SysTick_IRQn 0 */ 198 200 HAL_IncTick(); 201 USBPD_DPM_TimerCounter(); 199 202 /* USER CODE BEGIN SysTick_IRQn 1 */ 200 203 … … 322 325 323 326 /** 327 * @brief This function handles USB low priority interrupt remap. 328 */ 329 void USB_LP_IRQHandler(void) 330 { 331 /* USER CODE BEGIN USB_LP_IRQn 0 */ 332 333 /* USER CODE END USB_LP_IRQn 0 */ 334 HAL_PCD_IRQHandler(&hpcd_USB_FS); 335 /* USER CODE BEGIN USB_LP_IRQn 1 */ 336 337 /* USER CODE END USB_LP_IRQn 1 */ 338 } 339 340 /** 324 341 * @brief This function handles EXTI line[9:5] interrupts. 325 342 */ … … 363 380 } 364 381 382 /** 383 * @brief This function handles DMA2 channel1 global interrupt. 384 */ 385 void DMA2_Channel1_IRQHandler(void) 386 { 387 /* USER CODE BEGIN DMA2_Channel1_IRQn 0 */ 388 389 /* USER CODE END DMA2_Channel1_IRQn 0 */ 390 /* USER CODE BEGIN DMA2_Channel1_IRQn 1 */ 391 392 /* USER CODE END DMA2_Channel1_IRQn 1 */ 393 } 394 395 /** 396 * @brief This function handles UCPD1 interrupt / UCPD1 wake-up interrupt through EXTI line 43. 397 */ 398 void UCPD1_IRQHandler(void) 399 { 400 /* USER CODE BEGIN UCPD1_IRQn 0 */ 401 402 /* USER CODE END UCPD1_IRQn 0 */ 403 USBPD_PORT0_IRQHandler(); 404 405 /* USER CODE BEGIN UCPD1_IRQn 1 */ 406 407 /* USER CODE END UCPD1_IRQn 1 */ 408 } 409 410 /** 411 * @brief This function handles DMA1 channel8 global interrupt. 412 */ 413 void DMA1_Channel8_IRQHandler(void) 414 { 415 /* USER CODE BEGIN DMA1_Channel8_IRQn 0 */ 416 417 /* USER CODE END DMA1_Channel8_IRQn 0 */ 418 /* USER CODE BEGIN DMA1_Channel8_IRQn 1 */ 419 420 /* USER CODE END DMA1_Channel8_IRQn 1 */ 421 } 422 365 423 /* USER CODE BEGIN 1 */ 366 424 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) -
trunk/fw_g473rct/Core/Src/usart.c
r44 r55 97 97 huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1; 98 98 huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; 99 huart2.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE;100 99 if (HAL_UART_Init(&huart2) != HAL_OK) 101 100 { … … 288 287 289 288 /* USER CODE END 1 */ 289
Note:
See TracChangeset
for help on using the changeset viewer.
