I'm trying to configure motors using the COMM_SET_MCCONF command with FW 6.0x via UART in VESC. However, I'm not receiving a reply from VESC for the packet id COMM_SET_MCCONF, and the motor configuration is not being changed. Although I am able to read the current configuration using COMM_GET_MCCONF, which indicates that my UART receiving function is working (or if it's not working in this specific case, the configuration should still be set) as well as the function that processes the configuration packet. I'm trying to activate or deactivate Field Weakening, and the only method I've found is using the COMM_SET_MCCONF interface. The routine on vedderb's that processes the commands is here
VescUartSet - Main function
bool VescUartSet(mc_configuration& config, int num) {
// based on https://github.com/vedderb/bldc/blob/fea2c81e55ab68b8476d6b1514595306691f3375/comm/commands.c#L535
int len =0,ret_pack = 0;
uint8_t receivedpayloadGlobal[PACKET_MAX_PL_LEN];
payloadGlobal[0] = COMM_SET_MCCONF;
int lenPayload = confgenerator_serialize_mcconf(payloadGlobal + 1, &config); // from vedderb https://github.com/vedderb/bldc/blob/9a436992b7b829b82af9b407288d723341a08d1d/confgenerator.c#L8
packet_send(payloadGlobal, lenPayload+1, num);
len = ReceiveUartMessage(receivedpayloadGlobal, num); // does not received, len =0
delay(100);
if (len > 1 || len == 0 || receivedpayloadGlobal[0] != 13) {
Serial.println("wrong answer from Vesc. should be lenPayload = 1 and payload[0] == 13 (COMM_SET_MCCONF)");
}
else
{
return true; //setting of mc-config was sucessful
}
}
Hello,
I'm trying to configure motors using the
COMM_SET_MCCONF
command with FW 6.0x via UART in VESC. However, I'm not receiving a reply from VESC for the packet idCOMM_SET_MCCONF
, and the motor configuration is not being changed. Although I am able to read the current configuration usingCOMM_GET_MCCONF
, which indicates that my UART receiving function is working (or if it's not working in this specific case, the configuration should still be set) as well as the function that processes the configuration packet. I'm trying to activate or deactivate Field Weakening, and the only method I've found is using the COMM_SET_MCCONF interface. The routine on vedderb's that processes the commands is hereVescUartSet - Main function
packet_send - Send packet over serial
Example of 481-length packet sent :
[13, 250, 68, 219, 2, 224, 1, 35, 152, 0, 0, 0, 0, 254, 131, 86, 128, 63, 251, 37, 64, 63, 240, 0, 224, 117, 0, 0, 0, 179, 63, 255, 255, 126, 32, 4, 96, 0, 0, 0, 0, 0, 0, 119, 128, 0, 0, 0, 22, 0, 22, 0, 21, 0, 0, 0, 21, 0, 20, 48, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 83, 34, 126, 64, 6, 0, 254, 141, 166, 144, 0, 0, 0, 0, 255, 255, 64, 8, 53, 104, 126, 65, 198, 0, 254, 141, 166, 144, 0, 21, 78, 149, 126, 64, 134, 0, 126, 65, 4, 96, 48, 38, 251, 63, 0, 0, 0, 0, 126, 64, 132, 96, 179, 63, 255, 255, 179, 63, 255, 255, 117, 128, 0, 0, 0, 0, 0, 0, 4, 126, 65, 4, 96, 126, 64, 132, 96, 0, 64, 8, 73, 156, 64, 8, 151, 100, 119, 64, 0, 0, 179, 63, 255, 255, 179, 63, 255, 255, 117, 0, 0, 0, 117, 0, 0, 0, 126, 65, 4, 0, 255, 255, 179, 63, 255, 255, 0, 0, 0, 0, 83, 46, 179, 63, 255, 255, 64, 8, 202, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 4, 6, 0, 255, 7, 81, 104, 63, 251, 38, 64, 0, 0, 0, 0, 255, 255, 152, 8, 80, 48, 0, 0, 76, 165, 1, 255, 0, 0, 0, 21, 0, 21, 0, 0, 0, 0, 63, 251, 39, 0, 0, 1, 0, 0, 0, 0, 255, 85, 63, 251, 38, 144, 63, 251, 218, 204, 126, 64, 196, 96, 76, 165, 73, 62, 0, 0, 0, 0, 0, 0, 76, 165, 240, 0, 126, 65, 4, 0, 16, 0, 0, 0, 0, 83, 94, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 63, 251, 38, 224, 63, 252, 67, 28, 120, 118, 0, 0, 0, 179, 63, 255, 255, 117, 0, 0, 0, 0, 0, 254, 214, 6, 64, 32, 117, 0, 0, 0, 63, 252, 211, 176, 63, 252, 211, 176, 63, 252, 64, 84, 0, 0, 0, 0, 0, 0, 254, 214, 6, 64, 0, 19, 119, 192, 0, 0, 0, 0, 63, 251, 39, 68, 63, 251, 39, 58, 0, 0, 0, 0, 0, 4, 0, 0, 63, 251, 39, 128, 0, 0, 0, 16, 0, 0, 0, 0, 7, 178, 8, 81, 7, 170, 0, 0, 96, 176, 176, 180, 63, 251, 39, 156, 119, 0, 0, 0, 63, 251, 39, 60, 254, 211, 125, 48, 128, 255, 63, 252, 54, 140, 0, 0, 0, 19, 180, 8, 115, 63, 251, 39, 208, 0, 0, 0, 0, 140, 0, 63, 251, 39, 152, 63, 251, 90, 160, 0, 16, 0, 196, 0, 0, 7, 178]