Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAN-FD transport MAX_DLC_REQUIRED #158

Open
danielhrisca opened this issue Jan 11, 2024 · 4 comments
Open

CAN-FD transport MAX_DLC_REQUIRED #158

danielhrisca opened this issue Jan 11, 2024 · 4 comments

Comments

@danielhrisca
Copy link
Contributor

I think that the way MAX_DLC_REQUIRED is handled for CAN-FD should be revised.

In the current implementation this is automatically set to True for CAN-FD (see

self.max_dlc_required = self.config.get("MAX_DLC_REQUIRED") or self.canInterface.is_fd
)

SRS_Can_01160 does not state that a maximum frame length must be used, it only talks about padding the frame up to the next CAN-FD DLC value, which is also correctly implemented in the pad_frame function (

def padFrame(frame: bytes, padding_value: int, padding_len: int = 0) -> bytes:
)

SWS_Can_00502] ⌈ If PduInfo->SduLength does not match possible DLC values 
CanDrv shall use the next higher valid DLC for transmission with initialization of 
unused bytes to the value of the corresponding CanFdPaddingValue (see 
ECUC_Can_00485).⌋ ( SRS_Can_01160)

On the other hand the XCP on CAN specification only talks about MAX_DLC_REQUIRED which would then result in 8 or 64 bytes frames.

@christoph2
Copy link
Owner

Yes, FD-frame padding is only required if SduLength does not exactly matches a discrete DLC value.
The fix will be included in the next big release.

@danielhrisca
Copy link
Contributor Author

And only for autosar

@Funth0mas
Copy link

(disclaimer: I don't know XCP-over-CAN specification) The Autosar implementation from EB seem to require minimal DLC=8 on CANfd. It ignores shorter frames. C'est la vie...

@christoph2
Copy link
Owner

The FD padding behavior is fixed in the (hopefully soon) coming release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants