NOT_CALIBRATED after running calibration

I have an AS5047 magnetic absolute encoder attached to the motor shaft for both commutation and velocity/position control. The drive runs fine most of the time, but randomly it will return a NOT_CALIBRATED error when I try to enable closed loop control. Usually when this happens, I go ahead and run a full calibration. It will always return SUCCESS from the calibration procedure, after which I save_configuration. Once it reboots after saving, though, it sometimes still returns NOT_CALIBRATED when I try to enable closed loop control. Eventually, if I run calibration two or three times, it will start working fine and then I don’t run into any issues for days or weeks.

This is a difficult problem to reproduce, but any suggestions on what to look for the next time it appears?

Hi! What firmware version are you running? Can you dump your config with odrivetool backup-config config.json and upload the resulting config.json here?

This is 0.6.8.

The config is pasted below:

{
“axis0.commutation_mapper.config.approx_init_pos”: 0.0,
“axis0.commutation_mapper.config.approx_init_pos_valid”: false,
“axis0.commutation_mapper.config.circular_output_range”: 1.0,
“axis0.commutation_mapper.config.circular”: true,
“axis0.commutation_mapper.config.index_gpio”: 10,
“axis0.commutation_mapper.config.index_offset”: 0.0,
“axis0.commutation_mapper.config.index_offset_valid”: false,
“axis0.commutation_mapper.config.index_search_always_on”: false,
“axis0.commutation_mapper.config.offset”: -0.9320772290229797,
“axis0.commutation_mapper.config.offset_valid”: true,
“axis0.commutation_mapper.config.scale”: -8.0,
“axis0.commutation_mapper.config.use_endstop”: false,
“axis0.commutation_mapper.config.use_index_gpio”: false,
“axis0.config.I_bus_hard_max”: Infinity,
“axis0.config.I_bus_hard_min”: -Infinity,
“axis0.config.calib_range”: 0.019999999552965164,
“axis0.config.calib_scan_distance”: 8.0,
“axis0.config.calib_scan_vel”: 2.0,
“axis0.config.commutation_encoder”: 5,
“axis0.config.dir_gpio_pin”: 5,
“axis0.config.enable_error_gpio”: false,
“axis0.config.enable_step_dir”: false,
“axis0.config.enable_watchdog”: false,
“axis0.config.encoder_bandwidth”: 1000.0,
“axis0.config.error_gpio_pin”: 6,
“axis0.config.index_search_at_target_vel_only”: false,
“axis0.config.load_encoder”: 5,
“axis0.config.startup_closed_loop_control”: false,
“axis0.config.startup_encoder_index_search”: false,
“axis0.config.startup_encoder_offset_calibration”: false,
“axis0.config.startup_homing”: false,
“axis0.config.startup_max_wait_for_ready”: 3.0,
“axis0.config.startup_motor_calibration”: false,
“axis0.config.step_dir_always_on”: false,
“axis0.config.step_gpio_pin”: 8,
“axis0.config.torque_soft_max”: Infinity,
“axis0.config.torque_soft_min”: -Infinity,
“axis0.config.watchdog_timeout”: 0.0,
“axis0.config.anticogging.calib_bidirectional”: true,
“axis0.config.anticogging.calib_coarse_integrator_gain”: 10.0,
“axis0.config.anticogging.calib_coarse_tuning_duration”: 60.0,
“axis0.config.anticogging.calib_end_vel”: 0.15,
“axis0.config.anticogging.calib_fine_dist_scale”: 1.0,
“axis0.config.anticogging.calib_fine_tuning_duration”: 120.0,
“axis0.config.anticogging.calib_start_vel”: 1.0,
“axis0.config.anticogging.enabled”: false,
“axis0.config.anticogging.max_torque”: 0.15,
“axis0.config.calibration_lockin.accel”: 3.183098793029785,
“axis0.config.calibration_lockin.current”: 2.0,
“axis0.config.calibration_lockin.ramp_distance”: 0.5,
“axis0.config.calibration_lockin.ramp_time”: 0.4,
“axis0.config.calibration_lockin.vel”: 6.36619758605957,
“axis0.config.can.bus_voltage_msg_rate_ms”: 500,
“axis0.config.can.encoder_msg_rate_ms”: 5,
“axis0.config.can.error_msg_rate_ms”: 500,
“axis0.config.can.heartbeat_msg_rate_ms”: 100,
“axis0.config.can.iq_msg_rate_ms”: 20,
“axis0.config.can.is_extended”: false,
“axis0.config.can.node_id”: 1,
“axis0.config.can.temperature_msg_rate_ms”: 500,
“axis0.config.can.torques_msg_rate_ms”: 0,
“axis0.config.can.version_msg_rate_ms”: 0,
“axis0.config.general_lockin.accel”: 20.0,
“axis0.config.general_lockin.current”: 10.0,
“axis0.config.general_lockin.finish_distance”: 100.0,
“axis0.config.general_lockin.finish_on_distance”: false,
“axis0.config.general_lockin.finish_on_vel”: false,
“axis0.config.general_lockin.initial_pos”: 0.0,
“axis0.config.general_lockin.ramp_distance”: 3.1415927410125732,
“axis0.config.general_lockin.ramp_time”: 0.4,
“axis0.config.general_lockin.vel”: 40.0,
“axis0.config.motor.acim_autoflux_attack_gain”: 10.0,
“axis0.config.motor.acim_autoflux_decay_gain”: 1.0,
“axis0.config.motor.acim_autoflux_enable”: false,
“axis0.config.motor.acim_autoflux_min_Id”: 10.0,
“axis0.config.motor.acim_gain_min_flux”: 10.0,
“axis0.config.motor.acim_nominal_slip_vel”: 2.3399999141693115,
“axis0.config.motor.bEMF_FF_enable”: false,
“axis0.config.motor.calibration_current”: 2.0,
“axis0.config.motor.current_control_bandwidth”: 1000.0,
“axis0.config.motor.current_hard_max”: 14.23799991607666,
“axis0.config.motor.current_slew_rate_limit”: 10000.0,
“axis0.config.motor.current_soft_max”: 3.259999990463257,
“axis0.config.motor.direction”: -1.0,
“axis0.config.motor.ff_pm_flux_linkage”: 0.0,
“axis0.config.motor.ff_pm_flux_linkage_valid”: false,
“axis0.config.motor.fw_enable”: false,
“axis0.config.motor.fw_fb_bandwidth”: 500.0,
“axis0.config.motor.fw_mod_setpoint”: 0.6103333234786987,
“axis0.config.motor.motor_model_l_d”: 0.0,
“axis0.config.motor.motor_model_l_dq_valid”: false,
“axis0.config.motor.motor_model_l_q”: 0.0,
“axis0.config.motor.motor_type”: 0,
“axis0.config.motor.phase_inductance”: 0.00012546272773761302,
“axis0.config.motor.phase_inductance_valid”: true,
“axis0.config.motor.phase_resistance”: 0.319212943315506,
“axis0.config.motor.phase_resistance_valid”: true,
“axis0.config.motor.pole_pairs”: 8,
“axis0.config.motor.resistance_calib_max_voltage”: 10.0,
“axis0.config.motor.sensorless_observer_gain”: 1000.0,
“axis0.config.motor.sensorless_pll_bandwidth”: 1000.0,
“axis0.config.motor.sensorless_pm_flux_linkage”: 0.0,
“axis0.config.motor.sensorless_pm_flux_linkage_valid”: false,
“axis0.config.motor.torque_constant”: 0.03659291937947273,
“axis0.config.motor.wL_FF_enable”: false,
“axis0.config.sensorless_ramp.accel”: 30.0,
“axis0.config.sensorless_ramp.current”: 10.0,
“axis0.config.sensorless_ramp.finish_distance”: 16.0,
“axis0.config.sensorless_ramp.finish_on_distance”: false,
“axis0.config.sensorless_ramp.finish_on_vel”: true,
“axis0.config.sensorless_ramp.initial_pos”: 0.0,
“axis0.config.sensorless_ramp.ramp_distance”: 0.5,
“axis0.config.sensorless_ramp.ramp_time”: 0.4,
“axis0.config.sensorless_ramp.vel”: 60.0,
“axis0.controller.config.absolute_setpoints”: false,
“axis0.controller.config.circular_setpoint_range”: 1.0,
“axis0.controller.config.circular_setpoints”: false,
“axis0.controller.config.commutation_vel_scale”: 1.0,
“axis0.controller.config.control_mode”: 2,
“axis0.controller.config.enable_gain_scheduling”: false,
“axis0.controller.config.enable_overspeed_error”: true,
“axis0.controller.config.enable_torque_mode_vel_limit”: true,
“axis0.controller.config.enable_vel_limit”: true,
“axis0.controller.config.gain_scheduling_width”: 0.001,
“axis0.controller.config.homing_speed”: 0.25,
“axis0.controller.config.inertia”: 0.0,
“axis0.controller.config.input_filter_bandwidth”: 20.0,
“axis0.controller.config.input_mode”: 2,
“axis0.controller.config.pos_gain”: 20.0,
“axis0.controller.config.spinout_electrical_power_bandwidth”: 20.0,
“axis0.controller.config.spinout_electrical_power_threshold”: 10.0,
“axis0.controller.config.spinout_mechanical_power_bandwidth”: 20.0,
“axis0.controller.config.spinout_mechanical_power_threshold”: -10.0,
“axis0.controller.config.steps_per_circular_range”: 1024,
“axis0.controller.config.torque_ramp_rate”: 0.01,
“axis0.controller.config.use_commutation_vel”: false,
“axis0.controller.config.vel_gain”: 0.1,
“axis0.controller.config.vel_integrator_gain”: 0.001,
“axis0.controller.config.vel_integrator_limit”: Infinity,
“axis0.controller.config.vel_limit”: 60.0,
“axis0.controller.config.vel_limit_tolerance”: 1.3333333730697632,
“axis0.controller.config.vel_ramp_rate”: 30.0,
“axis0.interpolator.config.dynamic”: true,
“axis0.max_endstop.config.debounce_ms”: 50,
“axis0.max_endstop.config.enabled”: false,
“axis0.max_endstop.config.gpio_num”: 0,
“axis0.max_endstop.config.is_active_high”: false,
“axis0.max_endstop.config.offset”: 0.0,
“axis0.mechanical_brake.config.gpio_num”: 0,
“axis0.mechanical_brake.config.is_active_low”: true,
“axis0.min_endstop.config.debounce_ms”: 50,
“axis0.min_endstop.config.enabled”: false,
“axis0.min_endstop.config.gpio_num”: 0,
“axis0.min_endstop.config.is_active_high”: false,
“axis0.min_endstop.config.offset”: 0.0,
“axis0.motor.motor_thermistor.config.beta”: 0.0,
“axis0.motor.motor_thermistor.config.enabled”: false,
“axis0.motor.motor_thermistor.config.gpio_pin”: 4,
“axis0.motor.motor_thermistor.config.r_ref”: 0.0,
“axis0.motor.motor_thermistor.config.t_ref”: 25.0,
“axis0.motor.motor_thermistor.config.temp_limit_lower”: 100.0,
“axis0.motor.motor_thermistor.config.temp_limit_upper”: 120.0,
“axis0.pos_vel_mapper.config.approx_init_pos”: 0.0,
“axis0.pos_vel_mapper.config.approx_init_pos_valid”: false,
“axis0.pos_vel_mapper.config.circular_output_range”: 1.0,
“axis0.pos_vel_mapper.config.circular”: false,
“axis0.pos_vel_mapper.config.index_gpio”: 10,
“axis0.pos_vel_mapper.config.index_offset”: 0.0,
“axis0.pos_vel_mapper.config.index_offset_valid”: false,
“axis0.pos_vel_mapper.config.index_search_always_on”: false,
“axis0.pos_vel_mapper.config.offset”: 0.0,
“axis0.pos_vel_mapper.config.offset_valid”: false,
“axis0.pos_vel_mapper.config.scale”: 1.0,
“axis0.pos_vel_mapper.config.use_endstop”: false,
“axis0.pos_vel_mapper.config.use_index_gpio”: false,
“axis0.trap_traj.config.accel_limit”: 0.5,
“axis0.trap_traj.config.decel_limit”: 0.5,
“axis0.trap_traj.config.vel_limit”: 2.0,
“can.config.baud_rate”: 1000000,
“can.config.protocol”: 1,
“config.dc_bus_overvoltage_trip_level”: 30.0,
“config.dc_bus_undervoltage_trip_level”: 18.0,
“config.dc_max_negative_current”: -9.5,
“config.dc_max_positive_current”: 9.5,
“config.enable_can_a”: true,
“config.enable_uart_a”: false,
“config.gpio0_mode”: 17,
“config.gpio10_mode”: 17,
“config.gpio11_mode”: 17,
“config.gpio12_mode”: 17,
“config.gpio1_mode”: 17,
“config.gpio2_mode”: 17,
“config.gpio3_mode”: 17,
“config.gpio4_mode”: 17,
“config.gpio5_mode”: 17,
“config.gpio6_mode”: 17,
“config.gpio7_mode”: 17,
“config.gpio8_mode”: 17,
“config.gpio9_mode”: 17,
“config.max_regen_current”: 0.0,
“config.uart0_protocol”: 3,
“config.uart_a_baudrate”: 115200,
“config.usb_cdc_protocol”: 3,
“config.brake_resistor0.dc_bus_voltage_feedback_ramp_end”: 30.0,
“config.brake_resistor0.dc_bus_voltage_feedback_ramp_start”: 26.0,
“config.brake_resistor0.enable_dc_bus_voltage_feedback”: true,
“config.brake_resistor0.enable”: true,
“config.brake_resistor0.resistance”: 2.0,
“config.gpio11_analog_mapping.endpoint”: null,
“config.gpio11_analog_mapping.max”: 0.0,
“config.gpio11_analog_mapping.min”: 0.0,
“config.gpio1_analog_mapping.endpoint”: null,
“config.gpio1_analog_mapping.max”: 0.0,
“config.gpio1_analog_mapping.min”: 0.0,
“config.gpio8_pwm_mapping.endpoint”: null,
“config.gpio8_pwm_mapping.max”: 0.0,
“config.gpio8_pwm_mapping.min”: 0.0,
“config.inverter0.current_hard_max”: 96.0,
“config.inverter0.current_soft_max”: 80.0,
“config.inverter0.drv_config”: 9029553697166464,
“config.inverter0.shunt_conductance”: 1999.9998779296875,
“config.inverter0.temp_limit_lower”: 83.95999908447266,
“config.inverter0.temp_limit_upper”: 103.11000061035156,
“hall_encoder0.config.enabled”: false,
“hall_encoder0.config.hall_polarity_calibrated”: false,
“hall_encoder0.config.hall_polarity”: 0,
“hall_encoder0.config.ignore_illegal_hall_state”: false,
“inc_encoder0.config.cpr”: 8192,
“inc_encoder0.config.enabled”: false,
“rs485_encoder_group0.config.mode”: 0,
“spi_encoder0.config.baudrate”: 1687500,
“spi_encoder0.config.biss_c_bits”: 18,
“spi_encoder0.config.delay”: 0.0,
“spi_encoder0.config.max_error_rate”: 0.005,
“spi_encoder0.config.mode”: 2,
“spi_encoder0.config.ncs_gpio”: 12,
“spi_encoder1.config.baudrate”: 1687500,
“spi_encoder1.config.biss_c_bits”: 18,
“spi_encoder1.config.delay”: 0.0,
“spi_encoder1.config.max_error_rate”: 0.005,
“spi_encoder1.config.mode”: 0,
“spi_encoder1.config.ncs_gpio”: 12
}

I don’t see any immediate issues with the config.

When it happens again, you can check axis0.commutation_mapper.status. It’s best to check this value multiple times and then try CLOSED_LOOP_CONTROL again, in case it’s temporary.

When the encoder offset is calibrated, the value should be 0 (nominal). However in this case you should not get NOT_CALIBRATED (unless there’s another unrelated issue).
When the encoder is configured but the offset is not calibrated, it should be 9 (relative mode). However this should not spontaneously happen after it’s already worked before.

So both cases are unexpected but it would help to decide where to look next.

1 Like