mirror of https://github.com/rusefi/bldc.git
BBSHD: monitor 12V rail
Signed-off-by: Marcos Chaparro <mchaparro@powerdesigns.ca>
This commit is contained in:
parent
cf017cbcc7
commit
278f767854
|
@ -35,6 +35,7 @@
|
|||
#define HW_HAS_3_SHUNTS
|
||||
#define HW_HAS_PHASE_SHUNTS
|
||||
#define HW_HAS_SIN_COS_ENCODER
|
||||
#define HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
|
||||
// Macros
|
||||
#define ENABLE_GATE() palSetPad(GPIOC, 14)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
// HW properties
|
||||
#define HW_HAS_3_SHUNTS
|
||||
#define HW_HAS_PHASE_SHUNTS
|
||||
#define HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
#define HW_USE_BRK
|
||||
|
||||
// Macros
|
||||
|
@ -62,7 +63,7 @@
|
|||
#define ADC_IND_CURR2 4
|
||||
#define ADC_IND_CURR3 5
|
||||
#define ADC_IND_VIN_SENS 11
|
||||
#define ADC_IND_GATE_DRV 12
|
||||
#define ADC_IND_VOUT_GATE_DRV 12
|
||||
#define ADC_IND_EXT 10
|
||||
#define ADC_IND_EXT2 6
|
||||
#define ADC_IND_EXT3 13
|
||||
|
@ -94,6 +95,9 @@
|
|||
// Input voltage
|
||||
#define GET_INPUT_VOLTAGE() ((V_REG / 4095.0) * (float)ADC_Value[ADC_IND_VIN_SENS] * ((VIN_R1 + VIN_R2) / VIN_R2))
|
||||
|
||||
// 12V supply voltage
|
||||
#define GET_GATE_DRIVER_SUPPLY_VOLTAGE() ((float)ADC_VOLTS(ADC_IND_VOUT_GATE_DRV) * 11.0)
|
||||
|
||||
// NTC Termistors
|
||||
#define NTC_RES(adc_val) ((4095.0 * 10000.0) / adc_val - 10000.0)
|
||||
#define NTC_TEMP(adc_ind) (1.0 / ((logf(NTC_RES(ADC_Value[adc_ind]) / 10000.0) / 3984.0) + (1.0 / 298.15)) - 273.15)
|
||||
|
@ -237,6 +241,9 @@
|
|||
#define HW_LIM_DUTY_MAX 0.0, 0.99
|
||||
#define HW_LIM_TEMP_FET -40.0, 110.0
|
||||
|
||||
#define HW_GATE_DRIVER_SUPPLY_MIN_VOLTAGE 10.0
|
||||
#define HW_GATE_DRIVER_SUPPLY_MAX_VOLTAGE 14.0
|
||||
|
||||
// HW-specific functions
|
||||
|
||||
#endif /* HW_LUNA_BBSHD_H_ */
|
||||
|
|
|
@ -1660,7 +1660,7 @@ void mc_interface_mc_timer_isr(bool is_second_motor) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HW_VERSION_AXIOM
|
||||
#ifdef HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
if(motor->m_gate_driver_voltage > HW_GATE_DRIVER_SUPPLY_MAX_VOLTAGE) {
|
||||
mc_interface_fault_stop(FAULT_CODE_GATE_DRIVER_OVER_VOLTAGE, is_second_motor);
|
||||
}
|
||||
|
@ -1917,7 +1917,7 @@ static void update_override_limits(volatile motor_if_state_t *motor, volatile mc
|
|||
|
||||
UTILS_LP_FAST(motor->m_temp_motor, temp_motor, 0.1);
|
||||
|
||||
#ifdef HW_VERSION_AXIOM
|
||||
#ifdef HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
UTILS_LP_FAST(motor->m_gate_driver_voltage, GET_GATE_DRIVER_SUPPLY_VOLTAGE(), 0.01);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void terminal_process_string(char *str) {
|
|||
commands_printf("Current : %.1f", (double)fault_vec[i].current);
|
||||
commands_printf("Current filtered : %.1f", (double)fault_vec[i].current_filtered);
|
||||
commands_printf("Voltage : %.2f", (double)fault_vec[i].voltage);
|
||||
#ifdef HW_VERSION_AXIOM
|
||||
#ifdef HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
commands_printf("Gate drv voltage : %.2f", (double)fault_vec[i].gate_driver_voltage);
|
||||
#endif
|
||||
commands_printf("Duty : %.3f", (double)fault_vec[i].duty);
|
||||
|
@ -194,7 +194,7 @@ void terminal_process_string(char *str) {
|
|||
commands_printf("Current 2 sample: %u\n", current2_samp);
|
||||
} else if (strcmp(argv[0], "volt") == 0) {
|
||||
commands_printf("Input voltage: %.2f\n", (double)GET_INPUT_VOLTAGE());
|
||||
#ifdef HW_VERSION_AXIOM
|
||||
#ifdef HW_HAS_GATE_DRIVER_SUPPLY_MONITOR
|
||||
commands_printf("Gate driver power supply output voltage: %.2f\n", (double)GET_GATE_DRIVER_SUPPLY_VOLTAGE());
|
||||
#endif
|
||||
} else if (strcmp(argv[0], "param_detect") == 0) {
|
||||
|
|
Loading…
Reference in New Issue