Hello,
I am running CAN communication between two nodes, A to B, using cyphal and libcanard C libraries, on STM32 u585. B is subscribed for serving 3 services on port IDs: 435, 121 and 220, in this order.
I am trying to send several messages #435 (only one frame, size 4 bytes) from A to B. The first one is received correctly and accepted by canardRxAccept(). When the second message comes, the canardRxAccept() fails in cavlSearch() - it fails in CAVL_ASSERT((NULL == *n) || ((*n)->up == up)) macro. The strange thing is that if I comment out this macro, any number of messages is accepted and handled.
I tried to dig into the problem and compared difference in the first and the second message, in evaluating the macro. If I name the conditions in the macro as c1 and c2 then the first message conditions are false true while the second false false.
Going deeper, c2 defined as L == R, for the first message L= last_subscription, R=last_subscription, while for the second message L= first subscription, R=last_subscription.
Another observation - if I remove either #121 or #220 subscription then everything works correctly as expected.
Do you have any idea:
- why the first and the second message are processed differently
- if I disable the macro all messages are processed correctly?
I guess it’s some memory problem? The cavlSearch() is for some reason “lost”.
Thanx.
Best regards,
peter