Homepage GitHub

Working example of libcanard

I have been trying for some time on a number of boards and firmware to get a working example of libcanard.
Each time I fail to see any messages on uavcangui and the board gets stuck in the tx loop.
I have tried the libcanard tutorials on zubax babel and on stm32f103 boards, using ac6 (sw4stm ) and generating base project any copying code across.
I have also tried LIbcanard on freeRTOS SUCCESSFULl! this one , a freertos libcanard version on the zubax babel board and stmf103 board using a similar method on sw4stm.
I also got the original makefile project and imported it as makefile project in sw4stm and built and loaded the resulting binary onto the board and still did not see any messages on uavcan gui.

Can anyone point me to any easy way to get a sample code of libcanard working?
Or a way to find out why it is not working for the projects I have already tried?
This shouldn’t be hard once you get it to build so I am at a loss.
If anyone has an sw4stm project that works that would be ideal.


Hi Kent, your description suggests that you are probably dealing with some minor hardware configuration issue. Unfortunately, I can’t offer more detailed insights based on your posts; if you are looking for someone to walk you through the process, consider posting in the jobs section.

You can see if this can serve you as an example:

There is a freertos and a bare metal version of the same firmware. We use CubeMX to generate the code with Makefile option. Then edit the USER code sections. This is quite straightforward.

You can start looking here: https://github.com/octanis-instruments/oibus-mosfet-driver-module/blob/master/freertos-firmware/Src/freertos.c

There is a task that handles UAVCAN at line 174. While this code runs fine, it’s less than pretty :slight_smile: Hope this helps.

1 Like

On that note, I personally never managed to get systemworkbench to work. We use vscode and makefile onle. https://wiki.octanis.org/stm32/vscode?s[]=stm32

You can try this demo:

in Platform.io. Surely works on stm32f103c8 (aka “Blue Pill”), the node is discoverable in UAVCAN GUI. Just be sure you set CAN speed right on you UAVCAN GUI side (250kbaud) and connect CAN transceiver to the right pins (A11, A12) as stated in the repo README.

If you don’t want to use PlatformIO, you can try the original code source: https://github.com/skyyuzhang/UAVCAN_NODE_FreeRTOS

1 Like

Thanks all I finally got it working on the zubax and then on a stmf413 nucleo board.
I had a lot of trouble getting the SPL to work with the device header definitions from cubemx.
But finally changed or added missing/different defines. It’s quite a process to go through to get it going in sw4stm, but IMO necessary to make it portable. Having device headers with matching SPL would make things a lot easier. I might take a look at a few rtos example now and start down that path for the next stage.