Merge branch 'master' into devel

This commit is contained in:
Oskar Weigl
2018-04-15 17:38:58 -07:00
4 changed files with 27 additions and 9 deletions
+2
View File
@@ -170,8 +170,10 @@
#if HW_VERSION_VOLTAGE == 48
#define VBUS_S_DIVIDER_RATIO 19.0f
#define VBUS_OVERVOLTAGE_LEVEL 52.0f
#elif HW_VERSION_VOLTAGE == 24
#define VBUS_S_DIVIDER_RATIO 11.0f
#define VBUS_OVERVOLTAGE_LEVEL 26.0f
#else
#error "unknown board voltage"
#endif
+20 -6
View File
@@ -68,7 +68,8 @@ Motor_t motors[] = {
.current_setpoint = 0.0f, // [A]
.calibration_current = 10.0f, // [A]
.resistance_calib_max_voltage = 1.0f, // [V] - You may need to increase this if this voltage isn't sufficient to drive calibration_current through the motor.
.dc_bus_brownout_trip_level = 8.0f, // [V]
.dc_bus_undervoltage_trip_level = 8.0f, // [V]
.dc_bus_overvoltage_trip_level = VBUS_OVERVOLTAGE_LEVEL, // [V]
.phase_inductance = 0.0f, // to be set by measure_phase_inductance
.phase_resistance = 0.0f, // to be set by measure_phase_resistance
.motor_thread = 0,
@@ -176,7 +177,8 @@ Motor_t motors[] = {
.current_setpoint = 0.0f, // [A]
.calibration_current = 10.0f, // [A]
.resistance_calib_max_voltage = 1.0f, // [V] - You may need to increase this if this voltage isn't sufficient to drive calibration_current through the motor.
.dc_bus_brownout_trip_level = 8.0f, // [V]
.dc_bus_undervoltage_trip_level = 8.0f, // [V]
.dc_bus_overvoltage_trip_level = VBUS_OVERVOLTAGE_LEVEL, // [V]
.phase_inductance = 0.0f, // to be set by measure_phase_inductance
.phase_resistance = 0.0f, // to be set by measure_phase_resistance
.motor_thread = 0,
@@ -1320,8 +1322,16 @@ bool check_DRV_fault(Motor_t* motor) {
}
//Returns true if everything is OK (no fault)
bool check_PSU_brownout(Motor_t* motor) {
if(vbus_voltage < motor->dc_bus_brownout_trip_level)
bool check_vbus_undervoltage(Motor_t* motor) {
if(vbus_voltage < motor->dc_bus_undervoltage_trip_level)
return false;
return true;
}
//Returns true if everything is OK (no fault)
// TODO This will be less repetitive with the refactoring
bool check_vbus_overvoltage(Motor_t* motor) {
if(vbus_voltage > motor->dc_bus_overvoltage_trip_level)
return false;
return true;
}
@@ -1338,8 +1348,12 @@ bool do_checks(Motor_t* motor) {
DRV8301_readData(&motor->gate_driver, local_regs);
return false;
}
if (!check_PSU_brownout(motor)) {
motor->error = ERROR_DC_BUS_BROWNOUT;
if (!check_vbus_undervoltage(motor)) {
motor->error = ERROR_DC_BUS_UNDERVOLTAGE;
return false;
}
if (!check_vbus_overvoltage(motor)) {
motor->error = ERROR_DC_BUS_OVERVOLTAGE;
return false;
}
return true;
+4 -2
View File
@@ -51,7 +51,8 @@ typedef enum {
ERROR_DRV_FAULT,
ERROR_NOT_IMPLEMENTED_MOTOR_TYPE,
ERROR_ENCODER_CPR_OUT_OF_RANGE,
ERROR_DC_BUS_BROWNOUT,
ERROR_DC_BUS_UNDERVOLTAGE,
ERROR_DC_BUS_OVERVOLTAGE,
} Error_t;
// Note: these should be sorted from lowest level of control to
@@ -151,7 +152,8 @@ typedef struct {
float current_setpoint;
float calibration_current;
float resistance_calib_max_voltage;
float dc_bus_brownout_trip_level;
float dc_bus_undervoltage_trip_level;
float dc_bus_overvoltage_trip_level;
float phase_inductance;
float phase_resistance;
osThreadId motor_thread;
+1 -1
View File
@@ -15,7 +15,7 @@ All non-power I/O is 3.3V output and 5V tolerant on input, except:
You need one or two [brushless motors](https://hackaday.io/project/11583-odrive-high-performance-motor-control/log/37666-hobby-motors-in-your-robots), [quadrature incremental encoder(s)](https://discourse.odriverobotics.com/t/which-encoders-to-choose/63/2), and a power resistor.
*The power resistor values you need depends on your motor setup, and peak/average decelleration power. A good starting point would be a [0.47 ohm, 50W resistor](https://www.digikey.com/product-detail/en/te-connectivity-passive-product/HSA50R47J/A102181-ND/2056131).*
The power resistor values you need depends on your motor setup, and peak/average decelleration power. A good starting point would be a [0.47 ohm, 50W resistor](https://www.digikey.com/product-detail/en/te-connectivity-passive-product/HSA50R47J/A102181-ND/2056131). **Warning! Failure to use a break resistor may result in damage to your ODrive and/or power supply!**
Wire up the motor phases into the 3-phase screw terminals, and the power resistor to the AUX terminal. Wire up the power source (12-24V) to the DC terminal, make sure to pay attention to the polarity. Do not apply power just yet.