Добавлена простенькая симуляция АЦП в сканирующем режиме.

Но надо отлаживать и сравнивать с работой реального (в плане разных режимов работы, доделать прерывания/дма, флаги и так далее)
This commit is contained in:
Razvalyaev 2025-11-09 02:06:25 +03:00
parent 61202f2a94
commit be84043f18
18 changed files with 647 additions and 181 deletions

View File

@ -0,0 +1,230 @@
#include "stm32_matlab_adc.h"
#include <string.h>
/////////////////////////////---SIMULINK FUNCTIONS---//////////////////////////
void Simulate_ADCs(void)
{
#ifdef USE_ADC1
ADC_Simulation(ADC1, &adc1s);
#endif
#ifdef USE_ADC2
ADC_Simulation(ADC2, &adc2s);
#endif
#ifdef USE_ADC3
ADC_Simulation(ADC3, &adc3s);
#endif
}
/////////////////////////////---ADC SIMULATION---/////////////////////////////
void ADC_Simulation(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
if (!(ADCx->CR2 & ADC_CR2_ADON)) return;
// Start conversion on SWSTART
if (ADCx->CR2 & ADC_CR2_SWSTART) {
ADC_Start_Conversion(ADCx, ADCS);
ADCx->CR2 &= ~ADC_CR2_SWSTART;
}
// Handle ongoing conversion - ïðîâåðÿåì ïî ôëàãó ñîñòîÿíèÿ
if (ADCS->conversion_time_elapsed >= 0) {
ADCS->conversion_time_elapsed += ADCS->simulation_step;
double total_time = ADC_Get_Total_Conversion_Time(ADCx, ADCS);
if (ADCS->conversion_time_elapsed >= total_time) {
ADC_Complete_Conversion(ADCx, ADCS);
// Continuous mode auto-restart
if (ADCx->CR2 & ADC_CR2_CONT) {
ADC_Start_Conversion(ADCx, ADCS);
}
}
}
}
void ADC_Start_Conversion(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
// Îïðåäåëÿåì êàíàë äëÿ êîíâåðñèè
if (ADCx->CR1 & ADC_CR1_SCAN) {
// Ðåæèì ñêàíèðîâàíèÿ
ADCS->current_rank = 0;
ADCS->current_channel = ADC_Get_Sequence_Channel(ADCx, 0);
}
else {
// Îäèíî÷íûé êàíàë
ADCS->current_channel = ADC_Get_Sequence_Channel(ADCx, 0);
}
ADCS->conversion_time_elapsed = 0;
}
void ADC_Complete_Conversion(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
// Êîíâåðòèðóåì àíàëîãîâîå çíà÷åíèå â öèôðîâîå
double analog_val = 0;
if (ADCS->channel_connected[ADCS->current_channel]) {
analog_val = ADCS->channel_values[ADCS->current_channel];
}
if (analog_val < 0)
analog_val = 0;
if (analog_val > 3.3)
analog_val = 3.3;
// Ñíà÷àëà âû÷èñëÿåì çíà÷åíèå ÀÖÏ
ADCS->last_conversion_value = (uint16_t)((analog_val / 3.3) * 4095.0);
// Ïîòîì äîáàâëÿåì øóì â LSB
int32_t noisy_value = (int32_t)ADCS->last_conversion_value + (rand() % (2 * ADC_NOISE_LSB + 1)) - ADC_NOISE_LSB;
// Ñàòóðàöèÿ öèôðîâîãî çíà÷åíèÿ
if (noisy_value < 0) noisy_value = 0;
if (noisy_value > 4095) noisy_value = 4095;
ADCS->last_conversion_value = (uint16_t)noisy_value;
// Çàïèñûâàåì â DR
ADCx->DR = ADCS->last_conversion_value;
// Óñòàíàâëèâàåì ôëàã EOC
ADCx->SR |= ADC_SR_EOC;
// Îáðàáîòêà DMA
if (ADCx->CR2 & ADC_CR2_DMA) {
ADC_DMA_Transfer(ADCx, ADCS);
}
// Îáðàáîòêà ñêàíèðîâàíèÿ
if (ADCx->CR1 & ADC_CR1_SCAN) {
ADCS->current_rank++;
uint32_t seq_len = ADC_Get_Sequence_Length(ADCx);
if (ADCS->current_rank < seq_len) {
// Ñëåäóþùèé êàíàë â ïîñëåäîâàòåëüíîñòè
ADCS->current_channel = ADC_Get_Sequence_Channel(ADCx, ADCS->current_rank);
ADCS->conversion_time_elapsed = 0;
return;
}
else {
// Êîíåö ïîñëåäîâàòåëüíîñòè
#ifdef ADC_SR_EOS
ADCx->SR |= ADC_SR_EOS;
#endif
}
}
ADCS->conversion_time_elapsed = 0;
}
/////////////////////////////---REGISTER-BASED FUNCTIONS---///////////////////
double ADC_Get_Total_Conversion_Time(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
// Ïîëó÷àåì sampling time èç ðåãèñòðîâ
uint32_t sampling_cycles = ADC_Get_Sampling_Cycles(ADCx, ADCS->current_channel);
// Conversion cycles ôèêñèðîâàíû äëÿ ðàçðåøåíèÿ
uint32_t conversion_cycles = 12; // Äëÿ 12-bit
double total_cycles = sampling_cycles + conversion_cycles;
double adc_clock = ADCS->adc_clock_freq; // ×àñòîòà øèíû
return total_cycles / adc_clock;
}
uint32_t ADC_Get_Sampling_Cycles(ADC_TypeDef* ADCx, uint32_t channel)
{
// Ïîëó÷àåì sampling time èç SMPR1/SMPR2
uint32_t smpr_code;
if (channel <= 9) {
smpr_code = (ADCx->SMPR2 >> (channel * 3)) & 0x7;
}
else {
smpr_code = (ADCx->SMPR1 >> ((channel - 10) * 3)) & 0x7;
}
// Convert SMPR code to actual cycles
static const uint32_t cycles_map[8] = { 3, 15, 28, 56, 84, 112, 144, 480 };
return (smpr_code < 8) ? cycles_map[smpr_code] : 3;
}
uint32_t ADC_Get_Sequence_Length(ADC_TypeDef* ADCx)
{
#ifdef ADC_SQR1_L
return ((ADCx->SQR1 & ADC_SQR1_L) >> ADC_SQR1_L_Pos) + 1;
#else
return ((ADCx->SQR1 & 0x00F00000) >> 20) + 1;
#endif
}
uint32_t ADC_Get_Sequence_Channel(ADC_TypeDef* ADCx, uint32_t rank)
{
if (rank > 15) return 0;
if (rank < 6) {
return (ADCx->SQR3 >> (rank * 5)) & 0x1F;
}
else if (rank < 12) {
return (ADCx->SQR2 >> ((rank - 6) * 5)) & 0x1F;
}
else {
return (ADCx->SQR1 >> ((rank - 12) * 5)) & 0x1F;
}
}
/////////////////////////////---DMA FUNCTIONS---///////////////////////////////
void ADC_DMA_Transfer(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS)
{
if (!ADCS->dma_buffer || ADCS->dma_buffer_size == 0) return;
ADCS->dma_buffer[ADCS->dma_current_index] = ADCx->DR;
ADCS->dma_current_index++;
if (ADCS->dma_current_index >= ADCS->dma_buffer_size) {
if (ADCS->dma_circular) {
ADCS->dma_current_index = 0;
}
}
}
/////////////////////////////---CHANNEL FUNCTIONS---///////////////////////////
void ADC_Set_Channel_Value(ADC_TypeDef* ADCx, uint32_t channel, double voltage)
{
#ifdef USE_ADC1
if (ADCx == ADC1 && channel < 19) {
adc1s.channel_values[channel] = voltage;
adc1s.channel_connected[channel] = 1;
}
#endif
#ifdef USE_ADC2
if (ADCx == ADC2 && channel < 19) {
adc2s.channel_values[channel] = voltage;
adc2s.channel_connected[channel] = 1;
}
#endif
#ifdef USE_ADC3
if (ADCx == ADC3 && channel < 19) {
adc3s.channel_values[channel] = voltage;
adc3s.channel_connected[channel] = 1;
}
#endif
}
/////////////////////////////---INITIALIZATION---/////////////////////////////
void ADC_SIM_DEINIT(void)
{
#ifdef USE_ADC1
memset(&adc1s, 0, sizeof(adc1s));
#endif
#ifdef USE_ADC2
memset(&adc2s, 0, sizeof(adc2s));
#endif
#ifdef USE_ADC3
memset(&adc3s, 0, sizeof(adc3s));
#endif
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,56 @@
#ifndef _MATLAB_ADC_H_
#define _MATLAB_ADC_H_
#include "stm32_matlab_conf.h"
#ifdef STM32F1
#define ADC_NOISE_LSB 10 // Шум в LSB (квантах АЦП)
#endif
#ifdef STM32F4
#define ADC_NOISE_LSB 2 // Шум в LSB (квантах АЦП)
#endif
/////////////////////////////---STRUCTURES---///////////////////////////
struct ADC_Sim
{
double conversion_time_elapsed;
uint32_t current_channel;
uint32_t current_rank;
uint16_t last_conversion_value;
double channel_values[19];
uint8_t channel_connected[19];
// DMA
uint32_t* dma_buffer;
uint32_t dma_buffer_size;
uint32_t dma_current_index;
uint8_t dma_circular;
// Timing
double simulation_step;
double adc_clock_freq;
};
///////////////////////////////////////////////////////////////////////
///////////////////////////---FUNCTIONS---///////////////////////////
void Simulate_ADCs(void);
void ADC_Simulation(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS);
void ADC_Start_Conversion(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS);
void ADC_Complete_Conversion(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS);
double ADC_Get_Total_Conversion_Time(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS);
uint32_t ADC_Get_Sampling_Cycles(ADC_TypeDef* ADCx, uint32_t channel);
uint32_t ADC_Get_Sequence_Length(ADC_TypeDef* ADCx);
uint32_t ADC_Get_Sequence_Channel(ADC_TypeDef* ADCx, uint32_t rank);
void ADC_DMA_Transfer(ADC_TypeDef* ADCx, struct ADC_Sim* ADCS);
void ADC_Set_Channel_Value(ADC_TypeDef* ADCx, uint32_t channel, double voltage);
void ADC_SIM_DEINIT(void);
///////////////////////////////////////////////////////////////////////
#endif // _MATLAB_ADC_H_

View File

@ -16,11 +16,21 @@ MCU_CortexMemoryTypeDef MCU_CORTEX_MEM;
void Initialize_Periph_Sim(void) void Initialize_Periph_Sim(void)
{ {
Init_TIM_SIM(); Init_TIM_SIM();
Init_ADC_SIM();
} }
// MCU PERIPH SIM
void Simulate_Periph_Sim(void)
{
Simulate_TIMs();
Simulate_ADCs();
}
// MCU PERIPH DEINIT // MCU PERIPH DEINIT
void deInitialize_Periph_Sim(void) void deInitialize_Periph_Sim(void)
{ {
TIM_SIM_DEINIT(); TIM_SIM_DEINIT();
ADC_SIM_DEINIT();
} }
// MCU DEINIT // MCU DEINIT
void deInitialize_MCU(void) void deInitialize_MCU(void)
@ -85,6 +95,7 @@ struct TIM_Sim tim14s;
void Init_TIM_SIM(void) void Init_TIM_SIM(void)
{ {
#ifdef USE_TIM1 #ifdef USE_TIM1
memset(&tim1s, 0, sizeof(tim1s));
tim1s.tx_cnt = TIM1->CNT; tim1s.tx_cnt = TIM1->CNT;
tim1s.tx_step = hmcu.sSimSampleTime * ABP2_TIMS_Value; tim1s.tx_step = hmcu.sSimSampleTime * ABP2_TIMS_Value;
@ -98,6 +109,7 @@ void Init_TIM_SIM(void)
tim1s.Channels.OC4_PIN_SHIFT = 11; tim1s.Channels.OC4_PIN_SHIFT = 11;
#endif #endif
#ifdef USE_TIM2 #ifdef USE_TIM2
memset(&tim2s, 0, sizeof(tim2s));
tim2s.tx_cnt = TIM2->CNT; tim2s.tx_cnt = TIM2->CNT;
tim2s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value; tim2s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
@ -111,6 +123,7 @@ void Init_TIM_SIM(void)
tim2s.Channels.OC4_PIN_SHIFT = 3; tim2s.Channels.OC4_PIN_SHIFT = 3;
#endif #endif
#ifdef USE_TIM3 #ifdef USE_TIM3
memset(&tim3s, 0, sizeof(tim3s));
tim3s.tx_cnt = TIM3->CNT; tim3s.tx_cnt = TIM3->CNT;
tim3s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value; tim3s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
@ -124,6 +137,7 @@ void Init_TIM_SIM(void)
tim3s.Channels.OC4_PIN_SHIFT = 9; tim3s.Channels.OC4_PIN_SHIFT = 9;
#endif #endif
#ifdef USE_TIM4 #ifdef USE_TIM4
memset(&tim4s, 0, sizeof(tim4s));
tim4s.tx_cnt = TIM4->CNT; tim4s.tx_cnt = TIM4->CNT;
tim4s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value; tim4s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
@ -137,6 +151,7 @@ void Init_TIM_SIM(void)
tim4s.Channels.OC4_PIN_SHIFT = 9; tim4s.Channels.OC4_PIN_SHIFT = 9;
#endif #endif
#ifdef USE_TIM5 #ifdef USE_TIM5
memset(&tim5s, 0, sizeof(tim5s));
tim5s.tx_cnt = TIM5->CNT; tim5s.tx_cnt = TIM5->CNT;
tim5s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value; tim5s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
@ -150,6 +165,7 @@ void Init_TIM_SIM(void)
tim5s.Channels.OC4_PIN_SHIFT = 3; tim5s.Channels.OC4_PIN_SHIFT = 3;
#endif #endif
#ifdef USE_TIMx #ifdef USE_TIMx
memset(&tim6s, 0, sizeof(tim6s));
tim6s.tx_cnt = TIMx->CNT; tim6s.tx_cnt = TIMx->CNT;
tim6s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value; tim6s.tx_step = hmcu.sSimSampleTime * ABP1_TIMS_Value;
@ -165,3 +181,39 @@ void Init_TIM_SIM(void)
} }
/*-------------------------------TIMERS----------------------------------*/ /*-------------------------------TIMERS----------------------------------*/
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
/*---------------------------------ADC-----------------------------------*/
#ifdef USE_ADC1
struct ADC_Sim adc1s;
#endif
#ifdef USE_ADC2
struct ADC_Sim adc2s;
#endif
#ifdef USE_ADC3
struct ADC_Sim adc3s;
#endif
void Init_ADC_SIM(void)
{
#ifdef USE_ADC1
memset(&adc1s, 0, sizeof(adc1s));
adc1s.simulation_step = hmcu.sSimSampleTime;
adc1s.adc_clock_freq = ABP2_Value; // Частота APB2
#endif
#ifdef USE_ADC2
memset(&adc2s, 0, sizeof(adc2s));
adc2s.simulation_step = hmcu.sSimSampleTime;
adc2s.adc_clock_freq = ABP2_Value; // Частота APB2
#endif
#ifdef USE_ADC3
memset(&adc3s, 0, sizeof(adc3s));
adc3s.simulation_step = hmcu.sSimSampleTime;
adc3s.adc_clock_freq = ABP2_Value; // Частота APB2
#endif
}
/*---------------------------------ADC-----------------------------------*/
//-----------------------------------------------------------------------//

View File

@ -54,13 +54,13 @@
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
/*------------------------------FUNCTIONS--------------------------------*/ /*------------------------------FUNCTIONS--------------------------------*/
void deInitialize_Periph_Sim(void); void deInitialize_Periph_Sim(void);
void Simulate_Periph_Sim(void);
void deInitialize_MCU(void); void deInitialize_MCU(void);
void Initialize_Periph_Sim(void); void Initialize_Periph_Sim(void);
#include "stm32_matlab_rcc.h" #include "stm32_matlab_rcc.h"
#include "stm32_matlab_gpio.h" #include "stm32_matlab_gpio.h"
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
/*-------------------------------TIMERS----------------------------------*/ /*-------------------------------TIMERS----------------------------------*/
//#if defined(USE_TIM1) || defined(USE_TIM2) || defined(USE_TIM3) || defined(USE_TIM4) || defined(USE_TIM5) || \ //#if defined(USE_TIM1) || defined(USE_TIM2) || defined(USE_TIM3) || defined(USE_TIM4) || defined(USE_TIM5) || \
@ -116,4 +116,22 @@ extern struct TIM_Sim tim14s;
/*-------------------------------TIMERS----------------------------------*/ /*-------------------------------TIMERS----------------------------------*/
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//
//-----------------------------------------------------------------------//
/*---------------------------------ADC-----------------------------------*/
#include "stm32_matlab_adc.h"
#ifdef USE_ADC1
extern struct ADC_Sim adc1s;
#endif
#ifdef USE_ADC2
extern struct ADC_Sim adc2s;
#endif
#ifdef USE_ADC3
extern struct ADC_Sim adc3s;
#endif
/*---------------------------------ADC-----------------------------------*/
//-----------------------------------------------------------------------//
#endif // _MATLAB_SETUP_H_ #endif // _MATLAB_SETUP_H_

View File

@ -16,8 +16,7 @@
], ],
"PeriphSimulation": [ "PeriphSimulation": [
"uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000)", "uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000)",
"Simulate_TIMs()", "Simulate_Periph_Sim()"
"Simulate_GPIO_BSRR()"
], ],
"PeriphDeinit": [ "PeriphDeinit": [
"deInitialize_Periph_Sim()" "deInitialize_Periph_Sim()"
@ -56,7 +55,7 @@
"Tab_ADC_Enable": { "Tab_ADC_Enable": {
"Prompt": "Enable ADCs", "Prompt": "Enable ADCs",
"Type": "checkbox", "Type": "checkbox",
"Default": false, "Default": true,
"NewRow": true "NewRow": true
} }
} }
@ -583,17 +582,27 @@
} }
}, },
"ADC": { "ADC": {
"Sources": [
"Drivers/STM32_SIMULINK/stm32_matlab_adc.c"
],
"Defines": { "Defines": {
"ADC1_Enable": { "ADC1_Enable": {
"Prompt": "ADC1 Enable", "Prompt": "ADC1 Enable",
"Def": "ADC1_ENABLE", "Def": "USE_ADC1",
"Type": "checkbox", "Type": "checkbox",
"Default": false, "Default": true,
"NewRow": true "NewRow": true
}, },
"ADC2_Enable": { "ADC2_Enable": {
"Prompt": "ADC2 Enable", "Prompt": "ADC2 Enable",
"Def": "ADC2_ENABLE", "Def": "USE_ADC2",
"Type": "checkbox",
"Default": false,
"NewRow": true
},
"ADC3_Enable": {
"Prompt": "ADC3 Enable",
"Def": "USE_ADC3",
"Type": "checkbox", "Type": "checkbox",
"Default": false, "Default": false,
"NewRow": true "NewRow": true

View File

@ -197,23 +197,23 @@ static void mdlTerminate(SimStruct* S)
//// Простая версия - ждем завершения потока //// Простая версия - ждем завершения потока
// Ждем до 5 секунд //// Ждем до 5 секунд
for (int i = 0; i < 50; i++) { //for (int i = 0; i < 50; i++) {
// Проверяем, завершился ли поток (упрощенная проверка) // // Проверяем, завершился ли поток (упрощенная проверка)
DWORD exitCode; // DWORD exitCode;
if (GetExitCodeThread(hmcu.hMCUThread, &exitCode) && exitCode != STILL_ACTIVE) { // if (GetExitCodeThread(hmcu.hMCUThread, &exitCode) && exitCode != STILL_ACTIVE) {
break; // поток завершился // break; // поток завершился
}
Sleep(100); // ждем 100ms
}
//// Даем потоку шанс завершиться нормально
//DWORD waitResult = WaitForSingleObject(hmcu.hMCUThread, 3000);
//if (waitResult == WAIT_TIMEOUT) {
// // Поток не ответил - завершаем принудительно
// TerminateThread(hmcu.hMCUThread, 0);
// } // }
// Sleep(100); // ждем 100ms
//}
// Даем потоку шанс завершиться нормально
DWORD waitResult = WaitForSingleObject(hmcu.hMCUThread, 10000);
if (waitResult == WAIT_TIMEOUT) {
// Поток не ответил - завершаем принудительно
TerminateThread(hmcu.hMCUThread, 0);
}
CloseHandle(hmcu.hMCUThread); CloseHandle(hmcu.hMCUThread);
hmcu.hMCUThread = NULL; hmcu.hMCUThread = NULL;

View File

@ -114,8 +114,7 @@ void MCU_Periph_Simulation(SimStruct* S)
{ {
// PERIPH SIM START // PERIPH SIM START
uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000); uwTick = hmcu.SystemClock / (MCU_CORE_CLOCK / 1000);
Simulate_TIMs(); Simulate_Periph_Sim();
Simulate_GPIO_BSRR();
// PERIPH SIM END // PERIPH SIM END
} }

View File

@ -51,11 +51,11 @@
// INPUT/OUTPUTS PARAMS START // INPUT/OUTPUTS PARAMS START
#define IN_PORT_NUMB 2 #define IN_PORT_NUMB 2
#define ADC_PORT_1_WIDTH 6 #define ADC_PORT_1_WIDTH 6
#define IN_PORT_2_WIDTH 16 #define IN_PORT_2_WIDTH 1
#define OUT_PORT_NUMB 2 #define OUT_PORT_NUMB 2
#define THYR_PORT_1_WIDTH 6 #define THYR_PORT_1_WIDTH 6
#define OUT_PORT_2_WIDTH 16 #define OUT_PORT_2_WIDTH 1
// INPUT/OUTPUTS PARAMS END // INPUT/OUTPUTS PARAMS END
/** WRAPPER_CONF /** WRAPPER_CONF

View File

@ -13,6 +13,7 @@
//#include "stm32_matlab_conf.h" //#include "stm32_matlab_conf.h"
#include "main.h" #include "main.h"
#include "tim.h" #include "tim.h"
#include "adc.h"
// INCLUDES END // INCLUDES END
#endif //_APP_INCLUDES_H_ #endif //_APP_INCLUDES_H_

View File

@ -21,6 +21,8 @@ void app_init(void) {
MX_TIM3_Init(); MX_TIM3_Init();
__HAL_TIM_SET_COMPARE(&hpwm1, PWM_CHANNEL_1, __HAL_TIM_GET_AUTORELOAD(&hpwm1)/2); __HAL_TIM_SET_COMPARE(&hpwm1, PWM_CHANNEL_1, __HAL_TIM_GET_AUTORELOAD(&hpwm1)/2);
HAL_TIM_PWM_Start(&hpwm1, PWM_CHANNEL_1); HAL_TIM_PWM_Start(&hpwm1, PWM_CHANNEL_1);
MX_ADC1_Init();
HAL_ADC_Start(&hadc1);
// USER APP INIT END // USER APP INIT END
} }

View File

@ -32,7 +32,7 @@ void ThyristorWrite(real_T* Buffer)
*/ */
void app_readInputs(const real_T* Buffer) { void app_readInputs(const real_T* Buffer) {
// USER APP INPUT START // USER APP INPUT START
ADC_Set_Channel_Value(ADC1, 0, ReadInputArray(1,0));
// USER APP INPUT END // USER APP INPUT END
} }
@ -44,5 +44,6 @@ void app_readInputs(const real_T* Buffer) {
void app_writeOutputBuffer(real_T* Buffer) { void app_writeOutputBuffer(real_T* Buffer) {
// USER APP OUTPUT START // USER APP OUTPUT START
ThyristorWrite(Buffer); ThyristorWrite(Buffer);
WriteOutputArray(ADC1->DR, 1, 0);
// USER APP OUTPUT END // USER APP OUTPUT END
} }

Binary file not shown.

View File

@ -32,12 +32,15 @@ extern "C" {
/* USER CODE END Includes */ /* USER CODE END Includes */
extern ADC_HandleTypeDef hadc1;
extern ADC_HandleTypeDef hadc3; extern ADC_HandleTypeDef hadc3;
/* USER CODE BEGIN Private defines */ /* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */ /* USER CODE END Private defines */
void MX_ADC1_Init(void);
void MX_ADC3_Init(void); void MX_ADC3_Init(void);
/* USER CODE BEGIN Prototypes */ /* USER CODE BEGIN Prototypes */

View File

@ -24,8 +24,56 @@
/* USER CODE END 0 */ /* USER CODE END 0 */
ADC_HandleTypeDef hadc1;
ADC_HandleTypeDef hadc3; ADC_HandleTypeDef hadc3;
/* ADC1 init function */
void MX_ADC1_Init(void)
{
/* USER CODE BEGIN ADC1_Init 0 */
/* USER CODE END ADC1_Init 0 */
ADC_ChannelConfTypeDef sConfig = {0};
/* USER CODE BEGIN ADC1_Init 1 */
/* USER CODE END ADC1_Init 1 */
/** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
*/
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = DISABLE;
hadc1.Init.ContinuousConvMode = ENABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
Error_Handler();
}
/** Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
*/
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN ADC1_Init 2 */
/* USER CODE END ADC1_Init 2 */
}
/* ADC3 init function */ /* ADC3 init function */
void MX_ADC3_Init(void) void MX_ADC3_Init(void)
{ {
@ -78,7 +126,28 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
{ {
GPIO_InitTypeDef GPIO_InitStruct = {0}; GPIO_InitTypeDef GPIO_InitStruct = {0};
if(adcHandle->Instance==ADC3) if(adcHandle->Instance==ADC1)
{
/* USER CODE BEGIN ADC1_MspInit 0 */
/* USER CODE END ADC1_MspInit 0 */
/* ADC1 clock enable */
__HAL_RCC_ADC1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/**ADC1 GPIO Configuration
PA0/WKUP ------> ADC1_IN0
*/
GPIO_InitStruct.Pin = GPIO_PIN_0;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE BEGIN ADC1_MspInit 1 */
/* USER CODE END ADC1_MspInit 1 */
}
else if(adcHandle->Instance==ADC3)
{ {
/* USER CODE BEGIN ADC3_MspInit 0 */ /* USER CODE BEGIN ADC3_MspInit 0 */
@ -116,7 +185,24 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle) void HAL_ADC_MspDeInit(ADC_HandleTypeDef* adcHandle)
{ {
if(adcHandle->Instance==ADC3) if(adcHandle->Instance==ADC1)
{
/* USER CODE BEGIN ADC1_MspDeInit 0 */
/* USER CODE END ADC1_MspDeInit 0 */
/* Peripheral clock disable */
__HAL_RCC_ADC1_CLK_DISABLE();
/**ADC1 GPIO Configuration
PA0/WKUP ------> ADC1_IN0
*/
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0);
/* USER CODE BEGIN ADC1_MspDeInit 1 */
/* USER CODE END ADC1_MspDeInit 1 */
}
else if(adcHandle->Instance==ADC3)
{ {
/* USER CODE BEGIN ADC3_MspDeInit 0 */ /* USER CODE BEGIN ADC3_MspDeInit 0 */

View File

@ -104,6 +104,7 @@ int main(void)
MX_SPI3_Init(); MX_SPI3_Init();
MX_TIM11_Init(); MX_TIM11_Init();
MX_TIM12_Init(); MX_TIM12_Init();
MX_ADC1_Init();
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
#else #else
MX_TIM1_Init(); MX_TIM1_Init();

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8"?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd"> <ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion> <SchemaVersion>1.0</SchemaVersion>
@ -45,7 +45,7 @@
<PageWidth>79</PageWidth> <PageWidth>79</PageWidth>
<PageLength>66</PageLength> <PageLength>66</PageLength>
<TabStop>8</TabStop> <TabStop>8</TabStop>
<ListingPath></ListingPath> <ListingPath />
</OPTLEX> </OPTLEX>
<ListingPage> <ListingPage>
<CreateCListing>1</CreateCListing> <CreateCListing>1</CreateCListing>
@ -104,16 +104,16 @@
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>6</nTsel> <nTsel>6</nTsel>
<sDll></sDll> <sDll />
<sDllPa></sDllPa> <sDllPa />
<sDlgDll></sDlgDll> <sDlgDll />
<sDlgPa></sDlgPa> <sDlgPa />
<sIfile></sIfile> <sIfile />
<tDll></tDll> <tDll />
<tDllPa></tDllPa> <tDllPa />
<tDlgDll></tDlgDll> <tDlgDll />
<tDlgPa></tDlgPa> <tDlgPa />
<tIfile></tIfile> <tIfile />
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon> <pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
@ -158,19 +158,19 @@
<newCpu>0</newCpu> <newCpu>0</newCpu>
<uProt>0</uProt> <uProt>0</uProt>
</DebugFlag> </DebugFlag>
<LintExecutable></LintExecutable> <LintExecutable />
<LintConfigFile></LintConfigFile> <LintConfigFile />
<bLintAuto>0</bLintAuto> <bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD> <bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags> <LntExFlags>0</LntExFlags>
<pMisraName></pMisraName> <pMisraName />
<pszMrule></pszMrule> <pszMrule />
<pSingCmds></pSingCmds> <pSingCmds />
<pMultCmds></pMultCmds> <pMultCmds />
<pMisraNamep></pMisraNamep> <pMisraNamep />
<pszMrulep></pszMrulep> <pszMrulep />
<pSingCmdsp></pSingCmdsp> <pSingCmdsp />
<pMultCmdsp></pMultCmdsp> <pMultCmdsp />
<DebugDescription> <DebugDescription>
<Enable>1</Enable> <Enable>1</Enable>
<EnableFlashSeq>1</EnableFlashSeq> <EnableFlashSeq>1</EnableFlashSeq>

View File

@ -1,10 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd"> <Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion> <SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header> <Header>### uVision Project, (C) Keil Software</Header>
<Targets> <Targets>
<Target> <Target>
<TargetName>UPP</TargetName> <TargetName>UPP</TargetName>
@ -20,28 +17,28 @@
<PackID>Keil.STM32F4xx_DFP.2.16.0</PackID> <PackID>Keil.STM32F4xx_DFP.2.16.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL> <PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x2002FFFF) IRAM2(0x10000000-0x1000FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") TZ</Cpu> <Cpu>IRAM(0x20000000-0x2002FFFF) IRAM2(0x10000000-0x1000FFFF) IROM(0x8000000-0x80FFFFF) CLOCK(25000000) FPU2 CPUTYPE("Cortex-M4") TZ</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec />
<StartupFile></StartupFile> <StartupFile />
<FlashDriverDll></FlashDriverDll> <FlashDriverDll />
<DeviceId>0</DeviceId> <DeviceId>0</DeviceId>
<RegisterFile></RegisterFile> <RegisterFile />
<MemoryEnv></MemoryEnv> <MemoryEnv />
<Cmp></Cmp> <Cmp />
<Asm></Asm> <Asm />
<Linker></Linker> <Linker />
<OHString></OHString> <OHString />
<InfinionOptionDll></InfinionOptionDll> <InfinionOptionDll />
<SLE66CMisc></SLE66CMisc> <SLE66CMisc />
<SLE66AMisc></SLE66AMisc> <SLE66AMisc />
<SLE66LinkerMisc></SLE66LinkerMisc> <SLE66LinkerMisc />
<SFDFile>$$Device:STM32F427ZGTx$CMSIS\SVD\STM32F427x.svd</SFDFile> <SFDFile>$$Device:STM32F427ZGTx$CMSIS\SVD\STM32F427x.svd</SFDFile>
<bCustSvd>0</bCustSvd> <bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv> <UseEnv>0</UseEnv>
<BinPath></BinPath> <BinPath />
<IncludePath></IncludePath> <IncludePath />
<LibPath></LibPath> <LibPath />
<RegisterFilePath></RegisterFilePath> <RegisterFilePath />
<DBRegisterFilePath></DBRegisterFilePath> <DBRegisterFilePath />
<TargetStatus> <TargetStatus>
<Error>0</Error> <Error>0</Error>
<ExitCodeStop>0</ExitCodeStop> <ExitCodeStop>0</ExitCodeStop>
@ -56,15 +53,15 @@
<CreateHexFile>1</CreateHexFile> <CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation> <DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation> <BrowseInformation>1</BrowseInformation>
<ListingPath></ListingPath> <ListingPath />
<HexFormatSelection>1</HexFormatSelection> <HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K> <Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile> <CreateBatchFile>0</CreateBatchFile>
<BeforeCompile> <BeforeCompile>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name> <UserProg1Name />
<UserProg2Name></UserProg2Name> <UserProg2Name />
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X> <nStopU1X>0</nStopU1X>
@ -73,8 +70,8 @@
<BeforeMake> <BeforeMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name> <UserProg1Name />
<UserProg2Name></UserProg2Name> <UserProg2Name />
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X> <nStopB1X>0</nStopB1X>
@ -83,15 +80,15 @@
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>0</RunUserProg1>
<RunUserProg2>1</RunUserProg2> <RunUserProg2>1</RunUserProg2>
<UserProg1Name></UserProg1Name> <UserProg1Name />
<UserProg2Name></UserProg2Name> <UserProg2Name />
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode> <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X> <nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X> <nStopA2X>0</nStopA2X>
</AfterMake> </AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild> <SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString> <SVCSIdString />
</TargetCommonOption> </TargetCommonOption>
<CommonProperty> <CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler> <UseCPPCompiler>0</UseCPPCompiler>
@ -105,8 +102,8 @@
<AssembleAssemblyFile>0</AssembleAssemblyFile> <AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly> <PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode> <StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument> <CustomArgument />
<IncludeLibraryModules></IncludeLibraryModules> <IncludeLibraryModules />
<ComprImg>0</ComprImg> <ComprImg>0</ComprImg>
</CommonProperty> </CommonProperty>
<DllOption> <DllOption>
@ -139,11 +136,11 @@
</Flash1> </Flash1>
<bUseTDR>1</bUseTDR> <bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2V8M.DLL</Flash2> <Flash2>BIN\UL2V8M.DLL</Flash2>
<Flash3></Flash3> <Flash3 />
<Flash4></Flash4> <Flash4 />
<pFcarmOut></pFcarmOut> <pFcarmOut />
<pFcarmGrp></pFcarmGrp> <pFcarmGrp />
<pFcArmRoot></pFcArmRoot> <pFcArmRoot />
<FcArmLst>0</FcArmLst> <FcArmLst>0</FcArmLst>
</Utilities> </Utilities>
<TargetArmAds> <TargetArmAds>
@ -176,7 +173,7 @@
<RvctClst>0</RvctClst> <RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst> <GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType> <AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName></RvctDeviceName> <RvctDeviceName />
<mOS>0</mOS> <mOS>0</mOS>
<uocRom>0</uocRom> <uocRom>0</uocRom>
<uocRam>0</uocRam> <uocRam>0</uocRam>
@ -311,7 +308,7 @@
<Size>0x10000</Size> <Size>0x10000</Size>
</OCR_RVCT10> </OCR_RVCT10>
</OnChipMemories> </OnChipMemories>
<RvctStartVector></RvctStartVector> <RvctStartVector />
</ArmAdsMisc> </ArmAdsMisc>
<Cads> <Cads>
<interw>1</interw> <interw>1</interw>
@ -338,9 +335,9 @@
<v6WtE>0</v6WtE> <v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti> <v6Rtti>0</v6Rtti>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls />
<Define>USE_HAL_DRIVER,STM32F427xx</Define> <Define>USE_HAL_DRIVER,STM32F427xx</Define>
<Undefine></Undefine> <Undefine />
<IncludePath>../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</IncludePath> <IncludePath>../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</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
@ -356,10 +353,10 @@
<useXO>0</useXO> <useXO>0</useXO>
<ClangAsOpt>1</ClangAsOpt> <ClangAsOpt>1</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls />
<Define></Define> <Define />
<Undefine></Undefine> <Undefine />
<IncludePath></IncludePath> <IncludePath />
</VariousControls> </VariousControls>
</Aads> </Aads>
<LDads> <LDads>
@ -369,15 +366,15 @@
<noStLib>0</noStLib> <noStLib>0</noStLib>
<RepFail>1</RepFail> <RepFail>1</RepFail>
<useFile>0</useFile> <useFile>0</useFile>
<TextAddressRange></TextAddressRange> <TextAddressRange />
<DataAddressRange></DataAddressRange> <DataAddressRange />
<pXoBase></pXoBase> <pXoBase />
<ScatterFile></ScatterFile> <ScatterFile />
<IncludeLibs></IncludeLibs> <IncludeLibs />
<IncludeLibsPath></IncludeLibsPath> <IncludeLibsPath />
<Misc></Misc> <Misc />
<LinkerInputFile></LinkerInputFile> <LinkerInputFile />
<DisabledWarnings></DisabledWarnings> <DisabledWarnings />
</LDads> </LDads>
</TargetArmAds> </TargetArmAds>
</TargetOption> </TargetOption>
@ -796,7 +793,6 @@
</Groups> </Groups>
</Target> </Target>
</Targets> </Targets>
<RTE> <RTE>
<apis /> <apis />
<components> <components>
@ -815,7 +811,6 @@
</components> </components>
<files /> <files />
</RTE> </RTE>
<LayerInfo> <LayerInfo>
<Layers> <Layers>
<Layer> <Layer>
@ -824,5 +819,5 @@
</Layer> </Layer>
</Layers> </Layers>
</LayerInfo> </LayerInfo>
</Project> </Project>

View File

@ -1,6 +1,14 @@
#MicroXplorer Configuration settings - do not modify #MicroXplorer Configuration settings - do not modify
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_0
ADC1.ContinuousConvMode=ENABLE
ADC1.IPParameters=Rank-1\#ChannelRegularConversion,master,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,NbrOfConversionFlag,ContinuousConvMode
ADC1.NbrOfConversionFlag=1
ADC1.Rank-1\#ChannelRegularConversion=1
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
ADC1.master=1
ADC3.Channel-15\#ChannelRegularConversion=ADC_CHANNEL_7 ADC3.Channel-15\#ChannelRegularConversion=ADC_CHANNEL_7
ADC3.IPParameters=Rank-15\#ChannelRegularConversion,Channel-15\#ChannelRegularConversion,SamplingTime-15\#ChannelRegularConversion,NbrOfConversionFlag ADC3.IPParameters=Rank-15\#ChannelRegularConversion,Channel-15\#ChannelRegularConversion,SamplingTime-15\#ChannelRegularConversion,NbrOfConversionFlag,NbrOfConversion
ADC3.NbrOfConversion=1
ADC3.NbrOfConversionFlag=1 ADC3.NbrOfConversionFlag=1
ADC3.Rank-15\#ChannelRegularConversion=1 ADC3.Rank-15\#ChannelRegularConversion=1
ADC3.SamplingTime-15\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES ADC3.SamplingTime-15\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
@ -21,22 +29,23 @@ IWDG.Prescaler=IWDG_PRESCALER_32
KeepUserPlacement=false KeepUserPlacement=false
Mcu.CPN=STM32F427ZGT6 Mcu.CPN=STM32F427ZGT6
Mcu.Family=STM32F4 Mcu.Family=STM32F4
Mcu.IP0=ADC3 Mcu.IP0=ADC1
Mcu.IP1=CAN1 Mcu.IP1=ADC3
Mcu.IP10=TIM11 Mcu.IP10=TIM3
Mcu.IP11=TIM12 Mcu.IP11=TIM11
Mcu.IP12=TIM13 Mcu.IP12=TIM12
Mcu.IP13=USART3 Mcu.IP13=TIM13
Mcu.IP14=USART6 Mcu.IP14=USART3
Mcu.IP2=IWDG Mcu.IP15=USART6
Mcu.IP3=NVIC Mcu.IP2=CAN1
Mcu.IP4=RCC Mcu.IP3=IWDG
Mcu.IP5=RTC Mcu.IP4=NVIC
Mcu.IP6=SPI3 Mcu.IP5=RCC
Mcu.IP7=SYS Mcu.IP6=RTC
Mcu.IP8=TIM1 Mcu.IP7=SPI3
Mcu.IP9=TIM3 Mcu.IP8=SYS
Mcu.IPNb=15 Mcu.IP9=TIM1
Mcu.IPNb=16
Mcu.Name=STM32F427Z(G-I)Tx Mcu.Name=STM32F427Z(G-I)Tx
Mcu.Package=LQFP144 Mcu.Package=LQFP144
Mcu.Pin0=PE2 Mcu.Pin0=PE2
@ -47,61 +56,62 @@ Mcu.Pin12=PF10
Mcu.Pin13=PH0/OSC_IN Mcu.Pin13=PH0/OSC_IN
Mcu.Pin14=PH1/OSC_OUT Mcu.Pin14=PH1/OSC_OUT
Mcu.Pin15=PC0 Mcu.Pin15=PC0
Mcu.Pin16=PA4 Mcu.Pin16=PA0/WKUP
Mcu.Pin17=PA5 Mcu.Pin17=PA4
Mcu.Pin18=PA6 Mcu.Pin18=PA5
Mcu.Pin19=PB0 Mcu.Pin19=PA6
Mcu.Pin2=PE4 Mcu.Pin2=PE4
Mcu.Pin20=PB1 Mcu.Pin20=PB0
Mcu.Pin21=PF11 Mcu.Pin21=PB1
Mcu.Pin22=PB10 Mcu.Pin22=PF11
Mcu.Pin23=PB11 Mcu.Pin23=PB10
Mcu.Pin24=PB13 Mcu.Pin24=PB11
Mcu.Pin25=PG6 Mcu.Pin25=PB13
Mcu.Pin26=PC6 Mcu.Pin26=PG6
Mcu.Pin27=PC7 Mcu.Pin27=PC6
Mcu.Pin28=PC8 Mcu.Pin28=PC7
Mcu.Pin29=PC9 Mcu.Pin29=PC8
Mcu.Pin3=PE5 Mcu.Pin3=PE5
Mcu.Pin30=PA8 Mcu.Pin30=PC9
Mcu.Pin31=PA9 Mcu.Pin31=PA8
Mcu.Pin32=PA10 Mcu.Pin32=PA9
Mcu.Pin33=PA11 Mcu.Pin33=PA10
Mcu.Pin34=PA12 Mcu.Pin34=PA11
Mcu.Pin35=PA13 Mcu.Pin35=PA12
Mcu.Pin36=PA14 Mcu.Pin36=PA13
Mcu.Pin37=PA15 Mcu.Pin37=PA14
Mcu.Pin38=PC10 Mcu.Pin38=PA15
Mcu.Pin39=PC11 Mcu.Pin39=PC10
Mcu.Pin4=PE6 Mcu.Pin4=PE6
Mcu.Pin40=PC12 Mcu.Pin40=PC11
Mcu.Pin41=PD2 Mcu.Pin41=PC12
Mcu.Pin42=PD3 Mcu.Pin42=PD2
Mcu.Pin43=PD6 Mcu.Pin43=PD3
Mcu.Pin44=PG12 Mcu.Pin44=PD6
Mcu.Pin45=PG15 Mcu.Pin45=PG12
Mcu.Pin46=PB3 Mcu.Pin46=PG15
Mcu.Pin47=PB6 Mcu.Pin47=PB3
Mcu.Pin48=PB7 Mcu.Pin48=PB6
Mcu.Pin49=PB8 Mcu.Pin49=PB7
Mcu.Pin5=PC13 Mcu.Pin5=PC13
Mcu.Pin50=PB9 Mcu.Pin50=PB8
Mcu.Pin51=PE0 Mcu.Pin51=PB9
Mcu.Pin52=PE1 Mcu.Pin52=PE0
Mcu.Pin53=VP_IWDG_VS_IWDG Mcu.Pin53=PE1
Mcu.Pin54=VP_RTC_VS_RTC_Activate Mcu.Pin54=VP_IWDG_VS_IWDG
Mcu.Pin55=VP_RTC_VS_RTC_Calendar Mcu.Pin55=VP_RTC_VS_RTC_Activate
Mcu.Pin56=VP_SYS_VS_tim14 Mcu.Pin56=VP_RTC_VS_RTC_Calendar
Mcu.Pin57=VP_TIM1_VS_ClockSourceINT Mcu.Pin57=VP_SYS_VS_tim14
Mcu.Pin58=VP_TIM3_VS_ClockSourceINT Mcu.Pin58=VP_TIM1_VS_ClockSourceINT
Mcu.Pin59=VP_TIM11_VS_ClockSourceINT Mcu.Pin59=VP_TIM3_VS_ClockSourceINT
Mcu.Pin6=PC14/OSC32_IN Mcu.Pin6=PC14/OSC32_IN
Mcu.Pin60=VP_TIM12_VS_ClockSourceINT Mcu.Pin60=VP_TIM11_VS_ClockSourceINT
Mcu.Pin61=VP_TIM13_VS_ClockSourceINT Mcu.Pin61=VP_TIM12_VS_ClockSourceINT
Mcu.Pin62=VP_TIM13_VS_ClockSourceINT
Mcu.Pin7=PC15/OSC32_OUT Mcu.Pin7=PC15/OSC32_OUT
Mcu.Pin8=PF6 Mcu.Pin8=PF6
Mcu.Pin9=PF7 Mcu.Pin9=PF7
Mcu.PinsNb=62 Mcu.PinsNb=63
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants=mb_huart,huart3;mbdbg_htim,htim11;mb_htim,htim12;mb_dbg_huart,huart6;ustim,htim13;mem_hspi,hspi3;hpwm1,htim1;hpwm2,htim2;PWM_CHANNEL_1,TIM_CHANNEL_1;PWM_CHANNEL_2,TIM_CHANNEL_2;PWM_CHANNEL_3,TIM_CHANNEL_3;PWM_CHANNEL_4,TIM_CHANNEL_4;PWM_CHANNEL_5,TIM_CHANNEL_3;PWM_CHANNEL_6,TIM_CHANNEL_4 Mcu.UserConstants=mb_huart,huart3;mbdbg_htim,htim11;mb_htim,htim12;mb_dbg_huart,huart6;ustim,htim13;mem_hspi,hspi3;hpwm1,htim1;hpwm2,htim2;PWM_CHANNEL_1,TIM_CHANNEL_1;PWM_CHANNEL_2,TIM_CHANNEL_2;PWM_CHANNEL_3,TIM_CHANNEL_3;PWM_CHANNEL_4,TIM_CHANNEL_4;PWM_CHANNEL_5,TIM_CHANNEL_3;PWM_CHANNEL_6,TIM_CHANNEL_4
Mcu.UserName=STM32F427ZGTx Mcu.UserName=STM32F427ZGTx
@ -121,6 +131,7 @@ NVIC.TIM8_TRG_COM_TIM14_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:true
NVIC.TimeBase=TIM8_TRG_COM_TIM14_IRQn NVIC.TimeBase=TIM8_TRG_COM_TIM14_IRQn
NVIC.TimeBaseIP=TIM14 NVIC.TimeBaseIP=TIM14
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA0/WKUP.Signal=ADCx_IN0
PA10.GPIOParameters=GPIO_Label PA10.GPIOParameters=GPIO_Label
PA10.GPIO_Label=PWM3 PA10.GPIO_Label=PWM3
PA10.Locked=true PA10.Locked=true
@ -404,6 +415,8 @@ RTC.IPParameters=WeekDay,Year,Date,Month,Hours
RTC.Month=RTC_MONTH_JANUARY RTC.Month=RTC_MONTH_JANUARY
RTC.WeekDay=RTC_WEEKDAY_MONDAY RTC.WeekDay=RTC_WEEKDAY_MONDAY
RTC.Year=25 RTC.Year=25
SH.ADCx_IN0.0=ADC1_IN0,IN0
SH.ADCx_IN0.ConfNb=1
SH.ADCx_IN10.0=ADC3_IN10,IN10 SH.ADCx_IN10.0=ADC3_IN10,IN10
SH.ADCx_IN10.ConfNb=1 SH.ADCx_IN10.ConfNb=1
SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1 SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1