Homepage GitHub

Libcanard for UAVCAN/CAN v1 is released

Libcanard v0.100, implementing UAVCAN/CAN v1, is now available:

Key features:

  • Full test coverage and static analysis.
  • Partial compliance with automatically enforceable MISRA C rules (compliance report not available).
  • Detailed time complexity and memory requirement models for the benefit of real-time high-integrity applications.
  • Purely reactive API without the need for background servicing.
  • Support for CAN FD.
  • Support for redundant transports.
  • Compatibility with 8/16/32/64-bit platforms.
  • The API operates on contiguous memory buffers instead of scattered linked blocks.
  • Compatibility with extremely resource-constrained baremetal environments starting from ca. 32K ROM, 4…8K RAM.
  • Implemented in less than 1500 logical lines of code.

API stabilization is expected by 2020Q4 or earlier. Starting now, it is expected to be safe to commence a new project reliant on UAVCAN v1.0 based on Libcanard and/or PyUAVCAN. Libuavcan v1 (a major C++11 implementation) and Yukon (the new GUI tool) are expected to become available before the end of 2020.


That’s great news! Congratulations for the awesome work.

I have noticed that the drivers have disappeared, do you plan to move them to a separate repo?


Yeah. I just updated the README to make it clearer. The new place is here:

As of right now, it is quite empty, so please navigate to the branch legacy-v0 – the code there is intended for the old version of the library but the changes necessary for its adaptation for the new Libcanard are quite minimal. I am going to migrate the driver for STM32 and SocketCAN in the short order. Speaking of SocketCAN, it’s going to be available for NuttX soon as well: SocketCAN API on a RTOS.

1 Like

hey .how to test with version 1 for mpc microcontrollers?
how can we test without using zubax ?

Libcanard is platform-agnostic. You just need to implement the low-level CAN IO routines yourself and integrate them with the library as explained in the README.

okay, since i developed version1 canard for mpc micro-controller do i need any zubax babel (as recommended for version 0)for testing purpose or i can test as explained in README.

Is there a particular reason why canardRxAccept and rxSessionUpdate does not return the error codes which are the cause of the problem while in the code the cause is clear?

For example:

canard.c:1054 out = 0;  // No matching subscription.
canard.c:1059 out = 0;  // Mis-addressed frame (normally it should be filtered out by the hardware).
canard.c:1064 out = 0;  // A non-UAVCAN/CAN input frame.
canard.c:835 if (correct_transport && correct_toggle && correct_tid)

Because the states you mentioned are not errors.

You can use any CAN hardware. Our libraries are platform-agnostic.

Why memory allocation error comes during frame queue allocation? I am using your heap.c to allocate memory as mentioned in README.md.

CanardInternalTxQueueItem* const out =
    (CanardInternalTxQueueItem*) ins->memory_allocate(ins, sizeof(CanardInternalTxQueueItem) + payload_size);

A memory allocation error means that you’re out of memory.

how come source node id and destination node id is same in my case?

Generally, when dealing with a technical problem like yours, good questions yield good answers. I am unable to help you because you didn’t provide much relevant information.

For sending of data, i am assigning values to payload pointer and after TXpush and Tx peek able to send the data using my driver send function.similarly how to receive data using canard?
As per README in RXaccept:

const int8_t result = canardRxAccept(&ins,
                                     &received_frame,            // The CAN frame received from the bus.
                                     redundant_interface_index,  // If the transport is not redundant, use 0.

I am converting my driver format to &received_frame format and passing it,i am getting the value of result as 0 ,and during debugging i found that source and destination node are same.so i am asking a proper method to receive frame sucessfully.
I have a mpc driver so how i wll test its working?

Either the received frame is converted incorrectly or the sender emits invalid frames.

as far i understand the sending(Txpush,pop,peek)and receiving(rx accept)are independent of each other,
okay if received frame conversion causes an error than why source node and destination node are same
i am new to canard

This forum may not be the best place for learning the basics. I’m sorry but we are unable to debug your code for you. Consider asking at stackoverflow or somewhere else.

1 Like