mirror of https://github.com/rusefi/bldc.git
PTC motor thermistor support, APP_PPM sleep fix
This commit is contained in:
parent
5e4f675936
commit
210ec40d74
|
@ -1,3 +1,7 @@
|
||||||
|
=== FW 3.65 ===
|
||||||
|
* Added support for PTC motor temperature sensor (e.g. KTY84)
|
||||||
|
* APP_PPM sleep fix. Should solve CAN issues.
|
||||||
|
|
||||||
=== FW 3.64 ===
|
=== FW 3.64 ===
|
||||||
* Added support for HW60_MK3
|
* Added support for HW60_MK3
|
||||||
* Disable shutdown sampling when the watchdog runs slowly.
|
* Disable shutdown sampling when the watchdog runs slowly.
|
||||||
|
|
|
@ -120,7 +120,7 @@ static THD_FUNCTION(ppm_thread, arg) {
|
||||||
is_running = true;
|
is_running = true;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
chEvtWaitAnyTimeout((eventmask_t)1, ST2MS(2));
|
chEvtWaitAnyTimeout((eventmask_t)1, MS2ST(2));
|
||||||
|
|
||||||
if (stop_now) {
|
if (stop_now) {
|
||||||
is_running = false;
|
is_running = false;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
// Firmware version
|
// Firmware version
|
||||||
#define FW_VERSION_MAJOR 3
|
#define FW_VERSION_MAJOR 3
|
||||||
#define FW_VERSION_MINOR 64
|
#define FW_VERSION_MINOR 65
|
||||||
|
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,8 @@ int32_t confgenerator_serialize_mcconf(uint8_t *buffer, const mc_configuration *
|
||||||
buffer_append_float32_auto(buffer, conf->m_dc_f_sw, &ind);
|
buffer_append_float32_auto(buffer, conf->m_dc_f_sw, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->m_ntc_motor_beta, &ind);
|
buffer_append_float32_auto(buffer, conf->m_ntc_motor_beta, &ind);
|
||||||
buffer[ind++] = conf->m_out_aux_mode;
|
buffer[ind++] = conf->m_out_aux_mode;
|
||||||
|
buffer[ind++] = conf->m_motor_temp_sens_type;
|
||||||
|
buffer_append_float32_auto(buffer, conf->m_ptc_motor_coeff, &ind);
|
||||||
buffer[ind++] = (uint8_t)conf->si_motor_poles;
|
buffer[ind++] = (uint8_t)conf->si_motor_poles;
|
||||||
buffer_append_float32_auto(buffer, conf->si_gear_ratio, &ind);
|
buffer_append_float32_auto(buffer, conf->si_gear_ratio, &ind);
|
||||||
buffer_append_float32_auto(buffer, conf->si_wheel_diameter, &ind);
|
buffer_append_float32_auto(buffer, conf->si_wheel_diameter, &ind);
|
||||||
|
@ -394,6 +396,8 @@ bool confgenerator_deserialize_mcconf(const uint8_t *buffer, mc_configuration *c
|
||||||
conf->m_dc_f_sw = buffer_get_float32_auto(buffer, &ind);
|
conf->m_dc_f_sw = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->m_ntc_motor_beta = buffer_get_float32_auto(buffer, &ind);
|
conf->m_ntc_motor_beta = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->m_out_aux_mode = buffer[ind++];
|
conf->m_out_aux_mode = buffer[ind++];
|
||||||
|
conf->m_motor_temp_sens_type = buffer[ind++];
|
||||||
|
conf->m_ptc_motor_coeff = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->si_motor_poles = buffer[ind++];
|
conf->si_motor_poles = buffer[ind++];
|
||||||
conf->si_gear_ratio = buffer_get_float32_auto(buffer, &ind);
|
conf->si_gear_ratio = buffer_get_float32_auto(buffer, &ind);
|
||||||
conf->si_wheel_diameter = buffer_get_float32_auto(buffer, &ind);
|
conf->si_wheel_diameter = buffer_get_float32_auto(buffer, &ind);
|
||||||
|
@ -654,6 +658,8 @@ void confgenerator_set_defaults_mcconf(mc_configuration *conf) {
|
||||||
conf->m_dc_f_sw = MCCONF_M_DC_F_SW;
|
conf->m_dc_f_sw = MCCONF_M_DC_F_SW;
|
||||||
conf->m_ntc_motor_beta = MCCONF_M_NTC_MOTOR_BETA;
|
conf->m_ntc_motor_beta = MCCONF_M_NTC_MOTOR_BETA;
|
||||||
conf->m_out_aux_mode = MCCONF_M_OUT_AUX_MODE;
|
conf->m_out_aux_mode = MCCONF_M_OUT_AUX_MODE;
|
||||||
|
conf->m_motor_temp_sens_type = MCCONF_M_MOTOR_TEMP_SENS_TYPE;
|
||||||
|
conf->m_ptc_motor_coeff = MCCONF_M_PTC_MOTOR_COEFF;
|
||||||
conf->si_motor_poles = MCCONF_SI_MOTOR_POLES;
|
conf->si_motor_poles = MCCONF_SI_MOTOR_POLES;
|
||||||
conf->si_gear_ratio = MCCONF_SI_GEAR_RATIO;
|
conf->si_gear_ratio = MCCONF_SI_GEAR_RATIO;
|
||||||
conf->si_wheel_diameter = MCCONF_SI_WHEEL_DIAMETER;
|
conf->si_wheel_diameter = MCCONF_SI_WHEEL_DIAMETER;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
#define MCCONF_SIGNATURE 793836781
|
#define MCCONF_SIGNATURE 2967846088
|
||||||
#define APPCONF_SIGNATURE 783041200
|
#define APPCONF_SIGNATURE 783041200
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
|
|
@ -64,6 +64,12 @@ typedef enum {
|
||||||
OUT_AUX_MODE_UNUSED
|
OUT_AUX_MODE_UNUSED
|
||||||
} out_aux_mode;
|
} out_aux_mode;
|
||||||
|
|
||||||
|
// Temperature sensor type
|
||||||
|
typedef enum {
|
||||||
|
TEMP_SENSOR_NTC_10K_25C = 0,
|
||||||
|
TEMP_SENSOR_PTC_1K_100C
|
||||||
|
} temp_sensor_type;
|
||||||
|
|
||||||
// General purpose drive output mode
|
// General purpose drive output mode
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GPD_OUTPUT_MODE_NONE = 0,
|
GPD_OUTPUT_MODE_NONE = 0,
|
||||||
|
@ -300,6 +306,8 @@ typedef struct {
|
||||||
float m_dc_f_sw;
|
float m_dc_f_sw;
|
||||||
float m_ntc_motor_beta;
|
float m_ntc_motor_beta;
|
||||||
out_aux_mode m_out_aux_mode;
|
out_aux_mode m_out_aux_mode;
|
||||||
|
temp_sensor_type m_motor_temp_sens_type;
|
||||||
|
float m_ptc_motor_coeff;
|
||||||
// Setup info
|
// Setup info
|
||||||
uint8_t si_motor_poles;
|
uint8_t si_motor_poles;
|
||||||
float si_gear_ratio;
|
float si_gear_ratio;
|
||||||
|
|
|
@ -364,6 +364,14 @@
|
||||||
#define COMM_USE_USB 1
|
#define COMM_USE_USB 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PTC_TEMP_MOTOR
|
||||||
|
#if defined(NTC_RES_MOTOR) && defined(ADC_IND_TEMP_MOTOR)
|
||||||
|
#define PTC_TEMP_MOTOR(res, con, tbase) (((NTC_RES_MOTOR(ADC_Value[ADC_IND_TEMP_MOTOR]) - res) / res) * 100 / con + tbase)
|
||||||
|
#else
|
||||||
|
#define PTC_TEMP_MOTOR(res, con, tbase) 0.0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
void hw_init_gpio(void);
|
void hw_init_gpio(void);
|
||||||
void hw_setup_adc_channels(void);
|
void hw_setup_adc_channels(void);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "comm_can.h"
|
#include "comm_can.h"
|
||||||
#include "shutdown.h"
|
#include "shutdown.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1747,7 +1748,17 @@ static void update_override_limits(volatile mc_configuration *conf) {
|
||||||
const float rpm_now = mc_interface_get_rpm();
|
const float rpm_now = mc_interface_get_rpm();
|
||||||
|
|
||||||
UTILS_LP_FAST(m_temp_fet, NTC_TEMP(ADC_IND_TEMP_MOS), 0.1);
|
UTILS_LP_FAST(m_temp_fet, NTC_TEMP(ADC_IND_TEMP_MOS), 0.1);
|
||||||
UTILS_LP_FAST(m_temp_motor, NTC_TEMP_MOTOR(conf->m_ntc_motor_beta), 0.1);
|
if (conf->m_motor_temp_sens_type == TEMP_SENSOR_NTC_10K_25C) {
|
||||||
|
UTILS_LP_FAST(m_temp_motor, NTC_TEMP_MOTOR(conf->m_ntc_motor_beta), 0.1);
|
||||||
|
} else if (conf->m_motor_temp_sens_type == TEMP_SENSOR_PTC_1K_100C) {
|
||||||
|
float temp = PTC_TEMP_MOTOR(1000.0, conf->m_ptc_motor_coeff, 100);
|
||||||
|
|
||||||
|
if (UTILS_IS_NAN(temp) || UTILS_IS_INF(temp) || temp > 600.0) {
|
||||||
|
temp = 180.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTILS_LP_FAST(m_temp_motor, temp, 0.1);
|
||||||
|
}
|
||||||
#ifdef HW_VERSION_AXIOM
|
#ifdef HW_VERSION_AXIOM
|
||||||
UTILS_LP_FAST(m_gate_driver_voltage, GET_GATE_DRIVER_SUPPLY_VOLTAGE(), 0.01);
|
UTILS_LP_FAST(m_gate_driver_voltage, GET_GATE_DRIVER_SUPPLY_VOLTAGE(), 0.01);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -402,6 +402,12 @@
|
||||||
#ifndef MCCONF_M_OUT_AUX_MODE
|
#ifndef MCCONF_M_OUT_AUX_MODE
|
||||||
#define MCCONF_M_OUT_AUX_MODE OUT_AUX_MODE_OFF // Auxiliary output mode
|
#define MCCONF_M_OUT_AUX_MODE OUT_AUX_MODE_OFF // Auxiliary output mode
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MCCONF_M_MOTOR_TEMP_SENS_TYPE
|
||||||
|
#define MCCONF_M_MOTOR_TEMP_SENS_TYPE TEMP_SENSOR_NTC_10K_25C // Motor temperature sensor type
|
||||||
|
#endif
|
||||||
|
#ifndef MCCONF_M_PTC_MOTOR_COEFF
|
||||||
|
#define MCCONF_M_PTC_MOTOR_COEFF 0.61 // %/K coefficient for motor PTC sensor
|
||||||
|
#endif
|
||||||
|
|
||||||
// Setup Info
|
// Setup Info
|
||||||
#ifndef MCCONF_SI_MOTOR_POLES
|
#ifndef MCCONF_SI_MOTOR_POLES
|
||||||
|
|
Loading…
Reference in New Issue