From b61a11b4fecf68256f8a74383521e7c1ac4e631b Mon Sep 17 00:00:00 2001 From: Razvalyaev Date: Wed, 19 Nov 2025 02:19:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D1=83=D1=87=D0=B0=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.В Keil добавлен таргет для тестирования прошивки на STM32F417 2. Матлаб все еще не до конца понятно как имено построить модель чтобы токи не подлетали от малейшего открытия тиристоров --- .gitignore | 2 + UPP/AllLibs/PeriphGeneral | 2 +- UPP/Core/Configs/upp_config.h | 28 +- UPP/Core/Configs/upp_defs.h | 1 + UPP/Core/Inc/main.h | 1 + UPP/Core/PowerMonitor/adc_tools.c | 26 +- UPP/Core/PowerMonitor/adc_tools.h | 4 +- UPP/Core/PowerMonitor/power_monitor.c | 35 +- UPP/Core/PowerMonitor/power_monitor.h | 1 + UPP/Core/PowerMonitor/power_protect.c | 4 +- UPP/Core/Src/DBG_stm32f417_support.c | 55 + UPP/Core/Src/adc.c | 4 +- UPP/Core/Src/main.c | 22 +- UPP/Core/Src/stm32f4xx_it.c | 1 - UPP/Core/UPP/upp_errors.c | 7 +- UPP/Core/UPP/upp_errors.h | 6 +- UPP/Core/UPP/upp_main.c | 56 +- UPP/Core/UPP/upp_main.h | 8 +- UPP/Core/UPP/upp_params.c | 6 +- UPP/MDK-ARM/RTE/_Debug_F417/RTE_Components.h | 24 + UPP/MDK-ARM/UPP.uvoptx | 428 ++++++-- UPP/MDK-ARM/UPP.uvprojx | 1039 +++++++++++++++++- UPP/MDK-ARM/startup_stm32f417xx.s | 424 +++++++ UPP/UPP.ioc | 5 +- 24 files changed, 2049 insertions(+), 140 deletions(-) create mode 100644 UPP/MDK-ARM/RTE/_Debug_F417/RTE_Components.h create mode 100644 UPP/MDK-ARM/startup_stm32f417xx.s diff --git a/.gitignore b/.gitignore index f8a2aac..359a86d 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ JLinkLog.txt /MATLAB/MCU.lib /MATLAB/MCU.mexw64.manifest /MATLAB/upp_r2023.slx.autosave +/UPP/MDK-ARM/DebugConfig/ +/UPP/MDK-ARM/Debug_F417 diff --git a/UPP/AllLibs/PeriphGeneral b/UPP/AllLibs/PeriphGeneral index 272642b..2344926 160000 --- a/UPP/AllLibs/PeriphGeneral +++ b/UPP/AllLibs/PeriphGeneral @@ -1 +1 @@ -Subproject commit 272642b310043355b0af95e0410afbbcb74d17b7 +Subproject commit 2344926f92f837703ae7a6d484daf6ca3210472a diff --git a/UPP/Core/Configs/upp_config.h b/UPP/Core/Configs/upp_config.h index d883d87..9769d7b 100644 --- a/UPP/Core/Configs/upp_config.h +++ b/UPP/Core/Configs/upp_config.h @@ -109,14 +109,9 @@ * @{ */ -//#if defined(STM32F417xx) - -//#endif - - /* Периоды вызова всякого */ -#define PM_ADC_PERIOD_US 10 ///< Период опроса АЦП в мкс -#define PM_SLOW_PERIOD_CNT 50 ///< Период обновления медленных расчетов тиках @ref PM_ADC_PERIOD_US +#define PM_ADC_PERIOD_US 30 ///< Период опроса АЦП в мкс +#define PM_SLOW_PERIOD_CNT 25 ///< Период обновления медленных расчетов тиках @ref PM_ADC_PERIOD_US #define PM_TEMP_SLOW_PERIOD_CNT 200 ///< Период обновления датчиков температуры в тиках @ref PM_SLOW_PERIOD_CNT @@ -126,6 +121,25 @@ #define PWM_TIM3_FREQ_MHZ 90 ///< Частота тиков таймера ШИМ (5-6 каналы) #define ANGLE_TIM2_FREQ_MHZ 90 ///< Частота тиков таймера отсчета угла открытия тиристоров + + + + +// ===== ОТЛАДОЧНЫЕ ШТУКИ ДЛЯ 417 ====== +#if defined(STM32F417xx) +#undef ADC_TIM8_FREQ_MZH +#undef PWM_TIM1_FREQ_MHZ +#undef PWM_TIM3_FREQ_MHZ +#undef ANGLE_TIM2_FREQ_MHZ + +// У 417 меньше частота поэтому меняем прескалер +#define ADC_TIM8_FREQ_MZH 168 ///< Частота тиков таймера АЦП +#define PWM_TIM1_FREQ_MHZ 168 ///< Частота тиков таймера ШИМ (1-4 каналы) +#define PWM_TIM3_FREQ_MHZ 84 ///< Частота тиков таймера ШИМ (5-6 каналы) +#define ANGLE_TIM2_FREQ_MHZ 84 ///< Частота тиков таймера отсчета угла открытия тиристоров + +#define HAL_PWREx_EnableOverDrive() HAL_ERROR +#endif /** //UPP_COMPILED_PARAMS * @} */ diff --git a/UPP/Core/Configs/upp_defs.h b/UPP/Core/Configs/upp_defs.h index bf1d138..1b48108 100644 --- a/UPP/Core/Configs/upp_defs.h +++ b/UPP/Core/Configs/upp_defs.h @@ -161,6 +161,7 @@ typedef struct { #define PARAM_PUI MB_DATA.HoldRegs.pui_params #define ERR_PUI errors.pui.err #define ERR_PRIVATE errors.prvt.f.err +#define ERR_PRIVATE_CNT errors.prvt.cnt /** * @brief Состояния полуволны diff --git a/UPP/Core/Inc/main.h b/UPP/Core/Inc/main.h index a3dc80d..2fa1fad 100644 --- a/UPP/Core/Inc/main.h +++ b/UPP/Core/Inc/main.h @@ -175,6 +175,7 @@ void Error_Handler(void); /* USER CODE BEGIN Private defines */ extern TIM_HandleTypeDef ustim; +void SystemClock_Config_STM32F417(void); /* USER CODE END Private defines */ #ifdef __cplusplus diff --git a/UPP/Core/PowerMonitor/adc_tools.c b/UPP/Core/PowerMonitor/adc_tools.c index 3e38f48..9eb1717 100644 --- a/UPP/Core/PowerMonitor/adc_tools.c +++ b/UPP/Core/PowerMonitor/adc_tools.c @@ -100,8 +100,12 @@ HAL_StatusTypeDef ADC_Start(ADC_Periodic_t *adc, float PeriodUs) if(PeriodUs == 0) return HAL_ERROR; + // Остановить перед перенастройкой + HAL_TIM_Base_Stop(adc->htim); + // Запускаем таймер который будет запускать опрос АЦП с заданным периодом __HAL_TIM_SET_AUTORELOAD(adc->htim, TIM_MicrosToTick(PeriodUs, ADC_TIM8_FREQ_MZH)); + res = HAL_TIM_Base_Start(adc->htim); if(res != HAL_OK) { @@ -151,29 +155,27 @@ HAL_StatusTypeDef ADC_Handle(ADC_Periodic_t *adc) uint16_t *raw = adc->RawData; float *data = adc->Data; +// // Фильтрация от импульсных шумов для всех каналов +// for(int i = 0; i < ADC_NUMB_OF_CHANNELS; i++) +// { +// if(Filter_isEnable(&adc->filter[i])) +// { +// // заменяем данные на отфильтрованные данные +// data[i] = Filter_Process(&adc->filter[i], data[i]); +// } +// } + // Перерасчеты Напряжений/Токов в единицы измерения for(int i = 0; i < ADC_NUMB_OF_REGULAR_CHANNELS; i++) { ADC_Coefs_t *coefs = &adc->Coefs[i]; data[i] = ((float)(raw[i])-coefs->lZero) * coefs->vMax / (coefs->lMax-coefs->lZero); -// ADC_UpdateStatistics(adc, i, ADC_LEVEL_AC); - } - - // Фильтрация от шумов для всех каналов - for(int i = 0; i < ADC_NUMB_OF_CHANNELS; i++) - { - if(Filter_isEnable(&adc->filter[i])) - { - // заменяем данные на отфильтрованные данные - data[i] = Filter_Process(&adc->filter[i], data[i]); - } } // Преобразования температуры по таблице for (int i = ADC_TEMP_CHANNELS_START; i < ADC_NUMB_OF_CHANNELS; i++) { data[i] = Filter_Process(&adc->temp_map[i-ADC_TEMP_CHANNELS_START], raw[i]); -// ADC_UpdateStatistics(adc, i, ADC_LEVEL_BASE); } if(Filter_isDataReady(&adc->filter[0])) diff --git a/UPP/Core/PowerMonitor/adc_tools.h b/UPP/Core/PowerMonitor/adc_tools.h index 9e7d307..1fd5db5 100644 --- a/UPP/Core/PowerMonitor/adc_tools.h +++ b/UPP/Core/PowerMonitor/adc_tools.h @@ -51,8 +51,8 @@ static const float adc_temp_vals[] = ADC_TEMPERATURES; static const float adc_temp_quants[] = ADC_TEMPERATURES_QUANTS; -#define Filter_t FilterMedian_t -#define Filter_Init FilterMedian_Init +#define Filter_t FilterMedianInt_t +#define Filter_Init FilterMedianInt_Init #define Filter_Initializator 5 /** diff --git a/UPP/Core/PowerMonitor/power_monitor.c b/UPP/Core/PowerMonitor/power_monitor.c index 40a941b..55d3451 100644 --- a/UPP/Core/PowerMonitor/power_monitor.c +++ b/UPP/Core/PowerMonitor/power_monitor.c @@ -141,6 +141,9 @@ void PowerMonitor_SlowCalc(PowerMonitor_t *hpm) float fmean = 0; // средняя частота по трем фазам float iphase_mean = 0; // средний ток каждой фазы float uphase_mean = 0; // среднее напряжение каждой фазы + + float u_base = to_float(PARAM_INTERNAL.nominal.U, 10); // Дополнительно посчитаем значения в реалдьных Вольтах + float i_base = to_float(PARAM_INTERNAL.nominal.I, 10); // Дополнительно посчитаем значения в реалдьных Амперах for(int i = 0; i < 3; i++) { /* Получение частоты фазы */ @@ -154,6 +157,10 @@ void PowerMonitor_SlowCalc(PowerMonitor_t *hpm) /* Средний ток фазы */ iphase_mean = fabsf(meas->slow.I[i]); meas->final.I[i] = Filter_Process(&hpm->exp[EXP_IC+i], iphase_mean); + + /* Реальные единицы измерения (Вольты/Амперы) */ + meas->real.I[i] = meas->slow.I[i]*i_base; + meas->real.U[i] = meas->slow.U[i]*u_base; } /* Получение средней частоты по трем фазам */ @@ -166,6 +173,7 @@ void PowerMonitor_SlowCalc(PowerMonitor_t *hpm) meas->final.Uamp = Filter_Process(&hpm->exp[EXP_U], uamp); meas->final.Iamp = Filter_Process(&hpm->exp[EXP_I], iamp); + } /** @@ -182,28 +190,25 @@ void PowerMonitor_FastCalc(PowerMonitor_t *hpm) /* Считываем АЦП с пересчетами и медианой фильтрацией от выбросов */ ADC_Handle(&hpm->adc); - /* Заполняем величины Напряжений/Токов */ + /* Заполняем Напряжения/Токи в о.е. */ + float u_base = to_float(PARAM_INTERNAL.nominal.U, 10); + float i_base = to_float(PARAM_INTERNAL.nominal.I, 10); PowerMonitor_Measured_t *meas = &hpm->measured; - meas->real.U[U_BA] = hpm->adc.Data[ADC_CHANNEL_UBA]; - meas->real.U[U_AC] = hpm->adc.Data[ADC_CHANNEL_UAC]; - meas->real.U[U_BC] = U_BC_calc(meas->real.U[U_BA], meas->real.U[U_AC]); + meas->fast.U[U_BA] = hpm->adc.Data[ADC_CHANNEL_UBA]/u_base; + meas->fast.U[U_AC] = hpm->adc.Data[ADC_CHANNEL_UAC]/u_base; + meas->fast.U[U_BC] = U_BC_calc(meas->fast.U[U_BA], meas->fast.U[U_AC]); - meas->real.I[I_C] = hpm->adc.Data[ADC_CHANNEL_IC]; - meas->real.I[I_A] = hpm->adc.Data[ADC_CHANNEL_IA]; - meas->real.I[I_B] = I_B_calc(meas->real.I[I_A], meas->real.I[I_C]); + meas->fast.I[I_C] = hpm->adc.Data[ADC_CHANNEL_IC]/i_base; + meas->fast.I[I_A] = hpm->adc.Data[ADC_CHANNEL_IA]/i_base; + meas->fast.I[I_B] = I_B_calc(meas->fast.I[I_A], meas->fast.I[I_C]); /* Преобразуем в относительные единицы (о.е.) */ - for(int i = 0; i < 3; i++) - { - meas->fast.U[i] = 10*meas->real.U[i]/PARAM_INTERNAL.nominal.U; - meas->fast.I[i] = 10*meas->real.I[i]/PARAM_INTERNAL.nominal.I; - } /* Ищем переход через ноль */ ZC_ProcessAllChannels(&hpm->zc, meas->fast.U, usTick); /* Вообще фильтры должны рабтоать синхронно, но на всякий синхронизация */ - __SynchAvgFilters(hpm); + //__SynchAvgFilters(hpm); /* Average для медленной фильтрации */ meas->slow.U[U_BA] = Filter_Process(&hpm->avg[ADC_CHANNEL_UBA], meas->fast.U[U_BA]); @@ -225,8 +230,8 @@ void PowerMonitor_FastCalc(PowerMonitor_t *hpm) } else // если уже запущена - ставим overrun slow calc { - ERR_PRIVATE.slow_calc_overrun = 1; - errors.prvt.cnt.slow_calc_overrun++; + ERR_PRIVATE.overrun_slow_calc = 1; + ERR_PRIVATE_CNT.overrun_slow_calc++; } } else diff --git a/UPP/Core/PowerMonitor/power_monitor.h b/UPP/Core/PowerMonitor/power_monitor.h index c0e97a9..332db9f 100644 --- a/UPP/Core/PowerMonitor/power_monitor.h +++ b/UPP/Core/PowerMonitor/power_monitor.h @@ -27,6 +27,7 @@ */ typedef struct { + unsigned inIsr:1; ///< Флаг что мы в прерывании unsigned runSlow:1; ///< Запустить медленный алгоритм в while(1) unsigned isU:1; ///< Есть ли напряжение diff --git a/UPP/Core/PowerMonitor/power_protect.c b/UPP/Core/PowerMonitor/power_protect.c index e5259c6..ff1a127 100644 --- a/UPP/Core/PowerMonitor/power_protect.c +++ b/UPP/Core/PowerMonitor/power_protect.c @@ -134,8 +134,8 @@ void Protect_Misc(PowerMonitor_Measured_t *measure, UPP_PUI_Params_t *protect, U { /* Переводим внутренние уставки в удобный вид */ float lFnom = to_float(PARAM_INTERNAL.nominal.F, 100); - float lFmin = lFnom - lFnom*to_float(PARAM_INTERNAL.nominal.F_deviation_minus, 100); - float lFmax = lFnom + lFnom*to_float(PARAM_INTERNAL.nominal.F_deviation_plus, 100); + float lFmin = lFnom - lFnom*to_float(PARAM_INTERNAL.nominal.F_deviation_minus, 10000); + float lFmax = lFnom + lFnom*to_float(PARAM_INTERNAL.nominal.F_deviation_plus, 10000); float lTwarn = to_float(PARAM_INTERNAL.setpoints.TemperatureWarn, 100); float lTerr = to_float(PARAM_INTERNAL.setpoints.TemperatureWarn, 100); diff --git a/UPP/Core/Src/DBG_stm32f417_support.c b/UPP/Core/Src/DBG_stm32f417_support.c index e69de29..6b6af0e 100644 --- a/UPP/Core/Src/DBG_stm32f417_support.c +++ b/UPP/Core/Src/DBG_stm32f417_support.c @@ -0,0 +1,55 @@ +/** +****************************************************************************** +* @file DBG_stm32f417_support.c +* @brief Модуль для запуска кода на STM32F417 +****************************************************************************** +* @details +******************************************************************************/ +#include "main.h" + + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config_STM32F417(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + + /** Configure the main internal regulator output voltage + */ + __HAL_RCC_PWR_CLK_ENABLE(); + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 168; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 4; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK + |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) + { + Error_Handler(); + } +} diff --git a/UPP/Core/Src/adc.c b/UPP/Core/Src/adc.c index 603f877..1e47c8a 100644 --- a/UPP/Core/Src/adc.c +++ b/UPP/Core/Src/adc.c @@ -53,7 +53,7 @@ void MX_ADC3_Init(void) hadc3.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T8_TRGO; hadc3.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc3.Init.NbrOfConversion = 6; - hadc3.Init.DMAContinuousRequests = DISABLE; + hadc3.Init.DMAContinuousRequests = ENABLE; hadc3.Init.EOCSelection = ADC_EOC_SEQ_CONV; if (HAL_ADC_Init(&hadc3) != HAL_OK) { @@ -162,7 +162,7 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle) hdma_adc3.Init.MemInc = DMA_MINC_ENABLE; hdma_adc3.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; hdma_adc3.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; - hdma_adc3.Init.Mode = DMA_NORMAL; + hdma_adc3.Init.Mode = DMA_CIRCULAR; hdma_adc3.Init.Priority = DMA_PRIORITY_LOW; hdma_adc3.Init.FIFOMode = DMA_FIFOMODE_DISABLE; if (HAL_DMA_Init(&hdma_adc3) != HAL_OK) diff --git a/UPP/Core/Src/main.c b/UPP/Core/Src/main.c index 076b2e2..f702212 100644 --- a/UPP/Core/Src/main.c +++ b/UPP/Core/Src/main.c @@ -72,7 +72,14 @@ int main(void) { /* USER CODE BEGIN 1 */ - + __HAL_FREEZE_IWDG_DBGMCU(); + __HAL_FREEZE_TIM1_DBGMCU(); + __HAL_FREEZE_TIM2_DBGMCU(); + __HAL_FREEZE_TIM3_DBGMCU(); + __HAL_FREEZE_TIM5_DBGMCU(); + __HAL_FREEZE_TIM8_DBGMCU(); + __HAL_FREEZE_TIM11_DBGMCU(); + __HAL_FREEZE_TIM12_DBGMCU(); /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ @@ -83,13 +90,16 @@ int main(void) /* USER CODE BEGIN Init */ #ifndef MATLAB +#if defined(STM32F427xx) /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ - +#elif defined(STM32F417xx) + SystemClock_Config_STM32F417(); +#endif /* USER CODE END SysInit */ /* Initialize all configured peripherals */ @@ -109,6 +119,12 @@ int main(void) MX_TIM5_Init(); MX_TIM2_Init(); /* USER CODE BEGIN 2 */ +#if defined(STM32F417xx) + // У 417 меньше частота поэтому меняем прескалер + __HAL_TIM_SET_PRESCALER(&ustim, 84-1); + // И т.к. нет епромки выставляем дефолтные + UPP_SetDefault(1, 1); +#endif #else //MATLAB #endif //MATLAB UPP_Init(); @@ -204,7 +220,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) HAL_IncTick(); } /* USER CODE BEGIN Callback 1 */ - + /* USER CODE END Callback 1 */ } diff --git a/UPP/Core/Src/stm32f4xx_it.c b/UPP/Core/Src/stm32f4xx_it.c index 2d83618..526ec8a 100644 --- a/UPP/Core/Src/stm32f4xx_it.c +++ b/UPP/Core/Src/stm32f4xx_it.c @@ -244,7 +244,6 @@ void TIM8_TRG_COM_TIM14_IRQHandler(void) HAL_TIM_IRQHandler(&htim14); /* USER CODE BEGIN TIM8_TRG_COM_TIM14_IRQn 1 */ #endif - UPP_Tick(); /* USER CODE END TIM8_TRG_COM_TIM14_IRQn 1 */ } diff --git a/UPP/Core/UPP/upp_errors.c b/UPP/Core/UPP/upp_errors.c index 1d00369..72ccdaa 100644 --- a/UPP/Core/UPP/upp_errors.c +++ b/UPP/Core/UPP/upp_errors.c @@ -27,6 +27,7 @@ void UPP_Errors_Other(void); void UPP_Errors_Handle(void) { + /*====== Программные ошибки ======*/ UPP_Errors_Program(); /*====== Ошибки питания плат ======*/ @@ -93,9 +94,9 @@ void UPP_Errors_Ranges(void) int f_max = ( ERR_PRIVATE.fac_max || ERR_PRIVATE.fba_max || ERR_PRIVATE.fbc_max); - int f_min = ( ERR_PRIVATE.fac_max || - ERR_PRIVATE.fba_max || - ERR_PRIVATE.fbc_max); + int f_min = ( ERR_PRIVATE.fac_min || + ERR_PRIVATE.fba_min || + ERR_PRIVATE.fbc_min); ERR_PUI.OverFrequency = setError(f_max, ERR_PUI.OverFrequency, &FMaxCnt, diff --git a/UPP/Core/UPP/upp_errors.h b/UPP/Core/UPP/upp_errors.h index dfafbab..96d2985 100644 --- a/UPP/Core/UPP/upp_errors.h +++ b/UPP/Core/UPP/upp_errors.h @@ -138,7 +138,8 @@ typedef struct unsigned longstart:1; unsigned interlance:3; - unsigned slow_calc_overrun:1; + unsigned overrun_slow_calc:1; + unsigned overrun_fast_calc:1; }err; }f; @@ -147,7 +148,8 @@ typedef struct uint16_t adc_reinit_err; uint16_t zc_reinit_err; uint16_t pwm_reinit_err; - uint16_t slow_calc_overrun; + uint16_t overrun_slow_calc; + uint16_t overrun_fast_calc; }cnt; }prvt; ///< Приватные ошибки, не идущие напрямую в ПУИ diff --git a/UPP/Core/UPP/upp_main.c b/UPP/Core/UPP/upp_main.c index 29f2788..4b67418 100644 --- a/UPP/Core/UPP/upp_main.c +++ b/UPP/Core/UPP/upp_main.c @@ -7,6 +7,7 @@ ******************************************************************************/ #include "upp_main.h" // всё остальное по работе с УПП #include "tim.h" +#include "iwdg.h" UPP_t upp; float iref_dbg = 0; @@ -28,10 +29,22 @@ int UPP_Init(void) upp.PUI.values = &MB_DATA.InRegs.pui; upp.call = &MB_INTERNAL.FuncCalls; - HAL_TIM_Base_Start(&ustim); - PowerMonitor_Init(&upp.pm); - PWM_Init(&upp.hpwm); - Angle_Init(&upp.hangle); + if(HAL_TIM_Base_Start(&ustim) != HAL_OK) + { + return 1; + } + if(PowerMonitor_Init(&upp.pm) != HAL_OK) + { + return 1; + } + if(PWM_Init(&upp.hpwm) != HAL_OK) + { + return 1; + } + if(Angle_Init(&upp.hangle) != HAL_OK) + { + return 1; + } upp.workmode = WM_Ready; return 0; @@ -44,8 +57,12 @@ int UPP_Init(void) int UPP_PreWhile(void) { UPP_Params_InternalControl(); - Angle_SetRange(&upp.hangle, 0.0, 0.8); - PowerMonitor_Start(&upp.pm); + + if(Angle_SetRange(&upp.hangle, 0.0, 0.8) != HAL_OK) + return 1; + + if(PowerMonitor_Start(&upp.pm) != HAL_OK) + return 1; return 0; @@ -58,8 +75,10 @@ int UPP_PreWhile(void) int UPP_While(void) { int retval = 0; + HAL_IWDG_Refresh(&hiwdg); if(upp.pm.f.runSlow) { + BenchTime_Start(BT_SLOWCALC, angletim.Instance->CNT, HAL_MAX_DELAY); UPP_DO.CEN(ENABLE); @@ -156,7 +175,7 @@ int UPP_While(void) } upp.pm.f.runSlow = 0; - upp.Timings.slow_calc = BenchTime_End(BT_SLOWCALC, angletim.Instance->CNT); + upp.Timings.slow_calc_us = BenchTime_End(BT_SLOWCALC, angletim.Instance->CNT)/ANGLE_TIM2_FREQ_MHZ; }//if(upp.pm.f.runSlow) else { @@ -185,9 +204,18 @@ void UPP_Tick(void) void UPP_ADC_Handle(void) { BenchTime_Start(BT_ADC, angletim.Instance->CNT, HAL_MAX_DELAY); + if(upp.pm.f.inIsr) + { + ERR_PRIVATE.overrun_fast_calc = 1; + ERR_PRIVATE_CNT.overrun_fast_calc++; + return; + } + upp.pm.f.inIsr = 1; PowerMonitor_FastCalc(&upp.pm); + PowerMonitor_Protect(&upp.pm, upp.workmode == WM_Running); + for(int phase = 0; phase < 3; phase++) { // Если произошел Zero Cross @@ -207,13 +235,14 @@ void UPP_ADC_Handle(void) // Проверяем на ошибки - upp.Timings.isr_adc = BenchTime_End(BT_ADC, angletim.Instance->CNT); + upp.Timings.isr_adc_us = BenchTime_End(BT_ADC, angletim.Instance->CNT)/ANGLE_TIM2_FREQ_MHZ; + upp.pm.f.inIsr = 0; } void UPP_PWM_Handle(void) { BenchTime_Start(BT_PWM, angletim.Instance->CNT, HAL_MAX_DELAY); PWM_Handle(&upp.hpwm); - upp.Timings.isr_pwm = BenchTime_End(BT_PWM, angletim.Instance->CNT); + upp.Timings.isr_pwm_us = BenchTime_End(BT_PWM, angletim.Instance->CNT)/ANGLE_TIM2_FREQ_MHZ; } void UPP_Angle_Handle(void) @@ -244,8 +273,13 @@ void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef* htim) { if (htim == upp.hangle.htim) { - BenchTime_Start(BT_SYSTICK, angletim.Instance->CNT, HAL_MAX_DELAY); UPP_Angle_Handle(); - upp.Timings.isr_systick = BenchTime_End(BT_SYSTICK, angletim.Instance->CNT); } +} +void HAL_IncTick(void) +{ + BenchTime_Start(BT_SYSTICK, angletim.Instance->CNT, HAL_MAX_DELAY); + uwTick += uwTickFreq; + UPP_Tick(); + upp.Timings.isr_systick_us = BenchTime_End(BT_SYSTICK, angletim.Instance->CNT)/ANGLE_TIM2_FREQ_MHZ; } \ No newline at end of file diff --git a/UPP/Core/UPP/upp_main.h b/UPP/Core/UPP/upp_main.h index 86af664..9d45809 100644 --- a/UPP/Core/UPP/upp_main.h +++ b/UPP/Core/UPP/upp_main.h @@ -39,10 +39,10 @@ typedef struct struct { - uint32_t slow_calc; - uint32_t isr_adc; - uint32_t isr_pwm; - uint32_t isr_systick; + uint32_t slow_calc_us; + uint32_t isr_adc_us; + uint32_t isr_pwm_us; + uint32_t isr_systick_us; }Timings; }UPP_t; extern UPP_t upp; diff --git a/UPP/Core/UPP/upp_params.c b/UPP/Core/UPP/upp_params.c index 5ffaab6..c87dbe6 100644 --- a/UPP/Core/UPP/upp_params.c +++ b/UPP/Core/UPP/upp_params.c @@ -145,7 +145,7 @@ void UPP_Params_InternalControl(void) if(ADC_ConfigChannel(&upp.pm.adc, i, adc_channel_zero[i], adc_channel_max[i], 4095) == HAL_OK) adc_channel_update[i] = 0; else - errors.prvt.cnt.adc_reinit_err++; + ERR_PRIVATE_CNT.adc_reinit_err++; } } // Обновление Zero-Cross конфигов @@ -154,7 +154,7 @@ void UPP_Params_InternalControl(void) if(ZC_Init(&upp.pm.zc, upp.pm.zc.Config.NumChannels, zc_hysteresis, zc_debounce) == HAL_OK) zc_update = 0; else - errors.prvt.cnt.zc_reinit_err++; + ERR_PRIVATE_CNT.zc_reinit_err++; } // Обновление ШИМ конфигов if(pwm_update) @@ -165,7 +165,7 @@ void UPP_Params_InternalControl(void) __AngleSetLimit(); } else - errors.prvt.cnt.pwm_reinit_err++; + ERR_PRIVATE_CNT.pwm_reinit_err++; } if ((upp.hangle.Config.PeriodLimit == 0) || (upp.hangle.Config.PeriodLimit >= 0.999)) { diff --git a/UPP/MDK-ARM/RTE/_Debug_F417/RTE_Components.h b/UPP/MDK-ARM/RTE/_Debug_F417/RTE_Components.h new file mode 100644 index 0000000..5d0532e --- /dev/null +++ b/UPP/MDK-ARM/RTE/_Debug_F417/RTE_Components.h @@ -0,0 +1,24 @@ + +/* + * Auto generated Run-Time-Environment Configuration File + * *** Do not modify ! *** + * + * Project: 'UPP' + * Target: 'Debug_F417' + */ + +#ifndef RTE_COMPONENTS_H +#define RTE_COMPONENTS_H + + +/* + * Define the Device Header File: + */ +#define CMSIS_device_header "stm32f4xx.h" + +/* Keil.ARM Compiler::Compiler:I/O:STDOUT:ITM:1.2.0 */ +#define RTE_Compiler_IO_STDOUT /* Compiler I/O: STDOUT */ + #define RTE_Compiler_IO_STDOUT_ITM /* Compiler I/O: STDOUT ITM */ + + +#endif /* RTE_COMPONENTS_H */ diff --git a/UPP/MDK-ARM/UPP.uvoptx b/UPP/MDK-ARM/UPP.uvoptx index b782c81..ee7ee15 100644 --- a/UPP/MDK-ARM/UPP.uvoptx +++ b/UPP/MDK-ARM/UPP.uvoptx @@ -75,7 +75,7 @@ 1 0 - 1 + 0 18 @@ -198,6 +198,272 @@ + + Debug_F417 + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=620,209,878,797,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32F4xx_1024 -FL0100000 -FS08000000 -FP0($$Device:STM32F417ZGTx$CMSIS\Flash\STM32F4xx_1024.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U005600373433510237363934 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(2BA01477) -L00(0) -TO131123 -TC168000000 -TT10000000 -TP21 -TDS800D -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F417ZGTx$CMSIS\Flash\STM32F4xx_1024.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2 + + + + + 0 + 0 + 136 + 1 +
134258308
+ 0 + 0 + 0 + 0 + 0 + 1 + ../Core/Src/stm32f4xx_it.c + + \\Debug_F417\../Core/Src/stm32f4xx_it.c\136 +
+
+ + + 0 + 1 + upp,0x0A + + + 1 + 1 + uwTick,0x0A + + + 2 + 1 + errors.prvt.f.err,0x0A + + + 3 + 1 + errors.prvt.cnt,0x0A + + + 4 + 1 + hbt,0x0A + + + + + 0 + 2 + MB_INTERNAL,0x0A + + + 1 + 2 + MB_DATA + + + 2 + 2 + errors.prvt.f.err,0x0A + + + 3 + 2 + errors.prvt.cnt + + + 4 + 2 + errors.pui,0x0A + + + 5 + 2 + errors.common + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + System Viewer\DMA2 + 35905 + + + System Viewer\TIM8 + 35904 + + + + 1 + 0 + 0 + 2 + 10000000 + +
+
+ Configs 1 @@ -643,6 +909,18 @@ 0 0 0 + ..\Core\Src\DBG_stm32f417_support.c + DBG_stm32f417_support.c + 0 + 0 + + + 4 + 36 + 1 + 0 + 0 + 0 ../Core/Src/main.c main.c 0 @@ -650,7 +928,7 @@ 4 - 36 + 37 1 0 0 @@ -662,7 +940,7 @@ 4 - 37 + 38 1 0 0 @@ -674,7 +952,7 @@ 4 - 38 + 39 1 0 0 @@ -686,7 +964,7 @@ 4 - 39 + 40 1 0 0 @@ -698,7 +976,7 @@ 4 - 40 + 41 1 0 0 @@ -710,7 +988,7 @@ 4 - 41 + 42 1 0 0 @@ -722,7 +1000,7 @@ 4 - 42 + 43 1 0 0 @@ -734,7 +1012,7 @@ 4 - 43 + 44 1 0 0 @@ -746,7 +1024,7 @@ 4 - 44 + 45 1 0 0 @@ -758,7 +1036,7 @@ 4 - 45 + 46 1 0 0 @@ -770,7 +1048,7 @@ 4 - 46 + 47 1 0 0 @@ -782,7 +1060,7 @@ 4 - 47 + 48 1 0 0 @@ -802,7 +1080,7 @@ 0 5 - 48 + 49 5 0 0 @@ -814,7 +1092,7 @@ 5 - 49 + 50 5 0 0 @@ -826,7 +1104,7 @@ 5 - 50 + 51 5 0 0 @@ -838,7 +1116,7 @@ 5 - 51 + 52 5 0 0 @@ -850,7 +1128,7 @@ 5 - 52 + 53 5 0 0 @@ -862,7 +1140,7 @@ 5 - 53 + 54 5 0 0 @@ -874,7 +1152,7 @@ 5 - 54 + 55 1 0 0 @@ -886,7 +1164,7 @@ 5 - 55 + 56 5 0 0 @@ -900,13 +1178,13 @@ Modbus - 1 + 0 0 0 0 6 - 56 + 57 1 0 0 @@ -918,7 +1196,7 @@ 6 - 57 + 58 1 0 0 @@ -930,7 +1208,7 @@ 6 - 58 + 59 1 0 0 @@ -942,7 +1220,7 @@ 6 - 59 + 60 1 0 0 @@ -954,7 +1232,7 @@ 6 - 60 + 61 1 0 0 @@ -966,7 +1244,7 @@ 6 - 61 + 62 1 0 0 @@ -978,7 +1256,7 @@ 6 - 62 + 63 1 0 0 @@ -990,7 +1268,7 @@ 6 - 63 + 64 1 0 0 @@ -1002,7 +1280,7 @@ 6 - 64 + 65 1 0 0 @@ -1014,7 +1292,7 @@ 6 - 65 + 66 1 0 0 @@ -1026,7 +1304,7 @@ 6 - 66 + 67 1 0 0 @@ -1038,7 +1316,7 @@ 6 - 67 + 68 1 0 0 @@ -1058,7 +1336,7 @@ 0 7 - 68 + 69 1 0 0 @@ -1070,7 +1348,7 @@ 7 - 69 + 70 1 0 0 @@ -1090,7 +1368,7 @@ 0 8 - 70 + 71 1 0 0 @@ -1102,7 +1380,7 @@ 8 - 71 + 72 1 0 0 @@ -1114,7 +1392,7 @@ 8 - 72 + 73 1 0 0 @@ -1126,7 +1404,7 @@ 8 - 73 + 74 1 0 0 @@ -1138,7 +1416,7 @@ 8 - 74 + 75 1 0 0 @@ -1158,7 +1436,7 @@ 0 9 - 75 + 76 1 0 0 @@ -1170,7 +1448,7 @@ 9 - 76 + 77 1 0 0 @@ -1182,7 +1460,7 @@ 9 - 77 + 78 1 0 0 @@ -1194,7 +1472,7 @@ 9 - 78 + 79 1 0 0 @@ -1206,7 +1484,7 @@ 9 - 79 + 80 1 0 0 @@ -1218,7 +1496,7 @@ 9 - 80 + 81 1 0 0 @@ -1230,7 +1508,7 @@ 9 - 81 + 82 1 0 0 @@ -1242,7 +1520,7 @@ 9 - 82 + 83 1 0 0 @@ -1254,7 +1532,7 @@ 9 - 83 + 84 1 0 0 @@ -1266,7 +1544,7 @@ 9 - 84 + 85 1 0 0 @@ -1278,7 +1556,7 @@ 9 - 85 + 86 1 0 0 @@ -1290,7 +1568,7 @@ 9 - 86 + 87 1 0 0 @@ -1302,7 +1580,7 @@ 9 - 87 + 88 1 0 0 @@ -1314,7 +1592,7 @@ 9 - 88 + 89 1 0 0 @@ -1326,7 +1604,7 @@ 9 - 89 + 90 1 0 0 @@ -1338,7 +1616,7 @@ 9 - 90 + 91 1 0 0 @@ -1350,7 +1628,7 @@ 9 - 91 + 92 1 0 0 @@ -1362,7 +1640,7 @@ 9 - 92 + 93 1 0 0 @@ -1374,7 +1652,7 @@ 9 - 93 + 94 1 0 0 @@ -1386,7 +1664,7 @@ 9 - 94 + 95 1 0 0 @@ -1398,7 +1676,7 @@ 9 - 95 + 96 1 0 0 @@ -1410,7 +1688,7 @@ 9 - 96 + 97 1 0 0 @@ -1422,7 +1700,7 @@ 9 - 97 + 98 1 0 0 @@ -1434,7 +1712,7 @@ 9 - 98 + 99 1 0 0 @@ -1454,7 +1732,7 @@ 0 10 - 99 + 100 1 0 0 @@ -1468,18 +1746,30 @@ Application/MDK-ARM - 0 + 1 0 0 0 11 - 100 + 101 2 0 0 0 - startup_stm32f427xx.s + .\startup_stm32f417xx.s + startup_stm32f417xx.s + 0 + 0 + + + 11 + 102 + 2 + 0 + 0 + 0 + .\startup_stm32f427xx.s startup_stm32f427xx.s 0 0 diff --git a/UPP/MDK-ARM/UPP.uvprojx b/UPP/MDK-ARM/UPP.uvprojx index 3d8dd09..20b686b 100644 --- a/UPP/MDK-ARM/UPP.uvprojx +++ b/UPP/MDK-ARM/UPP.uvprojx @@ -570,6 +570,11 @@ Application/User/Core + + DBG_stm32f417_support.c + 1 + ..\Core\Src\DBG_stm32f417_support.c + main.c 1 @@ -930,10 +935,1040 @@ Application/MDK-ARM + + startup_stm32f417xx.s + 2 + .\startup_stm32f417xx.s + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + + startup_stm32f427xx.s 2 - startup_stm32f427xx.s + .\startup_stm32f427xx.s + + + + + ::CMSIS + + + ::Compiler + + + + + Debug_F417 + 0x4 + ARM-ADS + 6190000::V6.19::ARMCLANG + 6190000::V6.19::ARMCLANG + 1 + + + STM32F417ZGTx + STMicroelectronics + Keil.STM32F4xx_DFP.2.16.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x00020000) IRAM2(0x10000000,0x00010000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F417ZGTx$CMSIS\Flash\STM32F4xx_1024.FLM)) + 0 + $$Device:STM32F417ZGTx$Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h + + + + + + + + + + $$Device:STM32F417ZGTx$CMSIS\SVD\STM32F41x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Debug_F417\ + Debug_F417 + 1 + 0 + 1 + 1 + 1 + + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 1 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4101 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 0 + 0 + 0 + 1 + 0 + 8 + 0 + 0 + 0 + 0 + 3 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x10000000 + 0x10000 + + + + + + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 3 + 5 + 1 + 1 + 0 + 0 + 0 + + + USE_HAL_DRIVER,STM32F417xx, ARM_MATH_CM4 + + ../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;../AllLibs/ExtMemory/Inc;../AllLibs/Modbus/Inc;../AllLibs/MyLibs/MyLibs/Inc;../AllLibs/MyLibs/RTT;../AllLibs/PeriphGeneral/Inc;../Core/Configs;../Core/PowerMonitor;../Core/Thyristors;../Core/UPP + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + + + + + + + + + + + + + + + Configs + + + upp_config.h + 5 + ..\Core\Configs\upp_config.h + + + upp_defs.h + 5 + ..\Core\Configs\upp_defs.h + + + main.h + 5 + ..\Core\Inc\main.h + + + modbus_config.h + 5 + ..\Core\Configs\modbus_config.h + + + modbus_data.c + 1 + ..\Core\Configs\modbus_data.c + + + modbus_data.h + 5 + ..\Core\Configs\modbus_data.h + + + mylibs_config.h + 5 + ..\Core\Configs\mylibs_config.h + + + mylibs_include.h + 5 + ..\Core\Configs\mylibs_include.h + + + memspi_config.h + 5 + ..\Core\Configs\memspi_config.h + + + SEGGER_RTT_Conf.h + 5 + ..\Core\Configs\SEGGER_RTT_Conf.h + + + + + UPP/Main + + + upp_main.c + 1 + ..\Core\UPP\upp_main.c + + + upp_main.h + 5 + ..\Core\UPP\upp_main.h + + + pwm_thyristors.c + 1 + ..\Core\UPP\pwm_thyristors.c + + + pwm_thyristors.h + 5 + ..\Core\UPP\pwm_thyristors.h + + + angle_control.c + 1 + ..\Core\UPP\angle_control.c + + + angle_control.h + 5 + ..\Core\UPP\angle_control.h + + + upp_status.c + 1 + ..\Core\UPP\upp_status.c + + + upp_status.h + 5 + ..\Core\UPP\upp_status.h + + + upp_errors.c + 1 + ..\Core\UPP\upp_errors.c + + + upp_errors.h + 5 + ..\Core\UPP\upp_errors.h + + + upp_params.c + 1 + ..\Core\UPP\upp_params.c + + + upp_params.h + 5 + ..\Core\UPP\upp_params.h + + + upp_io.c + 1 + ..\Core\UPP\upp_io.c + + + upp_io.h + 5 + ..\Core\UPP\upp_io.h + + + + + PowerMonitor + + + power_monitor.c + 1 + ..\Core\PowerMonitor\power_monitor.c + + + power_monitor.h + 5 + ..\Core\PowerMonitor\power_monitor.h + + + zero_cross.c + 1 + ..\Core\PowerMonitor\zero_cross.c + + + zero_cross.h + 5 + ..\Core\PowerMonitor\zero_cross.h + + + adc_tools.c + 1 + ..\Core\PowerMonitor\adc_tools.c + + + adc_tools.h + 5 + ..\Core\PowerMonitor\adc_tools.h + + + phases_transform.c + 1 + ..\Core\PowerMonitor\phases_transform.c + + + phases_transform.h + 5 + ..\Core\PowerMonitor\phases_transform.h + + + power_protect.c + 1 + ..\Core\PowerMonitor\power_protect.c + + + power_protect.h + 5 + ..\Core\PowerMonitor\power_protect.h + + + + + Application/User/Core + + + DBG_stm32f417_support.c + 1 + ..\Core\Src\DBG_stm32f417_support.c + + + main.c + 1 + ../Core/Src/main.c + + + gpio.c + 1 + ../Core/Src/gpio.c + + + adc.c + 1 + ../Core/Src/adc.c + + + can.c + 1 + ../Core/Src/can.c + + + dma.c + 1 + ../Core/Src/dma.c + + + iwdg.c + 1 + ../Core/Src/iwdg.c + + + rtc.c + 1 + ../Core/Src/rtc.c + + + spi.c + 1 + ../Core/Src/spi.c + + + tim.c + 1 + ../Core/Src/tim.c + + + usart.c + 1 + ../Core/Src/usart.c + + + stm32f4xx_it.c + 1 + ../Core/Src/stm32f4xx_it.c + + + stm32f4xx_hal_msp.c + 1 + ../Core/Src/stm32f4xx_hal_msp.c + + + stm32f4xx_hal_timebase_tim.c + 1 + ../Core/Src/stm32f4xx_hal_timebase_tim.c + + + + + MyLibs + + + bench_time.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\bench_time.h + + + bit_access.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\bit_access.h + + + gen_optimizer.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\gen_optimizer.h + + + mylibs_defs.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\mylibs_defs.h + + + trace.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\trace.h + + + trackers.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\trackers.h + + + filters.c + 1 + ..\AllLibs\MyLibs\MyLibs\Src\filters.c + + + filters.h + 5 + ..\AllLibs\MyLibs\MyLibs\Inc\filters.h + + + + + Modbus + + + __crc_algs.c + 1 + ..\AllLibs\Modbus\Src\__crc_algs.c + + + __modbus_compat.c + 1 + ..\AllLibs\Modbus\Src\__modbus_compat.c + + + modbus.c + 1 + ..\AllLibs\Modbus\Src\modbus.c + + + modbus_coils.c + 1 + ..\AllLibs\Modbus\Src\modbus_coils.c + + + modbus_core.c + 1 + ..\AllLibs\Modbus\Src\modbus_core.c + + + modbus_devid.c + 1 + ..\AllLibs\Modbus\Src\modbus_devid.c + + + modbus_diag.c + 1 + ..\AllLibs\Modbus\Src\modbus_diag.c + + + modbus_holdregs.c + 1 + ..\AllLibs\Modbus\Src\modbus_holdregs.c + + + modbus_inputregs.c + 1 + ..\AllLibs\Modbus\Src\modbus_inputregs.c + + + modbus_master.c + 1 + ..\AllLibs\Modbus\Src\modbus_master.c + + + modbus_slave.c + 1 + ..\AllLibs\Modbus\Src\modbus_slave.c + + + rs_message.c + 1 + ..\AllLibs\Modbus\Src\rs_message.c + + + + + ExtMemory + + + memspi.c + 1 + ..\AllLibs\ExtMemory\Src\memspi.c + + + memspi_core.c + 1 + ..\AllLibs\ExtMemory\Src\memspi_core.c + + + + + PeriphGeneral + + + __general_flash.c + 1 + ..\AllLibs\PeriphGeneral\Src\__general_flash.c + + + general_gpio.c + 1 + ..\AllLibs\PeriphGeneral\Src\general_gpio.c + + + general_spi.c + 1 + ..\AllLibs\PeriphGeneral\Src\general_spi.c + + + general_tim.c + 1 + ..\AllLibs\PeriphGeneral\Src\general_tim.c + + + general_uart.c + 1 + ..\AllLibs\PeriphGeneral\Src\general_uart.c + + + + + Drivers/STM32F4xx_HAL_Driver + + + stm32f4xx_hal_adc.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c + + + stm32f4xx_hal_adc_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c + + + stm32f4xx_ll_adc.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c + + + stm32f4xx_hal_rcc.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c + + + stm32f4xx_hal_rcc_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c + + + stm32f4xx_hal_flash.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c + + + stm32f4xx_hal_flash_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c + + + stm32f4xx_hal_flash_ramfunc.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c + + + stm32f4xx_hal_gpio.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c + + + stm32f4xx_hal_dma_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c + + + stm32f4xx_hal_dma.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c + + + stm32f4xx_hal_pwr.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c + + + stm32f4xx_hal_pwr_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c + + + stm32f4xx_hal_cortex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c + + + stm32f4xx_hal.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c + + + stm32f4xx_hal_exti.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c + + + stm32f4xx_hal_can.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c + + + stm32f4xx_hal_iwdg.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c + + + stm32f4xx_hal_rtc.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c + + + stm32f4xx_hal_rtc_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c + + + stm32f4xx_hal_spi.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c + + + stm32f4xx_hal_tim.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c + + + stm32f4xx_hal_tim_ex.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c + + + stm32f4xx_hal_uart.c + 1 + ../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c + + + + + Drivers/CMSIS + + + system_stm32f4xx.c + 1 + ../Core/Src/system_stm32f4xx.c + + + + + Application/MDK-ARM + + + startup_stm32f417xx.s + 2 + .\startup_stm32f417xx.s + + + startup_stm32f427xx.s + 2 + .\startup_stm32f427xx.s + + + 2 + 0 + 0 + 0 + 0 + 0 + 2 + 2 + 2 + 2 + 11 + + + 1 + + + + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 0 + + + + + + + + + @@ -959,12 +1994,14 @@ + + diff --git a/UPP/MDK-ARM/startup_stm32f417xx.s b/UPP/MDK-ARM/startup_stm32f417xx.s new file mode 100644 index 0000000..de989f8 --- /dev/null +++ b/UPP/MDK-ARM/startup_stm32f417xx.s @@ -0,0 +1,424 @@ +;******************************************************************************* +;* File Name : startup_stm32f417xx.s +;* Author : MCD Application Team +;* Description : STM32F417xx devices vector table for MDK-ARM toolchain. +;* This module performs: +;* - Set the initial SP +;* - Set the initial PC == Reset_Handler +;* - Set the vector table entries with the exceptions ISR address +;* - Branches to __main in the C library (which eventually +;* calls main()). +;* After Reset the CortexM4 processor is in Thread mode, +;* priority is Privileged, and the Stack is set to Main. +;******************************************************************************* +;* @attention +;* +;* Copyright (c) 2017 STMicroelectronics. +;* All rights reserved. +;* +;* This software is licensed under terms that can be found in the LICENSE file +;* in the root directory of this software component. +;* If no LICENSE file comes with this software, it is provided AS-IS. +;* +;******************************************************************************* +;* <<< Use Configuration Wizard in Context Menu >>> +; +; Amount of memory (in bytes) allocated for Stack +; Tailor this value to your application needs +; Stack Configuration +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Stack_Size EQU 0x400 + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + +; Heap Configuration +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Heap_Size EQU 0x200 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + PRESERVE8 + THUMB + + +; Vector Table Mapped to Address 0 at Reset + AREA RESET, DATA, READONLY + EXPORT __Vectors + EXPORT __Vectors_End + EXPORT __Vectors_Size + +__Vectors DCD __initial_sp ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NMI_Handler ; NMI Handler + DCD HardFault_Handler ; Hard Fault Handler + DCD MemManage_Handler ; MPU Fault Handler + DCD BusFault_Handler ; Bus Fault Handler + DCD UsageFault_Handler ; Usage Fault Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler ; SVCall Handler + DCD DebugMon_Handler ; Debug Monitor Handler + DCD 0 ; Reserved + DCD PendSV_Handler ; PendSV Handler + DCD SysTick_Handler ; SysTick Handler + + ; External Interrupts + DCD WWDG_IRQHandler ; Window WatchDog + DCD PVD_IRQHandler ; PVD through EXTI Line detection + DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line + DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line + DCD FLASH_IRQHandler ; FLASH + DCD RCC_IRQHandler ; RCC + DCD EXTI0_IRQHandler ; EXTI Line0 + DCD EXTI1_IRQHandler ; EXTI Line1 + DCD EXTI2_IRQHandler ; EXTI Line2 + DCD EXTI3_IRQHandler ; EXTI Line3 + DCD EXTI4_IRQHandler ; EXTI Line4 + DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0 + DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1 + DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2 + DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3 + DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4 + DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5 + DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6 + DCD ADC_IRQHandler ; ADC1, ADC2 and ADC3s + DCD CAN1_TX_IRQHandler ; CAN1 TX + DCD CAN1_RX0_IRQHandler ; CAN1 RX0 + DCD CAN1_RX1_IRQHandler ; CAN1 RX1 + DCD CAN1_SCE_IRQHandler ; CAN1 SCE + DCD EXTI9_5_IRQHandler ; External Line[9:5]s + DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9 + DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10 + DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11 + DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare + DCD TIM2_IRQHandler ; TIM2 + DCD TIM3_IRQHandler ; TIM3 + DCD TIM4_IRQHandler ; TIM4 + DCD I2C1_EV_IRQHandler ; I2C1 Event + DCD I2C1_ER_IRQHandler ; I2C1 Error + DCD I2C2_EV_IRQHandler ; I2C2 Event + DCD I2C2_ER_IRQHandler ; I2C2 Error + DCD SPI1_IRQHandler ; SPI1 + DCD SPI2_IRQHandler ; SPI2 + DCD USART1_IRQHandler ; USART1 + DCD USART2_IRQHandler ; USART2 + DCD USART3_IRQHandler ; USART3 + DCD EXTI15_10_IRQHandler ; External Line[15:10]s + DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line + DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line + DCD TIM8_BRK_TIM12_IRQHandler ; TIM8 Break and TIM12 + DCD TIM8_UP_TIM13_IRQHandler ; TIM8 Update and TIM13 + DCD TIM8_TRG_COM_TIM14_IRQHandler ; TIM8 Trigger and Commutation and TIM14 + DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare + DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7 + DCD FMC_IRQHandler ; FMC + DCD SDIO_IRQHandler ; SDIO + DCD TIM5_IRQHandler ; TIM5 + DCD SPI3_IRQHandler ; SPI3 + DCD UART4_IRQHandler ; UART4 + DCD UART5_IRQHandler ; UART5 + DCD TIM6_DAC_IRQHandler ; TIM6 and DAC1&2 underrun errors + DCD TIM7_IRQHandler ; TIM7 + DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0 + DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1 + DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2 + DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3 + DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4 + DCD ETH_IRQHandler ; Ethernet + DCD ETH_WKUP_IRQHandler ; Ethernet Wakeup through EXTI line + DCD CAN2_TX_IRQHandler ; CAN2 TX + DCD CAN2_RX0_IRQHandler ; CAN2 RX0 + DCD CAN2_RX1_IRQHandler ; CAN2 RX1 + DCD CAN2_SCE_IRQHandler ; CAN2 SCE + DCD OTG_FS_IRQHandler ; USB OTG FS + DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5 + DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6 + DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7 + DCD USART6_IRQHandler ; USART6 + DCD I2C3_EV_IRQHandler ; I2C3 event + DCD I2C3_ER_IRQHandler ; I2C3 error + DCD OTG_HS_EP1_OUT_IRQHandler ; USB OTG HS End Point 1 Out + DCD OTG_HS_EP1_IN_IRQHandler ; USB OTG HS End Point 1 In + DCD OTG_HS_WKUP_IRQHandler ; USB OTG HS Wakeup through EXTI + DCD OTG_HS_IRQHandler ; USB OTG HS + DCD DCMI_IRQHandler ; DCMI + DCD CRYP_IRQHandler ; CRYPTO + DCD HASH_RNG_IRQHandler ; Hash and Rng + DCD FPU_IRQHandler ; FPU + + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset handler +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + + LDR R0, =SystemInit + BLX R0 + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops which can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP +MemManage_Handler\ + PROC + EXPORT MemManage_Handler [WEAK] + B . + ENDP +BusFault_Handler\ + PROC + EXPORT BusFault_Handler [WEAK] + B . + ENDP +UsageFault_Handler\ + PROC + EXPORT UsageFault_Handler [WEAK] + B . + ENDP +SVC_Handler PROC + EXPORT SVC_Handler [WEAK] + B . + ENDP +DebugMon_Handler\ + PROC + EXPORT DebugMon_Handler [WEAK] + B . + ENDP +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +Default_Handler PROC + + EXPORT WWDG_IRQHandler [WEAK] + EXPORT PVD_IRQHandler [WEAK] + EXPORT TAMP_STAMP_IRQHandler [WEAK] + EXPORT RTC_WKUP_IRQHandler [WEAK] + EXPORT FLASH_IRQHandler [WEAK] + EXPORT RCC_IRQHandler [WEAK] + EXPORT EXTI0_IRQHandler [WEAK] + EXPORT EXTI1_IRQHandler [WEAK] + EXPORT EXTI2_IRQHandler [WEAK] + EXPORT EXTI3_IRQHandler [WEAK] + EXPORT EXTI4_IRQHandler [WEAK] + EXPORT DMA1_Stream0_IRQHandler [WEAK] + EXPORT DMA1_Stream1_IRQHandler [WEAK] + EXPORT DMA1_Stream2_IRQHandler [WEAK] + EXPORT DMA1_Stream3_IRQHandler [WEAK] + EXPORT DMA1_Stream4_IRQHandler [WEAK] + EXPORT DMA1_Stream5_IRQHandler [WEAK] + EXPORT DMA1_Stream6_IRQHandler [WEAK] + EXPORT ADC_IRQHandler [WEAK] + EXPORT CAN1_TX_IRQHandler [WEAK] + EXPORT CAN1_RX0_IRQHandler [WEAK] + EXPORT CAN1_RX1_IRQHandler [WEAK] + EXPORT CAN1_SCE_IRQHandler [WEAK] + EXPORT EXTI9_5_IRQHandler [WEAK] + EXPORT TIM1_BRK_TIM9_IRQHandler [WEAK] + EXPORT TIM1_UP_TIM10_IRQHandler [WEAK] + EXPORT TIM1_TRG_COM_TIM11_IRQHandler [WEAK] + EXPORT TIM1_CC_IRQHandler [WEAK] + EXPORT TIM2_IRQHandler [WEAK] + EXPORT TIM3_IRQHandler [WEAK] + EXPORT TIM4_IRQHandler [WEAK] + EXPORT I2C1_EV_IRQHandler [WEAK] + EXPORT I2C1_ER_IRQHandler [WEAK] + EXPORT I2C2_EV_IRQHandler [WEAK] + EXPORT I2C2_ER_IRQHandler [WEAK] + EXPORT SPI1_IRQHandler [WEAK] + EXPORT SPI2_IRQHandler [WEAK] + EXPORT USART1_IRQHandler [WEAK] + EXPORT USART2_IRQHandler [WEAK] + EXPORT USART3_IRQHandler [WEAK] + EXPORT EXTI15_10_IRQHandler [WEAK] + EXPORT RTC_Alarm_IRQHandler [WEAK] + EXPORT OTG_FS_WKUP_IRQHandler [WEAK] + EXPORT TIM8_BRK_TIM12_IRQHandler [WEAK] + EXPORT TIM8_UP_TIM13_IRQHandler [WEAK] + EXPORT TIM8_TRG_COM_TIM14_IRQHandler [WEAK] + EXPORT TIM8_CC_IRQHandler [WEAK] + EXPORT DMA1_Stream7_IRQHandler [WEAK] + EXPORT FMC_IRQHandler [WEAK] + EXPORT SDIO_IRQHandler [WEAK] + EXPORT TIM5_IRQHandler [WEAK] + EXPORT SPI3_IRQHandler [WEAK] + EXPORT UART4_IRQHandler [WEAK] + EXPORT UART5_IRQHandler [WEAK] + EXPORT TIM6_DAC_IRQHandler [WEAK] + EXPORT TIM7_IRQHandler [WEAK] + EXPORT DMA2_Stream0_IRQHandler [WEAK] + EXPORT DMA2_Stream1_IRQHandler [WEAK] + EXPORT DMA2_Stream2_IRQHandler [WEAK] + EXPORT DMA2_Stream3_IRQHandler [WEAK] + EXPORT DMA2_Stream4_IRQHandler [WEAK] + EXPORT ETH_IRQHandler [WEAK] + EXPORT ETH_WKUP_IRQHandler [WEAK] + EXPORT CAN2_TX_IRQHandler [WEAK] + EXPORT CAN2_RX0_IRQHandler [WEAK] + EXPORT CAN2_RX1_IRQHandler [WEAK] + EXPORT CAN2_SCE_IRQHandler [WEAK] + EXPORT OTG_FS_IRQHandler [WEAK] + EXPORT DMA2_Stream5_IRQHandler [WEAK] + EXPORT DMA2_Stream6_IRQHandler [WEAK] + EXPORT DMA2_Stream7_IRQHandler [WEAK] + EXPORT USART6_IRQHandler [WEAK] + EXPORT I2C3_EV_IRQHandler [WEAK] + EXPORT I2C3_ER_IRQHandler [WEAK] + EXPORT OTG_HS_EP1_OUT_IRQHandler [WEAK] + EXPORT OTG_HS_EP1_IN_IRQHandler [WEAK] + EXPORT OTG_HS_WKUP_IRQHandler [WEAK] + EXPORT OTG_HS_IRQHandler [WEAK] + EXPORT DCMI_IRQHandler [WEAK] + EXPORT CRYP_IRQHandler [WEAK] + EXPORT HASH_RNG_IRQHandler [WEAK] + EXPORT FPU_IRQHandler [WEAK] + +WWDG_IRQHandler +PVD_IRQHandler +TAMP_STAMP_IRQHandler +RTC_WKUP_IRQHandler +FLASH_IRQHandler +RCC_IRQHandler +EXTI0_IRQHandler +EXTI1_IRQHandler +EXTI2_IRQHandler +EXTI3_IRQHandler +EXTI4_IRQHandler +DMA1_Stream0_IRQHandler +DMA1_Stream1_IRQHandler +DMA1_Stream2_IRQHandler +DMA1_Stream3_IRQHandler +DMA1_Stream4_IRQHandler +DMA1_Stream5_IRQHandler +DMA1_Stream6_IRQHandler +ADC_IRQHandler +CAN1_TX_IRQHandler +CAN1_RX0_IRQHandler +CAN1_RX1_IRQHandler +CAN1_SCE_IRQHandler +EXTI9_5_IRQHandler +TIM1_BRK_TIM9_IRQHandler +TIM1_UP_TIM10_IRQHandler +TIM1_TRG_COM_TIM11_IRQHandler +TIM1_CC_IRQHandler +TIM2_IRQHandler +TIM3_IRQHandler +TIM4_IRQHandler +I2C1_EV_IRQHandler +I2C1_ER_IRQHandler +I2C2_EV_IRQHandler +I2C2_ER_IRQHandler +SPI1_IRQHandler +SPI2_IRQHandler +USART1_IRQHandler +USART2_IRQHandler +USART3_IRQHandler +EXTI15_10_IRQHandler +RTC_Alarm_IRQHandler +OTG_FS_WKUP_IRQHandler +TIM8_BRK_TIM12_IRQHandler +TIM8_UP_TIM13_IRQHandler +TIM8_TRG_COM_TIM14_IRQHandler +TIM8_CC_IRQHandler +DMA1_Stream7_IRQHandler +FMC_IRQHandler +SDIO_IRQHandler +TIM5_IRQHandler +SPI3_IRQHandler +UART4_IRQHandler +UART5_IRQHandler +TIM6_DAC_IRQHandler +TIM7_IRQHandler +DMA2_Stream0_IRQHandler +DMA2_Stream1_IRQHandler +DMA2_Stream2_IRQHandler +DMA2_Stream3_IRQHandler +DMA2_Stream4_IRQHandler +ETH_IRQHandler +ETH_WKUP_IRQHandler +CAN2_TX_IRQHandler +CAN2_RX0_IRQHandler +CAN2_RX1_IRQHandler +CAN2_SCE_IRQHandler +OTG_FS_IRQHandler +DMA2_Stream5_IRQHandler +DMA2_Stream6_IRQHandler +DMA2_Stream7_IRQHandler +USART6_IRQHandler +I2C3_EV_IRQHandler +I2C3_ER_IRQHandler +OTG_HS_EP1_OUT_IRQHandler +OTG_HS_EP1_IN_IRQHandler +OTG_HS_WKUP_IRQHandler +OTG_HS_IRQHandler +DCMI_IRQHandler +CRYP_IRQHandler +HASH_RNG_IRQHandler +FPU_IRQHandler + + B . + + ENDP + + ALIGN + +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap + +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, =(Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END diff --git a/UPP/UPP.ioc b/UPP/UPP.ioc index 7006a63..6d204d7 100644 --- a/UPP/UPP.ioc +++ b/UPP/UPP.ioc @@ -5,9 +5,10 @@ ADC3.Channel-17\#ChannelRegularConversion=ADC_CHANNEL_6 ADC3.Channel-18\#ChannelRegularConversion=ADC_CHANNEL_7 ADC3.Channel-19\#ChannelRegularConversion=ADC_CHANNEL_8 ADC3.Channel-20\#ChannelRegularConversion=ADC_CHANNEL_10 +ADC3.DMAContinuousRequests=ENABLE ADC3.EOCSelection=ADC_EOC_SEQ_CONV ADC3.ExternalTrigConv=ADC_EXTERNALTRIGCONV_T8_TRGO -ADC3.IPParameters=Rank-15\#ChannelRegularConversion,Channel-15\#ChannelRegularConversion,SamplingTime-15\#ChannelRegularConversion,NbrOfConversionFlag,NbrOfConversion,ScanConvMode,Rank-16\#ChannelRegularConversion,Channel-16\#ChannelRegularConversion,SamplingTime-16\#ChannelRegularConversion,Rank-17\#ChannelRegularConversion,Channel-17\#ChannelRegularConversion,SamplingTime-17\#ChannelRegularConversion,Rank-18\#ChannelRegularConversion,Channel-18\#ChannelRegularConversion,SamplingTime-18\#ChannelRegularConversion,Rank-19\#ChannelRegularConversion,Channel-19\#ChannelRegularConversion,SamplingTime-19\#ChannelRegularConversion,Rank-20\#ChannelRegularConversion,Channel-20\#ChannelRegularConversion,SamplingTime-20\#ChannelRegularConversion,ExternalTrigConv,EOCSelection +ADC3.IPParameters=Rank-15\#ChannelRegularConversion,Channel-15\#ChannelRegularConversion,SamplingTime-15\#ChannelRegularConversion,NbrOfConversionFlag,NbrOfConversion,ScanConvMode,Rank-16\#ChannelRegularConversion,Channel-16\#ChannelRegularConversion,SamplingTime-16\#ChannelRegularConversion,Rank-17\#ChannelRegularConversion,Channel-17\#ChannelRegularConversion,SamplingTime-17\#ChannelRegularConversion,Rank-18\#ChannelRegularConversion,Channel-18\#ChannelRegularConversion,SamplingTime-18\#ChannelRegularConversion,Rank-19\#ChannelRegularConversion,Channel-19\#ChannelRegularConversion,SamplingTime-19\#ChannelRegularConversion,Rank-20\#ChannelRegularConversion,Channel-20\#ChannelRegularConversion,SamplingTime-20\#ChannelRegularConversion,ExternalTrigConv,EOCSelection,DMAContinuousRequests ADC3.NbrOfConversion=6 ADC3.NbrOfConversionFlag=1 ADC3.Rank-15\#ChannelRegularConversion=1 @@ -38,7 +39,7 @@ Dma.ADC3.0.FIFOMode=DMA_FIFOMODE_DISABLE Dma.ADC3.0.Instance=DMA2_Stream0 Dma.ADC3.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD Dma.ADC3.0.MemInc=DMA_MINC_ENABLE -Dma.ADC3.0.Mode=DMA_NORMAL +Dma.ADC3.0.Mode=DMA_CIRCULAR Dma.ADC3.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD Dma.ADC3.0.PeriphInc=DMA_PINC_DISABLE Dma.ADC3.0.Priority=DMA_PRIORITY_LOW