Basic VESC raspi canbus guidance...

revr

10 µW
Joined
Jan 8, 2025
Messages
5
Location
Melbourne, Australia
Hi folks, I am after some basic guidance on getting a raspberry pi to drive a VESC inverter via the CAN.
The main issue is that I don't seem to be getting any CAN traffic with candump on the Pi. No CAN messages from Pi have any effect on the ESC.
It's dead Jim.

I need a way to get the ESC to create a CAN message I can read on the Pi, at least as a test.
I am using VESC Tool 6 for MacOS and also Android. This version seems very basic, even tho it was paid. It doesn't say "bronze" or etc. There are not dev tools or CAN analysis tools. Are these only on PC and Linux?

Here is the pi CAN hat doc and tests which I can run fine on the Pi
The ESC is MKS 84200HP
I have wired the two Pi CAN Hat ports together and to the CAN bus on the ESC.
This is so I can run commands on can1 and dump can0.
The CAN H and CAN L have 100 ohms of resistance on the ESC, which apparently means it is not blown.

The messages I have attempted to make assume that the VESC ID is the ID in the message:

00 00 0A 00 00 27 4C 00

Was suggested online:

if your CAN ID is 76 (4C) for example : Send 0x000000A 00 00 27 4C and your motor will run at 10% Duty Cycle

Sent as
data=[0x00, 0x00, 0x0A, 0x00, 0x00, 0x27, 0x4C, 0x00]
candump shows

008 [8] 00 00 0A 00 00 27 4C 00

However, contention_id (8) and source and target id and message id (also 8, seems wrong) I don't understand.

Thanks,
Craig
 
CANbus needs terminating resistors on both _end_s, are they set up correctly?
ie. one at the ESC, and only one(on whichever(can0/can1) is at the "end") at the pi CAN hat ?

edit: if using two resistors at the pi, you'd better take two separate wirings to the ESC, one to each can-port on the hat.
personally i would wire can0 to can1, and from can1 to ESC. and have the resistors at can0 and ESC, which i guess is what you already have, just unsure about the resistors.
 
Last edited:
Hi folks, I am after some basic guidance on getting a raspberry pi to drive a VESC inverter via the CAN.
The main issue is that I don't seem to be getting any CAN traffic with candump on the Pi. No CAN messages from Pi have any effect on the ESC.
It's dead Jim.

I need a way to get the ESC to create a CAN message I can read on the Pi, at least as a test.
I am using VESC Tool 6 for MacOS and also Android. This version seems very basic, even tho it was paid. It doesn't say "bronze" or etc. There are not dev tools or CAN analysis tools. Are these only on PC and Linux?

Here is the pi CAN hat doc and tests which I can run fine on the Pi
The ESC is MKS 84200HP
I have wired the two Pi CAN Hat ports together and to the CAN bus on the ESC.
This is so I can run commands on can1 and dump can0.
The CAN H and CAN L have 100 ohms of resistance on the ESC, which apparently means it is not blown.

The messages I have attempted to make assume that the VESC ID is the ID in the message:

00 00 0A 00 00 27 4C 00

Was suggested online:

if your CAN ID is 76 (4C) for example : Send 0x000000A 00 00 27 4C and your motor will run at 10% Duty Cycle

Sent as
data=[0x00, 0x00, 0x0A, 0x00, 0x00, 0x27, 0x4C, 0x00]
candump shows

008 [8] 00 00 0A 00 00 27 4C 00

However, contention_id (8) and source and target id and message id (also 8, seems wrong) I don't understand.

Thanks,
Craig

Canbus and programming wise I can't be of help I'm afraid but to answer about vesc tool the desktop version should be the same whether it's mac, windows or Linux, certainly the later 2 are the same.
And as for the paid vs unpaid versions their identical again, vedder just has that as an easy way to make a donation for the software.
 
Thanks, I will add a 100 O resistor. Should I expect (with or without) this resistor at the Pi end to get a regular 2.6V measure across the H and L of the CANBUS?
 
Canbus and programming wise I can't be of help I'm afraid but to answer about vesc tool the desktop version should be the same whether it's mac, windows or Linux, certainly the later 2 are the same.
And as for the paid vs unpaid versions their identical again, vedder just has that as an easy way to make a donation for the software.
Maybe you can help me get the binary for the Linux "VESC Desktop"? I really must be missing something. I have now "donated" for Macos and android versions. I've seen Desktop on a PC, it has a lot more features. Cheers...
 
