Problems in sending Heartbeat?

I’m trying to send Heartbeat on a libcanard + STM32 platform specific bxCAN withina a STM32CubeIDE project.

As a bus monitor I’m using Babel + UAVCAN GUI tool on Linux.

Every second I prepare the message and pass it to the CAN transmitter this way:

static CanardInstance canard;
static const uint16_t HeartbeatSubjectID = 7509;

static inline void publishHeartbeat(void)
    static CanardTransferID transfer_id;

    uint32_t now_ticks = xTaskGetTickCount();

    uint8_t buffer[7];

    // destination offset   value bit-length
    canardDSDLSetUxx(&buffer[0], 40, 2, 8);                 // mode
    canardDSDLSetUxx(&buffer[0], 0, now_ticks / 1000, 32);  // uptime
    canardDSDLSetUxx(&buffer[0], 48, 0x7F, 8);              // vssc
    canardDSDLSetUxx(&buffer[0], 32, 2, 8);                 // health

    const CanardTransfer transfer = {.timestamp_usec = now_ticks * 1000,
                                     .priority       = CanardPriorityNominal,
                                     .transfer_kind  = CanardTransferKindMessage,
                                     .port_id        = HeartbeatSubjectID,
                                     .remote_node_id = CANARD_NODE_ID_UNSET,
                                     .transfer_id    = transfer_id,
                                     .payload_size   = sizeof(buffer),
                                     .payload        = &buffer[0]};

    uint32_t enqueued_frames = canardTxPush(&canard, &transfer);

    if (enqueued_frames < 1)
        // TODO: manage error


The message goes all the way through to UAVCAN GUI, but can’t be decoded beacuse:

  • <unknown message 32085>
  • Toggle bit value 32 incorrect on frame 0

I paste below the associated screenshot:

Any clues on what I may be missing/doing wrong?

Thanks in advance.


Looks like you’re using libcanard v1, which uses the v1.0 version of the protocol. The GUI tool is being replaced with Yukon, which unfortunately isn’t ready for prime time, and as such hasn’t been updated for v1, and is still running the v0 version of the protocol. A giveaway is uavcan.protocol.NodeStatus, which was a standard message type in v0 but does not exist in v1.

You’re best bet is to switch to Yakut for testing until Yukon is ready.

1 Like

Thanks for your reply, David.
I’m new to UAVCAN world and I must admit I’m experiencing quite a flat learning curve.
My goal is to control from an STM32 six Zubax Myxa(s) and now I’m starting to grow the concern that they also use the v0 version of the protocol (and therefore my V1 integration efforts are useless).