Homepage GitHub

VESC UAVCAN support


#1

Hello,
we want to modify slightly the uavcan so that it could be compatible with the VESC CAN protocol. How should we proceed thanks

An other solution would be to take an orel20 or a Myxa but it’s not powerful enough for our application. we need 12s and 1500W


(Pavel Kirienko) #2

Hello,

You are approaching the problem from the wrong end. VESC uses their own homebuilt CAN protocol; UAVCAN is a cross-vendor compatible specification. Instead of changing UAVCAN, you should change your VESC to make it support UAVCAN: https://github.com/vedderb/bldc/issues/5

VESC is open source so you should be able to submit the necessary changes easily.


#3

Hello Pavel,

that’s right. I’m considering now to use libcanard inside VESC to support uavcan. That’s a pity it has not already been done since I will spend quite a lot of time to implement it. I’m not a heavy C++ developer.
I find the VESC CAN implementation easier to understand than libuavcan, but that’s probably only a wrong feeling


(Pavel Kirienko) #4

You shouldn’t confuse libcanard and libuavcan, they are quite different. Libcanard is implemented in C99, libuavcan is written in C++. The latter is far more complex and feature-rich, it would probably be an overkill for VESC, so I suggest you to focus on libcanard.


#5

ok, I focus on libcanard. I’m strugeling with the CAN driver. Can I use the libcanard can driver on VESC or am I obliged to use the CAN driver provided with the VESC project?
Thanks


(Pavel Kirienko) #6

Libcanard is completely agnostic of its driver layer, unlike libuavcan, so you should be able to use whatever suits you better:


#7

can you provide an exemple of the stm32 can driver provided with libcanard?
the demo.c example don’t use that driver.
Thanks


(Pavel Kirienko) #8

This bootloader project uses libcanard with its stock driver: https://github.com/Zubax/zubax_gnss/blob/master/bootloader/src/board/can.hpp and https://github.com/Zubax/zubax_gnss/blob/master/bootloader/src/uavcan.cpp


#9

sorry, I gave up on this. The libcanard project driver is far from being as easy as it seems. The CAN frame format is completely different between VESC and libcanard, and the stm32 driver relies on it, so we have to use the libcanard embedded stm32 driver to make the project work. But the hardware initialization of this driver is very poorly documented. The VESC project relies heavily on CAN for its configuration. Changing it to libcanard would require us to change the GUI as well.


(Pavel Kirienko) #10

But the hardware initialization of this driver is very poorly documented.

Which part is not clear? We can update the docs if necessary.

The VESC project relies heavily on CAN for its configuration. Changing it to libcanard would require us to change the GUI as well.

There’s UAVCAN GUI tool though. Works with any UAVCAN node, although it’s obviously very generic.


#11

the CAN bus driver initialization part is not clear
canardSTM32Init does require us to activate the clock and the can bus prior using this function. It does not tell us how and there isn’t any simple example.
Additionally the doc tells us that libcanard does not use interrupt, the VESC does use it. Won’t there be any conflict somewhere?


(Pavel Kirienko) #12

Because this is explained in the user documentation for the MCU, so it is considered trivial. Providing examples would likely be counterproductive because the register names and bit names differ between MCU within the same family, so may lead to errors and confusion. You must read the user manual for your MCU anyway.

No.