vedderb / bldc

The VESC motor control firmware
2.1k stars 1.32k forks source link

The motor stops after updating configuration with COMM_SET_MCCONF_TEMP #86

Open Brooce opened 5 years ago

Brooce commented 5 years ago

Hi @vedderb (and others),

If I understood your post from https://github.com/vedderb/bldc/issues/63 well, changing configuration with _COMM_SET_MCCONFTEMP shouldn't stop the motor (unless I set the store flag) - see exact quote at the bottom.

In reality, however, it does. It seems like the problem is in _commands_processpacket() (https://github.com/vedderb/bldc/blob/master/commands.c#L790), where _mc_interface_setconfiguration() function is called that stops PWM via _mcpwm_foc_setconfiguration() (the same way of action as for any other change in configuration). The question is, is it a bug or a feature? Can I safely remove this call and just update the values on-the-go? Won't it interfere with how the motor is driven?

Best regards Jakub

Your original post (for reference):

The good news with this update is that other new commands are coming to enable profile support, namely COMM_SET_MCCONF_TEMP and COMM_SET_MCCONF_TEMP_SETUP, where a short configuration with only current, power, erpm (or m/s) and duty limits can be sent. The setup command allows using m/s and can also be applied to all VESCs on the CAN-bus if a flag is set. These commands also have a flag to specify whether they should be applied temporarily until the next reboot, or permanently. The temporary version can be applied without stopping the motor, which can be useful for some applications.

vedderb commented 5 years ago

Correct, updating the configuration will stop the motor. I will look into it and see if I can fix it in a clean way. For now you can start it again immediately after updating. You still need to call mc_interface_set_configuration() as the new parameters won't be used otherwise. Best is probably to update mcpwm_foc_set_configuration() to only stop the motor if parameters have changed that require that.