added some testing tools

This commit is contained in:
hamza
2024-05-31 02:03:44 +03:00
parent cb4b5cb53e
commit ad21577cbb
9 changed files with 77 additions and 131 deletions

View File

@ -13,7 +13,7 @@ F_PWM = (F_CLK)/((ARR + 1) * (PSC + 1))
F_CLK = 16 MHz
POWERGROUND ESC Signal: pulse every 20 ms, 1 ms = 0%, 2 ms = 100%
FREQ = 50 Hz -> 16 MHz/50 Hz = 320000 = ((9999 + 1) * (31 + 1))
FREQ = 50 Hz -> 16 MHz/50 Hz = 320000 = ((39999 + 1) * (7 + 1))
DUTY CYCLE = 1/20 -> 0%, DUTY CYCLE = 2/20 -> 100%
CCR * DUTY_CYCLE
CCR: 1/20 -> 500, 2/20 -> 1000
@ -24,7 +24,7 @@ CCR: 1/20 -> 500, 2/20 -> 1000
//#define BATTERY_COOLING_FREQ 20000
void PWM_control_init(TIM_HandleTypeDef powerground1, TIM_HandleTypeDef powerground2, TIM_HandleTypeDef battery_cooling);
void PWM_control_init(TIM_HandleTypeDef* powerground1, TIM_HandleTypeDef* powerground2, TIM_HandleTypeDef* battery_cooling);
void PWM_powerground_control(uint8_t percent);
void PWM_battery_cooling_control(uint8_t percent);

View File

@ -64,9 +64,9 @@ typedef struct {
extern StateHandle state;
static bool relay_closed = 0;
static bool precharge_closed = 0;
static int16_t RELAY_BAT_SIDE_VOLTAGE = 0;
static int16_t RELAY_ESC_SIDE_VOLTAGE = 0;
static int16_t CURRENT_MEASUREMENT = 0;
static int16_t RELAY_BAT_SIDE_VOLTAGE;
static int16_t RELAY_ESC_SIDE_VOLTAGE;
static int16_t CURRENT_MEASUREMENT;
void sm_init();
void sm_update();