[solved] Seemingly random modulation magnitude errors with gimbal motor and 48V board


We have been running a gimbal motor (T-Motor GB54-1) at 120 RPM using gimbal motor mode on a 24V board (supply voltage of 19V). It works well. For a new build, we switched to the 48V board and use a 24V supply voltage, and with the same settings as before, we are getting lots of ERROR_MODULATION_MAGNITUDE when attempting to go into closed loop control. Sometimes it works, then the next time it doesn’t, sometimes rerunning the calibration sequence helps, sometimes not. I urgently need to get this working and I’m not sure what further steps to take to debug the errors.

Here are the settings we use:

    brake_resistance: 0 # no brake resistor is installed
    enable_ascii_protocol_on_usb: 1
    enable_uart: 0
    dc_bus_undervoltage_trip_level: 8
    dc_bus_overvoltage_trip_level: 26
        startup_motor_calibration: 0
        startup_encoder_index_search: 1
        startup_encoder_offset_calibration: 1
        startup_closed_loop_control: 0
        startup_sensorless_control: 0
            pre_calibrated: 1
            pole_pairs: 7
            resistance_calib_max_voltage: 6 # volts

            motor_type: 2 # gimbal
            current_lim: 8 # V (in gimbal mode, currents are actually voltages)
            calibration_current: 4 # V (in gimbal mode, currents are actually voltages)
            mode: 0
            pre_calibrated: 1
            cpr: 2048
            use_index: 1
            bandwidth: 250
            control_mode: 2 # velocity control
            pos_gain: 100
            vel_limit: 8192
            vel_gain: 5.0e-4
            vel_int_gain: 8.0e-3
            vel_deriv_gain: 3.0e-2
            vel_filter_fc: 3000
        vel_setpoint: 0

Note that calibration_current and current_lim are set well below half of the bus voltage, as recommended by the troubleshooting page. With these settings the motor starts on the first try (entering closed loop control after finishing the calibration sequence) about 56% of the time. We tried increasing calibration_current to 6 volts, and it started every time, but this may be a fluke. Either way, after idling the motor and then trying to start it again, we get ERROR_MODULATION_MAGNITUDE on the second or third run each time. Note that once the motor starts up without an error, it seems to run fine.

As I said, these settings have been working 100% of the time on our 24V board for months, so this is quite mysterious. Please let me know how to proceed! I am fine with applying a firmware fix if there is one.

Update: so far, we’ve learned that the firmware needs to be built with a different tup.config for the 48V board, and we haven’t seen the error recur yet. Next step may be updating to the 0.4.8 firmware which has the soft voltage clamping.