Maybe you can help me get the binary for the Linux "VESC Desktop"? I really must be missing something. I have now "donated" for Macos and android versions. I've seen Desktop on a PC, it has a lot more features. Cheers...
Yeah that's no problem, are you using the stable 6.05 firmware or the beta 6.06 firmware?
It's no problem using a later vesc tool than the firmware but the pop up warning can get annoying fast so I tend to stick to matching versions.
I can pop it up on a Google Drive folder for you if you'd like? As I know the website isn't the most intuitive.
 
Thanks, I will add a 100 O resistor. Should I expect (with or without) this resistor at the Pi end to get a regular 2.6V measure across the H and L of the CANBUS?
No need to add anything. I have those same 2ch CAN hats by waveshare,
and the resistors are on pcb, so it's just a matter of having those jumpers set up correctly.

edit: also the CANbus termination resistors should be 120 Ohms, not 100.
 
Hi folks, I am after some basic guidance on getting a raspberry pi to drive a VESC inverter via the CAN.
The main issue is that I don't seem to be getting any CAN traffic with candump on the Pi. No CAN messages from Pi have any effect on the ESC.
It's dead Jim.

I need a way to get the ESC to create a CAN message I can read on the Pi, at least as a test.
I am using VESC Tool 6 for MacOS and also Android. This version seems very basic, even tho it was paid. It doesn't say "bronze" or etc. There are not dev tools or CAN analysis tools. Are these only on PC and Linux?

Here is the pi CAN hat doc and tests which I can run fine on the Pi
The ESC is MKS 84200HP
I have wired the two Pi CAN Hat ports together and to the CAN bus on the ESC.
This is so I can run commands on can1 and dump can0.
The CAN H and CAN L have 100 ohms of resistance on the ESC, which apparently means it is not blown.

The messages I have attempted to make assume that the VESC ID is the ID in the message:

00 00 0A 00 00 27 4C 00

Was suggested online:

if your CAN ID is 76 (4C) for example : Send 0x000000A 00 00 27 4C and your motor will run at 10% Duty Cycle

Sent as
data=[0x00, 0x00, 0x0A, 0x00, 0x00, 0x27, 0x4C, 0x00]
candump shows

008 [8] 00 00 0A 00 00 27 4C 00

However, contention_id (8) and source and target id and message id (also 8, seems wrong) I don't understand.

Thanks,
Craig

Might be off base but was just using vesc tool and noticed the "Code Server" library in the VESC Packages tab.
According to the description its needed to send code to the controller from an external CAN device, could be worth checking out.
 
Thank you this thread has been really helpful!
I did get the CAN messages received ultimately. In fact the H and L wires were around the wrong way as printed on the VESC enclosure. So now I can read piles of CAN messages on my Raspi CAN hat. However, I can't write and cause the VESC to do anything with the motor. It seems I am having the problem of this VESC forum post: Able to read CAN messages from VESC but cannot write messages to CAN Bus. | VESC Project
I can write to the CAN bus and see my messages among the ones from VESC.
When I ask for duty cycle or other I get no life from the motor.
I am going to try an earlier VESC as above.
Thank you again for your support thus far!
 
Thank you this thread has been really helpful!
I did get the CAN messages received ultimately. In fact the H and L wires were around the wrong way as printed on the VESC enclosure. So now I can read piles of CAN messages on my Raspi CAN hat. However, I can't write and cause the VESC to do anything with the motor. It seems I am having the problem of this VESC forum post: Able to read CAN messages from VESC but cannot write messages to CAN Bus. | VESC Project
I can write to the CAN bus and see my messages among the ones from VESC.
When I ask for duty cycle or other I get no life from the motor.
I am going to try an earlier VESC as above.
Thank you again for your support thus far!
Okay I have this fully working and can read CAN and send CAN commands that control the VESC and motor!
It was a matter of getting the hexidecimal CAN commands right.
 
Okay I have this fully working and can read CAN and send CAN commands that control the VESC and motor!
It was a matter of getting the hexidecimal CAN commands right.
Fair play, I've seen snippets of CAN bus communication and its a lot more involved than uart, do you intend to write a customy interface/programme to issue the commands now?
 
Back
Top