When I used PCAN-UDS TP API to send a request message to the ECU and try to read the respond message,the UDS_Read returned PUDS_ERROR_NO_MESSAGE.Actully,the ECU did respond with a POSITIVE_RESPOND_MESSAGE.
Here CAN Message screenshot: Here's my code:
Code: Select all
void CUDSDlg::OnBnClickedButtonBoschUds()
{
TPUDSMsg MsgUDS_READ;
TPUDSMsg MsgUDS_WRITE;
TPUDSStatus result;
MsgUDS_WRITE.LEN = 2;
MsgUDS_WRITE.DATA.RAW[0] = 0x10;
MsgUDS_WRITE.DATA.RAW[1] = 0x81;
MsgUDS_WRITE.MSGTYPE = PUDS_MESSAGE_TYPE_REQUEST;
MsgUDS_WRITE.NETADDRINFO.SA = 0xFA;
MsgUDS_WRITE.NETADDRINFO.TA = 0x00;
MsgUDS_WRITE.NETADDRINFO.TA_TYPE = PUDS_ADDRESSING_PHYSICAL;
MsgUDS_WRITE.NETADDRINFO.RA = 0x00;
MsgUDS_WRITE.NETADDRINFO.PROTOCOL = PUDS_PROTOCOL_ISO_15765_2_29B;
MsgUDS_WRITE.NO_POSITIVE_RESPONSE_MSG = PUDS_KEEP_POS_RSP_MSG_INDICATION_BIT;
result = UDS_Initialize(PUDS_USBBUS1, PUDS_BAUD_250K);//Degug Point A: result == 0x00; OK
if (result != PUDS_ERROR_OK)
{
MessageBox(L"Initialize Fail.");
}
result = UDS_Write(PUDS_USBBUS1, &MsgUDS_WRITE);//Degug Point B: result == 0x00; OK
if (result != PUDS_ERROR_OK)
{
CString str;
str.Format(L"Error Code = %d", result);
str += L",Send Failure.";
MessageBox(str);
PostMessage(WM_CLOSE);
}
result = UDS_Read(PUDS_USBBUS1, &MsgUDS_READ);//Degug Point C: result == 0x07; Not OK.Here's the problem
if (result != PUDS_ERROR_OK)
{
CString str;
str.Format(L"Error Code = %d", result);
str += L",Read Failure.";
MessageBox(str);
PostMessage(WM_CLOSE);
}
}
Best Wishes~