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

具体支持是哪一个ISO 14229版本? #3

Closed
driftregion opened this issue Jun 28, 2021 · 4 comments
Closed

具体支持是哪一个ISO 14229版本? #3

driftregion opened this issue Jun 28, 2021 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested

Comments

@driftregion
Copy link

我在用一个udsoncan客户端做测试

UDS_S32K144_Bootloader的回复长度写的是2.

  can1  74C   [3]  02 10 03
  can1  75C   [8]  02 50 03 00 00 00 00 00 

udsoncan的文档意味着现在回复不符合2013年以上的标准。
https://udsoncan.readthedocs.io/en/latest/_modules/udsoncan/services/DiagnosticSessionControl.html#DiagnosticSessionControl.interpret_response

有至少三个ISO 14229版本:2006, 2013, 2020。

好像是向后兼容。为了大家能方便一些的开PR,该项目要支持哪一些ISO 14229版本?

谢谢大佬!

@SummerFalls
Copy link
Owner

SummerFalls commented Jun 29, 2021

@driftregion 你的中文很不错 👍 👍 👍

我将 udsoncan.services.DiagnosticSessionControl.ResponseData 中的说明引用到了下面:

session_echo

Request subfunction echoed back by the server

session_param_records

Raw session parameter records. Data given by the server. For 2006 configurations, this data can is manufacturer specific. For 2013 version and above, this data correspond to P2 and P2* timing requirement.

p2_server_max

Default P2 max timing supported by the server for the activated diagnostic session. Applicable for 2013 version and above. Value in seconds.

p2_star_server_max

Default P2* (NRC 0x78) max timing supported by the server for the activated diagnostic session. Applicable for 2013 version and above. Value in seconds

根据以上描述,在 ISO-14229 2013 的版本之后,才会包含 P2Server 和 P2*Server 的数据,故当前 UDS_S32K144_Bootloader 是符合 ISO-14229 2006 的版本。

所以,根据实际情况,你有两种方法使其运行起来:

  • 方案1 🥇 :你可以根据你想要兼容的版本对本工程的代码进行调整,你大致需要修改 ./UDS_ProtocolStack/uds_app_cfg.c 中的 static void DigSession(struct UDSServiceInfo *i_pstUDSServiceInfo, tUdsAppMsgInfo *m_pstPDUMsg) 函数以适配 2013 之后的版本。

case 0x03u : /* Extend mode */
case 0x83u :
SetCurrentSession(EXTEND_SESSION);
if (0x83u == RequestSubfunction)
{
m_pstPDUMsg->xDataLen = 0u;
}
/* Restart S3Server time */
RestartS3Server();
break;

例如 P2Server = 50 ms = 0x0032,P2*Server = 5000 ms = 0x1388

则有积极响应:06 50 03 00 32 13 88 00

/* 修改后,适配 ISO-14229 2013 & 2020 */
        case 0x03u :  /* Extend mode */
        case 0x83u :
#define UDS_P2______SERVER (50)
#define UDS_P2_STAR_SERVER (5000)
            m_pstPDUMsg->aDataBuf[2u] = (UDS_P2______SERVER >> 8u) & 0xFFu;
            m_pstPDUMsg->aDataBuf[3u] = (UDS_P2______SERVER >> 0u) & 0xFFu;
            m_pstPDUMsg->aDataBuf[4u] = (UDS_P2_STAR_SERVER >> 8u) & 0xFFu;
            m_pstPDUMsg->aDataBuf[5u] = (UDS_P2_STAR_SERVER >> 0u) & 0xFFu;
            m_pstPDUMsg->xDataLen = 6u;
            SetCurrentSession(EXTEND_SESSION);

            if (0x83u == RequestSubfunction)
            {
                m_pstPDUMsg->xDataLen = 0u;
            }

            /* Restart S3Server time */
            RestartS3Server();
            break;
latest_standard = 2006

@SummerFalls
Copy link
Owner

TP层协议版本兼容 ISO-15765-2 2004 & 2016

@SummerFalls SummerFalls self-assigned this Jun 29, 2021
@SummerFalls SummerFalls added documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested labels Jun 29, 2021
@SummerFalls SummerFalls pinned this issue Jun 29, 2021
@SummerFalls
Copy link
Owner

CN:由于篇幅有限,我将以下宏定义放在了代码段中,实际上,将其放在 ./UDS_PortingFiles/user_config.h 会更好。

EN:For convenience, I put the following macro definition code in the code snippet above, but it would be better to put it in ./UDS_PortingFiles/user_config.h

#define UDS_P2______SERVER (50)
#define UDS_P2_STAR_SERVER (5000)

@driftregion
Copy link
Author

感谢你的仔细答案!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants