You are here

CAN Bus Control by External Host

4 posts / 0 new
Last post
josh
josh's picture
Offline
Last seen: 6 months 4 days ago
VESC Original
Joined: 2017-05-24 12:15
Posts: 92
CAN Bus Control by External Host

Hello everyone,

I am currently working to implement CAN bus control of multiple VESC's from an external microcontroller host since it is the most robust communication between them IMO. So far I have been able to send commands to each VESC with the extended ID frame and successfully execute commands such as set_current() and set_duty(). The next thing I would like to do is receive data from each VESC about voltages, currents, RPM's, faults, etc.

I see that the Send Status Over Can option results in a status frame being sent containing the ID, RX Time, RPM, Current, and Duty. However, I would like to have access to all the data, like in the Real-Time Data of VESC Tool. I also see that when I connect to a VESC over CAN through another VESC and access the Real-Time Data, it packs and sends the data with the comm_can_send_buffer function. What would be the best way for me to have my external host request this information and interpret it over the CAN? 

Additionally, I would like to make use of the traction control option as well. Since I am not using any one VESC as a host or master device with an app, would it be best for me to handle this with my host device or is there a way to configure the VESC's to still do this by themselves?

Cheers!

fourchette
Offline
Last seen: 2 years 11 months ago
Joined: 2018-11-07 19:29
Posts: 16

I do not have an answer to your question. but I agree with you that interfacing with VESCs in a multi-VESC scenario is better using the CAN bus. 

What is microcontroller did you use as your external controller? Did you use a particular lib to use the UART interface and CAN bus or did you write your own? 

josh
josh's picture
Offline
Last seen: 6 months 4 days ago
VESC Original
Joined: 2017-05-24 12:15
Posts: 92

Hello fourchette,

I am currently building my project on the TI msp432p401r chip and the CC2640R2 ble module. They are both arm based and share the same real-time os and driver libraries by ti. I have written my own driver for the MCP2515 SPI CAN controller and have successfully interfaced with the VESC after looking through Ben's code. I currently can send commands (current or duty) to any VESC on the bus and also request the real-time data and process and read the buffer. I am still looking into the traction control and if there is a way to handle that on the VESC side without any active app. It is also curious that in the real-time data (mc_values) there is a vesc_id field, however, it seems that this value is not sent over in the buffer with everything else. Does anyone know of a way to enable this or am I missing something?

Here are some links to some of Ben's code for his autonomous rc car project where he interfaces with the VESC over can, I used this as reference to develop my drivers: 

https://github.com/vedderb/rise_sdvp/tree/master/Embedded/RC_Controller

Cheers!

Jack_Li
Offline
Last seen: 4 years 11 months ago
Joined: 2019-07-01 05:03
Posts: 12

hi,josh,how about your project? shenther you can update your newst result?

jack li