# Incorrect RX CanardTransfer.payload\_size

**URL:** <https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158>\
**Category:** Libcanard\
**Created:** [March 18, 2021, 6:04pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158 "2021-03-18T18:04:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nburkitt](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nburkitt](https://forum.opencyphal.org/u/nburkitt)\
**Post date:** [March 18, 2021, 6:04pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/1 "2021-03-18T18:04:46Z")

</div>

Hi.

When sending both single- and multi-frame CanardTransfers, I’ve found that the value of payload\_size on the receiving node differs from its value on the sending node. For example, here is an excerpt from my logger output on the receiving node. The parenthesized value is the value of CanardTransfer.payload\_size on the sending node.

“incorrect length: 147 (144)”  
“incorrect length: 108 (100)”  
“incorrect length: 124 (115)”  
“incorrect length: 92 (86)”  
“incorrect length: 15 (14)”  
“incorrect length: 31 (25)”

The reported size is always larger than the expected size, and the difference to the correct value appear to be consistent for a given length, but varies from 1 to 9.  
Is this expected behavior?

Version info:

#define CANARD\_VERSION\_MAJOR 1  
#define CANARD\_VERSION\_MINOR 0

#define CANARD\_UAVCAN\_SPECIFICATION\_VERSION\_MAJOR 1  
#define CANARD\_UAVCAN\_SPECIFICATION\_VERSION\_MINOR 0

Thanks,

-Nick

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 18, 2021, 6:08pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/2 "2021-03-18T18:08:47Z")

</div>

> [@nburkitt](#):
>
> Is this expected behavior?

If you are using CAN FD, yes. Related sections of the Specification:

- 3.7.1.3 **Implicit truncation of excessive data**
- 4.2.2.3 **Transfer payload decomposition**

---

<div class="post-metadata">

**Author:** ![nburkitt](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nburkitt](https://forum.opencyphal.org/u/nburkitt)\
**Post date:** [March 18, 2021, 6:46pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/3 "2021-03-18T18:46:56Z")

</div>

Hi @pavel.kirienko.

Yes, we’re using CAN FD. It’s easy enough to deal with now that I know to expect that behavior.  
Thanks much,

-Nick

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 18, 2021, 6:48pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/4 "2021-03-18T18:48:02Z")

</div>

> [@nburkitt](#):
>
> It’s easy enough to deal with

Why do you need to deal with it? DSDL (auto-generated deserialization code) handles it for you.

---

<div class="post-metadata">

**Author:** ![nburkitt](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nburkitt](https://forum.opencyphal.org/u/nburkitt)\
**Post date:** [March 18, 2021, 7:05pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/5 "2021-03-18T19:05:57Z")

</div>

Hi @pavel.kirienko.

One thing at a time. 🙂 Besides, I’m not sure how to describe unformatted, variable-length binary data using DSDL. Not that I’ve had any time to look into it.

-Nick

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [March 18, 2021, 7:08pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/6 "2021-03-18T19:08:29Z")

</div>

Okay. To save you time:

```auto
uint32 CAPACITY = 1024 ** 2
uint8[<=CAPACITY] unformatted_data
@extent CAPACITY * 8 * 2

```

If the required capacity is under 256 bytes you can just use [**`uavcan.primitive.Unstructured.1.0`**](https://github.com/UAVCAN/public_regulated_data_types/blob/master/uavcan/primitive/Unstructured.1.0.uavcan).

---

<div class="post-metadata">

**Author:** ![nburkitt](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/n/f07891/32.png) [@nburkitt](https://forum.opencyphal.org/u/nburkitt)\
**Post date:** [March 18, 2021, 8:37pm UTC](https://forum.opencyphal.org/t/incorrect-rx-canardtransfer-payload-size/1158/7 "2021-03-18T20:37:59Z")

</div>

Thanks - it’s on my to-do list. 🙂

-Nick
