Controlling multiple Myxa over UAVCAN-v0

I’m trying to control multiple Myxas over UAVCAN-v0 line from a C language STM32 application.
For debugging I’m checking the traffic over CAN with a Babel board and UAVCAN Tool GUI.

So far I have succeeded in

  • Broadcasting Node Status
  • Replying to GetNodeInfo

The part I’m experiencing problems with is ESC control.
This is the code I call every 100ms to update their value (for the sake of testing I set them all to the same RPM)

    static inline void publishSetEscRPM(int32_t new_rpm)
    {
        static uint8_t transfer_id;

        uint8_t buffer[UAVCAN_ESC_RPM_COMMAND_MESSAGE_SIZE];

        memset(buffer, 0, UAVCAN_ESC_RPM_COMMAND_MESSAGE_SIZE);

        for (uint_fast8_t i = 0; i < M3U_MOTOR_NO; i++)
        {
            canardEncodeScalar(&(buffer[0]), 0 + (18UL * i), 18, &new_rpm);
        }
        const int16_t enqueued_frames = canardBroadcast(&canard,
                                                        0,
                                                        UAVCAN_ESC_RPM_DATA_TYPE_ID,
                                                        &transfer_id,
                                                        CANARD_TRANSFER_PRIORITY_HIGH,
                                                        &(buffer[0]),
                                                        UAVCAN_ESC_RPM_COMMAND_MESSAGE_SIZE);

        (void) enqueued_frames;
    }

As long as I remain within one single CAN telegram, which implies

M3U_MOTOR_NO = 3
UAVCAN_ESC_RPM_COMMAND_MESSAGE_SIZE=7

everything works smoothly.

But if I try with

M3U_MOTOR_NO = 4
UAVCAN_ESC_RPM_COMMAND_MESSAGE_SIZE=9

I cant’ control Myxa anymore and UAVCAN Tool GUI complains about

Transfer Error. CRC mismatch

I’m confused by the fact that the mutli-CAN-frame GetNodeInfo reply goes through flawlessly.

Any suggestions?

Thank you.

You are setting the data type signature to zero (second argument to canardBroadcast), hence the CRC is computed incorrectly. If you used the correct signature it would be working properly.

It makes perfectly sense.

Thank you.

For anybody who may be interested, signatures for standard namespace uavcan may be found here.