Dual motor setup over CAN with UART

Support for creating custom user applications on the VESC.
radios24
Posts: 2
Joined: 20 Jun 2018, 14:31
Location: Polska

Dual motor setup over CAN with UART

Postby radios24 » 20 Jun 2018, 14:36

Hello I've open new topic on parallel forum but unfortunately nobody is responding for that :( I reall need someones help in this problem. Please visit this topic:
https://www.vesc-project.com/node/482

Best regards,
Pawel

pf26
Posts: 305
Joined: 28 Mar 2016, 14:37
Location: FR Valence

Re: Dual motor setup over CAN with UART

Postby pf26 » 21 Jun 2018, 16:49

To send commands to the master VESC (ID=1), I think you better send the command directly, and not use the Forward command :
i.e. remove these 2 lines when ID=1
payload[index++] = COMM_FORWARD_CAN ;
payload[index++] = address ;

I checked your CRC calculation. and it seems correct.
Maybe you should make sure you allow enough time before and after each serial frame, and start your VESC before you send UART commands.
Did you manage to send commands using UART, directly to just one VESC ? This is the first thing to try and fix before getting to the forwarding things. You need to check your UART settings (115200baudrate, 8bit No parity) -
for some reasons, I used 2 stops bits, can't remember why, but maybe it helps...

radios24
Posts: 2
Joined: 20 Jun 2018, 14:31
Location: Polska

Re: Dual motor setup over CAN with UART

Postby radios24 » 22 Jun 2018, 15:52

Thank you for your replay. I have to say that when I'm using simple message format without COMM_FORWARD_CAN command one VESC works perfect (code below)

Code: Select all

void VescUartSetCurrent(ble_nus_c_t* p_ble_nus_c, float current) {
   int32_t index = 0;
   uint8_t payload[5];
   
   payload[index++] = COMM_SET_CURRENT ;
   buffer_append_int32(payload, (int32_t)(current * 1000), &index);
   PackSendPayload(p_ble_nus_c, payload, 5);
}

Also when I'm using PPM configuration in App menu CAN works perfect. You can see this in second forum (https://www.vesc-project.com/node/482#comment-2142), but when I want to use only UART, CAN messages looks different, and I've no idea why :(


Return to “Custom Applications”

Who is online

Users browsing this forum: No registered users and 1 guest