Skip to contentSkip to conversation

can-bcm: Best practice for dynamic data in frames?

DISCUSSION Patrick Menschel 1 participant 1 message May 13, 2022 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hello,

I'd like to ask about best practice to dynamically change the data bytes of a frame that is sent via broadcast-manager, each time after it was sent.

I came up with the following concept but maybe there is a more "professional" way to do it.

1.
I set up my initial frame with valid data and send it with interval to BCM as I do with regular cyclic transmits.
BcmOpCodes = TX_SETUP
BCMFlags = SETTIMER | STARTTIMER
...

APP BCM
| --> | id 123 data 00 11 22 33 44 55 66 77

2.
I set up a can raw socket with a filter for exactly that frame id and wait for the frame.

APP RAW
| <-- | id 123 data 00 11 22 33 44 55 66 77

3.
Then I change the dynamic data, in this case a message counter in the first byte and then update the frame in BCM.

BcmOpCodes = TX_SETUP
BCMFlags = 0
...

APP BCM
| --> | id 123 data 01 11 22 33 44 55 66 77

This merry-go-around goes on as long as the application is running. The purpose is some sort of heartbeat.

Thanks and Best Regards,
Patrick