Запущена симуляция переструктурированного проекта
This commit is contained in:
parent
7b6cc2fa50
commit
0d80b52d9b
@ -191,7 +191,7 @@ int main(void)
|
||||
// init params for pwm and log
|
||||
pwm_ctrl[R_PWM_CTRL_PWM_SINE_HZ] = 10000;
|
||||
pwm_ctrl[R_PWM_CTRL_DUTY_BRIDGE] = 10000;//HZ_TIMER_PWM;
|
||||
pwm_ctrl[R_PWM_CTRL_PWM_HZ] = 200;//HZ_TIMER_PWM;
|
||||
pwm_ctrl[R_PWM_CTRL_PWM_HZ] = 15000;//HZ_TIMER_PWM;
|
||||
pwm_ctrl[R_PWM_CTRL_MAX_PULSE_DUR] = 0;
|
||||
pwm_ctrl[R_PWM_CTRL_MIN_PULSE_DUR] = 0;
|
||||
pwm_ctrl[R_PWM_CTRL_DEAD_TIME] = 100;
|
||||
|
||||
@ -31,7 +31,7 @@ void GPIO_to_SFUNC(real_T* out_buff)
|
||||
out_buff[PORT_WIDTH + i] = 1;
|
||||
}
|
||||
|
||||
if (GPIOE->ODR & (1 << i))
|
||||
if (GPIOA->ODR & (1 << i))
|
||||
{
|
||||
out_buff[2*PORT_WIDTH + i] = 1;
|
||||
}
|
||||
@ -50,12 +50,12 @@ void SFUNC_to_GPIO(real_T* in)
|
||||
{
|
||||
int i = 0;
|
||||
// write pwm ctrl registers
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
pwm_ctrl[i] = in[i];
|
||||
}
|
||||
// write pwm ctrl coils
|
||||
if (in[5] > 0.5)
|
||||
if (in[i++] > 0.5)
|
||||
{
|
||||
MB_Set_Coil_Local(coils_regs, COIL_PWM_DC_MODE);
|
||||
}
|
||||
@ -63,7 +63,7 @@ void SFUNC_to_GPIO(real_T* in)
|
||||
{
|
||||
MB_Reset_Coil_Local(coils_regs, COIL_PWM_DC_MODE);
|
||||
}
|
||||
if (in[6] > 0.5)
|
||||
if (in[i++] > 0.5)
|
||||
{
|
||||
MB_Set_Coil_Local(coils_regs, COIL_PWM_BRIDGE_MODE);
|
||||
}
|
||||
@ -71,7 +71,7 @@ void SFUNC_to_GPIO(real_T* in)
|
||||
{
|
||||
MB_Reset_Coil_Local(coils_regs, COIL_PWM_BRIDGE_MODE);
|
||||
}
|
||||
if (in[7] > 0.5)
|
||||
if (in[i++] > 0.5)
|
||||
{
|
||||
MB_Set_Coil_Local(coils_regs, COIL_PWM_PHASE_MODE);
|
||||
}
|
||||
|
||||
@ -25,11 +25,11 @@
|
||||
//#define AHB_Prescaler ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> RCC_PLLCFGR_PLLN_Pos)
|
||||
//#define AHB_Prescaler ((RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos)
|
||||
|
||||
#define HCLK_Value (double)72000000;
|
||||
#define ABP1_Value (double)72000000;
|
||||
#define ABP1_TIMS_Value (double)72000000;
|
||||
#define ABP2_Value (double)72000000;
|
||||
#define ABP2_TIMS_Value (double)72000000;
|
||||
#define HCLK_Value (double)168000000;
|
||||
#define ABP1_Value (double)42000000;
|
||||
#define ABP1_TIMS_Value (double)84000000;
|
||||
#define ABP2_Value (double)42000000;
|
||||
#define ABP2_TIMS_Value (double)84000000;
|
||||
|
||||
/* Эти дефайны добавлены в код stm32f4xx_hal_rcc.c, чтобы не попасть в бесконечный цикл */
|
||||
/* Мб перенести в MCU_Periph_Simulation(), но чет не хочется нагружать симуляцию этой херней */
|
||||
|
||||
@ -126,11 +126,11 @@ void Init_TIM_SIM(void)
|
||||
tim2s.tx_step = hmcu.SIM_Sample_Time * ABP1_TIMS_Value;
|
||||
|
||||
tim2s.Channels.OC1_GPIOx = GPIOA;
|
||||
tim2s.Channels.OC1_PIN_SHIFT = 5;
|
||||
tim2s.Channels.OC2_GPIOx = GPIOA;
|
||||
tim2s.Channels.OC2_PIN_SHIFT = 1;
|
||||
tim2s.Channels.OC3_GPIOx = GPIOA;
|
||||
tim2s.Channels.OC3_PIN_SHIFT = 2;
|
||||
tim2s.Channels.OC1_PIN_SHIFT = 15;
|
||||
tim2s.Channels.OC2_GPIOx = GPIOE;
|
||||
tim2s.Channels.OC2_PIN_SHIFT = 11;
|
||||
tim2s.Channels.OC3_GPIOx = GPIOE;
|
||||
tim2s.Channels.OC3_PIN_SHIFT = 13;
|
||||
tim2s.Channels.OC4_GPIOx = GPIOA;
|
||||
tim2s.Channels.OC4_PIN_SHIFT = 3;
|
||||
tim2s.Channels.OC1REF = 0;
|
||||
|
||||
@ -45,8 +45,8 @@
|
||||
|
||||
// DEFINES (UNCOMMENT WHAT YOU WILL SIMULATE)
|
||||
// TIMS
|
||||
#define USE_TIM1
|
||||
//#define USE_TIM2
|
||||
//#define USE_TIM1
|
||||
#define USE_TIM2
|
||||
#define USE_TIM3
|
||||
#define USE_TIM4
|
||||
//#define USE_TIM5
|
||||
@ -56,8 +56,8 @@
|
||||
//#define USE_TIM9
|
||||
//#define USE_TIM10
|
||||
//#define USE_TIM11
|
||||
#define USE_TIM12
|
||||
//#define USE_TIM13
|
||||
//#define USE_TIM12
|
||||
#define USE_TIM13
|
||||
//#define USE_TIM14
|
||||
|
||||
// TIM'S HANDLERS
|
||||
|
||||
@ -46,19 +46,19 @@
|
||||
// Parametrs of MCU simulator
|
||||
#define CREATE_SUSPENDED 0x00000004 ///< define from WinBase.h. We dont wanna include "Windows.h" or smth like this, because of HAL there are a lot of redefine errors.
|
||||
|
||||
#define DEKSTOP_CYCLES_FOR_MCU_APP 0xFFFF ///< number of for() cycles after which MCU thread would be suspended
|
||||
#define DEKSTOP_CYCLES_FOR_MCU_APP 0xFF ///< number of for() cycles after which MCU thread would be suspended
|
||||
#define PORT_WIDTH 16 ///< width of one port
|
||||
#define PORT_NUMB 3 ///< amount of ports
|
||||
|
||||
// Parameters of S_Function
|
||||
#define NPARAMS 1 ///< number of input parametrs (only Ts)
|
||||
#define IN_PORT_WIDTH (8) ///< width of input ports
|
||||
#define IN_PORT_WIDTH (9) ///< width of input ports
|
||||
#define IN_PORT_NUMB 1 ///< number of input ports
|
||||
#define OUT_PORT_WIDTH PORT_WIDTH ///< width of output ports
|
||||
#define OUT_PORT_NUMB PORT_NUMB ///< number of output ports
|
||||
#define DISC_STATES_WIDTH PORT_WIDTH*PORT_NUMB ///< width of discrete states array
|
||||
|
||||
#define MCU_CORE_CLOCK SystemCoreClock
|
||||
#define MCU_CORE_CLOCK 168000000
|
||||
/** WRAPPER_CONF
|
||||
* @}
|
||||
*/
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user