Reputation: 1
I have one CAN standard 2.0A frame which contain 8 Bytes of DATA. e.g CAN Frame Data "00 CA 22 FF 55 66 AA DF" (8 Bytes) Now I want to check how many stuff bits would be add in this CAN frame(bit stuffing). standers formula to calculate the Worst case bit stuffing scenario is as following: 64+47+[(34+64-1)/4] ->64 :: Data bits and 47 :: overhead bits 2.0A
How to calculate real stuffed bits in this sample CAN message ?? Any comment, suggestion would be warmly welcome.
Upvotes: 0
Views: 1445
Reputation: 2870
There is no way to mathematically "calculate" the stuffed bits. You need to construct the frame (on bit level), traverse the bits, and count.
You could read more about bit stuffin at the link below.
https://en.wikipedia.org/wiki/CAN_bus#Bit_stuffing
Basic principle:
1. Contruct the can frame on bit level
2. Start at frame start bit. When 5 consecutive bits of same polarity is found than insert a bit of opposite polarity.
3. Continue to CRC delimeter (CRC delimeter is excluded)
Upvotes: 1