From 0ac2871deccbd9bbc25ccf114cbd648008483bb2 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sat, 21 Apr 2018 14:27:37 -0700 Subject: [PATCH] drv fault only reads fault regs, add blackside loopback tests --- Firmware/MotorControl/motor.cpp | 6 +++--- Firmware/MotorControl/motor.hpp | 10 +++++----- tools/odrive/tests.py | 8 ++++---- tools/test-rig-loopback.yaml | 35 +++++++++++++++++++++++++++++++-- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Firmware/MotorControl/motor.cpp b/Firmware/MotorControl/motor.cpp index 6f12474d..9558dc35 100644 --- a/Firmware/MotorControl/motor.cpp +++ b/Firmware/MotorControl/motor.cpp @@ -117,9 +117,9 @@ bool Motor::check_DRV_fault() { // Update DRV Fault Code drv_fault_ = DRV8301_getFaultType(&gate_driver_); // Update/Cache all SPI device registers - DRV_SPI_8301_Vars_t* local_regs = &gate_driver_regs_; - local_regs->RcvCmd = true; - DRV8301_readData(&gate_driver_, local_regs); + // DRV_SPI_8301_Vars_t* local_regs = &gate_driver_regs_; + // local_regs->RcvCmd = true; + // DRV8301_readData(&gate_driver_, local_regs); return false; }; return true; diff --git a/Firmware/MotorControl/motor.hpp b/Firmware/MotorControl/motor.hpp index ebc47b9c..7f9e9b08 100644 --- a/Firmware/MotorControl/motor.hpp +++ b/Firmware/MotorControl/motor.hpp @@ -180,11 +180,11 @@ public: make_protocol_property("max_allowed_current", ¤t_control_.max_allowed_current) ), make_protocol_object("gate_driver", - make_protocol_ro_property("drv_fault", &drv_fault_), - make_protocol_ro_property("status_reg_1", &gate_driver_regs_.Stat_Reg_1_Value), - make_protocol_ro_property("status_reg_2", &gate_driver_regs_.Stat_Reg_2_Value), - make_protocol_ro_property("ctrl_reg_1", &gate_driver_regs_.Ctrl_Reg_1_Value), - make_protocol_ro_property("ctrl_reg_2", &gate_driver_regs_.Ctrl_Reg_2_Value) + make_protocol_ro_property("drv_fault", &drv_fault_) + // make_protocol_ro_property("status_reg_1", &gate_driver_regs_.Stat_Reg_1_Value), + // make_protocol_ro_property("status_reg_2", &gate_driver_regs_.Stat_Reg_2_Value), + // make_protocol_ro_property("ctrl_reg_1", &gate_driver_regs_.Ctrl_Reg_1_Value), + // make_protocol_ro_property("ctrl_reg_2", &gate_driver_regs_.Ctrl_Reg_2_Value) ), make_protocol_object("timing_log", make_protocol_ro_property("TIMING_LOG_GENERAL", &timing_log_[TIMING_LOG_GENERAL]), diff --git a/tools/odrive/tests.py b/tools/odrive/tests.py index 182f70aa..43ef182b 100644 --- a/tools/odrive/tests.py +++ b/tools/odrive/tests.py @@ -61,13 +61,13 @@ def test_assert_eq(observed, expected, range=None, accuracy=None): def get_errors(axis_ctx: AxisTestContext): errors = [] if axis_ctx.handle.motor.error != 0: - errors.append("motor failed with error {:04X}".format(axis_ctx.handle.motor.error)) + errors.append("motor failed with error 0x{:04X}".format(axis_ctx.handle.motor.error)) if axis_ctx.handle.encoder.error != 0: - errors.append("encoder failed with error {:04X}".format(axis_ctx.handle.encoder.error)) + errors.append("encoder failed with error 0x{:04X}".format(axis_ctx.handle.encoder.error)) if axis_ctx.handle.sensorless_estimator.error != 0: - errors.append("sensorless_estimator failed with error {:04X}".format(axis_ctx.handle.sensorless_estimator.error)) + errors.append("sensorless_estimator failed with error 0x{:04X}".format(axis_ctx.handle.sensorless_estimator.error)) if axis_ctx.handle.error != 0: - errors.append("axis failed with error {:04X}".format(axis_ctx.handle.error)) + errors.append("axis failed with error 0x{:04X}".format(axis_ctx.handle.error)) elif len(errors) > 0: errors.append("and by the way: axis reports no error even though there is one") return errors diff --git a/tools/test-rig-loopback.yaml b/tools/test-rig-loopback.yaml index 34989214..359c3a61 100644 --- a/tools/test-rig-loopback.yaml +++ b/tools/test-rig-loopback.yaml @@ -2,7 +2,37 @@ type: loopback odrives: - - name: odrive-48V + - name: odrv-blackside + board-version: v3.4-24V + serial-number: "3061395B3235" + brake-resistance: 0.47 + uart: /dev/serial/by-id/[not-yet-used] + usb: auto + programmer: '493f6f06493f56540929113f' + vbus-voltage: 24 # [V] + max-brake-power: 150 # [W] + axes: + - name: 'M0' + motor-phase-resistance: 0.028 + motor-phase-inductance: 1.6e-05 + motor-pole-pairs: 7 + motor-direction: 1 + motor-kv: 270 + motor-max-current: 70 + motor-max-voltage: 32 + encoder-cpr: 8192 + encoder-max-rpm: 7000 + - name: 'M1' + motor-phase-resistance: 0.028 + motor-phase-inductance: 1.6e-05 + motor-pole-pairs: 7 + motor-direction: -1 + motor-kv: 270 + motor-max-current: 70 + motor-max-voltage: 32 + encoder-cpr: 8192 + encoder-max-rpm: 7000 + - name: odrv-yellowside board-version: v3.5-48V serial-number: "3660335E3037" brake-resistance: 0.47 @@ -35,4 +65,5 @@ odrives: # Mechanical couplings couplings: - - [ odrive-48V.M0, odrive-48V.M1 ] \ No newline at end of file + - [ odrv-blackside.M0, odrv-blackside.M1 ] + - [ odrv-yellowside.M0, odrv-yellowside.M1 ] \ No newline at end of file