Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder(Unified Diagnostic Services RAW encoder / decoder)
Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder [message #1794920] Tue, 11 September 2018 06:43 Go to next message
Michael Josenhans is currently offline Michael JosenhansFriend
Messages: 99
Registered: February 2016
Member
I have created a subset of the Unified Diagnostic Services (UDS) ISO 14229.

type enumerated SuppressPosRspMsgIndicationBitType {
  doNotsuppresssPos (0),
  suppresssPos      (1)
}
with {variant "FIELDLENGTH(1)"}

type OCT1 DiagnosticSessionType

type record DefaultSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('01'O)
} with { variant "" };

type record ProgrammingSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('02'O)
} with { variant "" };

type record ExtendedDiagnosticSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('03'O)
} with { variant "" };

type record SafetySystemDiagnosticSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('04'O)
} with { variant "" };

type union DiagnosticSessionRequestType
{
  DefaultSessionRequest                  defaultSession,
  ProgrammingSessionRequest              programmingSession,
  ExtendedDiagnosticSessionRequest       extendedDiagnosticSession,
  SafetySystemDiagnosticSessionRequest   safetySystemDiagnosticSession
}
with {variant "TAG	(
  defaultSession,                diagnosticSessionType = '01'O;
  programmingSession,            diagnosticSessionType = '02'O;
  extendedDiagnosticSession,     diagnosticSessionType = '03'O;
  safetySystemDiagnosticSession, diagnosticSessionType = '04'O)";
  variant "FIELDLENGTH(7)"
}

type record DiagnosticSessionControlRequestSID
{
  SID                                   sid ('10'O),
  SuppressPosRspMsgIndicationBitType    suppressPosRspMsgIndicationBit,
  DiagnosticSessionRequestType          diagnosticSessionType
} with { variant "FIELDORDER(msb)" }; 

type record TesterPresentRequestSID
{
  SID                                   sid  ('3E'O),
  SuppressPosRspMsgIndicationBitType    suppressPosRspMsgIndicationBit,
  BIT7                                  zero ('0000000'B)
} with { variant "FIELDORDER(msb)" };


The SuppressPosRspMsgIndicationBitType (1 bit) forms together with the following 7 bit type when encoding / decoding a Byte. That's why I have defined DiagnosticSessionRequestType as FIELDLENGTH(7).

When encoding / decoding DiagnosticSessionRequestType encodes to a 3 byte value instead of the expected 2 byte value '1083'O and decodes even to a differnt than the encoded value (after decoding the suppressPosRspMsgIndicationBit changes from suppresssPos to doNotsuppresssPos):
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := suppresssPos (1), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '100600'O
MTC@Donald: '100600'O
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := suppresssPos (1), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '100600'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Stream before decoding: '100600'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Decoded @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := doNotsuppresssPos (0), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := doNotsuppresssPos (0), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }


TesterPresentRequestSID with the paramter suppresssPos (1) encodes to '3E80'O, what it should:
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '3E80'O
MTC@Donald: '3E80'O
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '3E80'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Stream before decoding: '3E80'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Decoded @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }


Is it necessary to change the DiagnosticSessionRequestType to:

type BIT7 DiagnosticSessionType

type record DefaultSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('0000001'B)
} with { variant "" };

type record ProgrammingSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('0000010'B)
} with { variant "" };

type record ExtendedDiagnosticSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('0000011'B)
} with { variant "" };

type record SafetySystemDiagnosticSessionRequest {
  DiagnosticSessionType     diagnosticSessionType ('0000100'B)
} with { variant "" };

type union DiagnosticSessionRequestType
{
  DefaultSessionRequest                  defaultSession,
  ProgrammingSessionRequest              programmingSession,
  ExtendedDiagnosticSessionRequest       extendedDiagnosticSession,
  SafetySystemDiagnosticSessionRequest   safetySystemDiagnosticSession
}
with {variant "TAG	(
  defaultSession,                diagnosticSessionType = '0000001'B;
  programmingSession,            diagnosticSessionType = '0000010'B;
  extendedDiagnosticSession,     diagnosticSessionType = '0000011'B;
  safetySystemDiagnosticSession, diagnosticSessionType = '0000100'B)";
  variant "FIELDLENGTH(7)"
}
Re: Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder [message #1794933 is a reply to message #1794920] Tue, 11 September 2018 09:55 Go to previous messageGo to next message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 53
Registered: February 2016
Member
Hi,

yes, it's necessary to change the type of DiagnosticSessionType to BIT7. You could also create separate DiagnosticSessionType types for requests and responses, if the response types still need an OCT1 field.

Even with this change the enumerated field is still encoded incorrectly. I'm currently investigating this issue.

Best regards,
Botond Baranyi
Re: Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder [message #1794986 is a reply to message #1794920] Wed, 12 September 2018 08:59 Go to previous message
Botond Baranyi is currently offline Botond BaranyiFriend
Messages: 53
Registered: February 2016
Member
Hi,

for the second issue: the attribute 'FIELDORDER(msb)' does not extend to lower level records/sets. Because of this the 1 bit for the enumerated type is encoded as the MSB in the octet, and the 7 bits in the ...SessionRequest records are encoded with LSB first (thus overwriting the enum's bit).

This is an undocumented limitation of the attribute FIELDORDER.
To fix this you'd need to add the attribute 'FIELDORDER(msb)' to the ...SessionRequest records.

Like this:
type record DefaultSessionRequest {
  RequestDiagnosticSessionType     diagnosticSessionType ('0000001'B)
} with { variant "FIELDORDER(msb)" };

type record ProgrammingSessionRequest {
  RequestDiagnosticSessionType     diagnosticSessionType ('0000010'B)
} with { variant "FIELDORDER(msb)" };

type record ExtendedDiagnosticSessionRequest {
  RequestDiagnosticSessionType     diagnosticSessionType ('0000011'B)
} with { variant "FIELDORDER(msb)" };

type record SafetySystemDiagnosticSessionRequest {
  RequestDiagnosticSessionType     diagnosticSessionType ('0000100'B)
} with { variant "FIELDORDER(msb)" };


Best regards,
Botond Baranyi
Previous Topic:Titan intermediate release 6.4.1
Next Topic:Limitation on TTCN support.
Goto Forum:
  


Current Time: Fri Mar 29 01:13:08 GMT 2024

Powered by FUDForum. Page generated in 0.05329 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top