I’m confused about tranfer-ID.
I made "static uint8_t my_message_transfer_id;"And “+ + my_message_transfer_id;”
However, when I sent the transfer-ID, I did not send it to the receiver, but only transmitted the data(.payload) to the receiver. So how to set the tail byte of the data I sent?
uint8_t my_msg[10] = {0};
canardDSDLSetUxx(&my_msg[0], 0, 10, 8);
canardDSDLSetUxx(&my_msg[0], 8, 110, 8);
canardDSDLSetUxx(&my_msg[0], 16, 120, 8);
canardDSDLSetUxx(&my_msg[0], 24, 87, 8);
canardDSDLSetUxx(&my_msg[0], 32, 12, 8);
canardDSDLSetUxx(&my_msg[0], 40, 99, 8);
canardDSDLSetUxx(&my_msg[0], 48, 0xDEADAA, 24);
// ----------------------------------- how to set the tail byte ---------------------------------------------------------------------------------
canardDSDLSetUxx(&my_msg[0], 72, ?????, 8); // how to set the tail byte ?
static uint8_t mymsg_transfer_id;
const CanardTransfer mytransfer = {
.timestamp_usec = 0,
.priority = CanardPriorityNominal,
.transfer_kind = CanardTransferKindMessage,
.port_id = 32080, // This is the subject-ID.
.remote_node_id = CANARD_NODE_ID_UNSET, // Messages cannot be unicast, so use UNSET.
.transfer_id = mymsg_transfer_id,
.payload_size = 10,
.payload = &my_msg[0],
};
++mymsg_transfer_id;
int32_t myresult = canardTxPush(&ins, &mytransfer);
……………………(omit)
uint8_t fail_count;
FDCAN_TxHeaderTypeDef *txmsg = NULL;
for (const CanardFrame* txf = NULL; (txf = canardTxPeek(&ins)) != NULL;) // Look at the top of the TX queue.
{
printf("enter txmsg:\n");
uint8_t sendbuf[64] = {0};
txmsg->Identifier = txf->extended_can_id; //32085txf->extended_can_id
txmsg->DataLength = (txf->payload_size-1) << 16 & 0x000F0000U; //to set the stm32 FDCAN_TxHeaderTypeDef
txmsg->IdType = FDCAN_EXTENDED_ID;
txmsg->FDFormat = FDCAN_FD_CAN;
txmsg->TxFrameType = FDCAN_DATA_FRAME;
txmsg->BitRateSwitch = FDCAN_BRS_OFF;
txmsg->TxEventFifoControl = FDCAN_STORE_TX_EVENTS;
txmsg->ErrorStateIndicator = FDCAN_ESI_ACTIVE;
txmsg->MessageMarker = 0x01;
memcpy(sendbuf,txf->payload,(txf->payload_size-1));
//-------------use stm32 fdcan send to the receiver ,only send buf, do not send transfer-id to receiver------------------------------
HAL_StatusTypeDef ret = HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, txmsg, sendbuf);
HAL_FDCAN_Start(&hfdcan1); /