PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

A free API for the communication with control devices according to UDS (ISO 14229-1)
Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Thu 9. Sep 2021, 13:42

Hello,

// Include header for ISO-14229-1:2013
#include "PCAN-UDS_2013.h"

// Defines the version of the API based on the ISO revision

1) how to configure PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addressing?

// Define Network Address Information used for all the tests
memset(&config, 0, sizeof(uds_msgconfig));
config.can_id = 0xxxxx 01fa;
config.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
config.nai.source_addr = 0xfa;
config.nai.target_addr = 0x01;
config.nai.extension_addr = 0x00;

2) What are the parameter we need to configure before sending request for client to server?
PUDS_PARAMETER_TIMEOUT_REQUEST, PUDS_PARAMETER_TIMEOUT_RESPONSE, PUDS_PARAMETER_SERVER_ADDRESS like any mapping we need to do using UDS setValue2013?

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by F.Vergnaud » Thu 9. Sep 2021, 14:18

Hello,

1) You don't specify can_id with protocol PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL (or PUDS_MSGPROTOCOL_ISO_15765_2_29B_MIXED).
The API computes it automatically.

Code: Select all

	memset(&config, 0, sizeof(uds_msgconfig));
	config.can_id = -1;
	config.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
	config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
	config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
        config.nai.source_addr = 0xfa;
        config.nai.target_addr = 0x01;
        config.nai.extension_addr = 0x00;
2) PUDS_PARAMETER_SERVER_ADDRESS is indeed required if your not using the default 0xF1 (TesterClient) address to communicate.
If you want to listen to multiple addresses (like 0xF1 and 0xFA), you need to use parameter PUDS_PARAMETER_ADD_LISTENED_ADDRESS for each extra address you need to listen to.
PUDS_PARAMETER_TIMEOUT_REQUEST and PUDS_PARAMETER_TIMEOUT_RESPONSE are not mandatory, but you can reconfigure them to suit your needs.

You can find a description for each parameter in the user manual.
Best regards,
Fabrice

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Thu 9. Sep 2021, 18:05

Hello,

We are still not getting message request and response.
We need to send message request from 0x18da01xx and response 0x18daxx01.
We configure the message as mentioned below.

// Set the PCAN-Channel to use
client_handle = PCANTP_HANDLE_USBBUS1; // TODO: modify the value according to your available PCAN devices.

// Initializing of the UDS Communication session
status = UDS_Initialize_2013(client_handle, PCANTP_BAUDRATE_250K, (cantp_hwtype)0, 0, 0);
printf("Initialize UDS: %i\n", (int)status);

// Define TimeOuts
tmp_buffer = PCANTP_ISO_TIMEOUTS_15765_4;
status = UDS_SetValue_2013(client_handle, PUDS_PARAMETER_ISO_TIMEOUTS, &tmp_buffer, sizeof(tmp_buffer));
printf("Set ISO 15765-4 timeouts values: %d\n", (int)status);

memset(&config, 0, sizeof(uds_msgconfig));
config.can_id = -1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
config.nai.source_addr = 0x01fa;
config.nai.target_addr = 0xfa01;

Thanks and Regards

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by F.Vergnaud » Fri 10. Sep 2021, 09:22

Hello,

The source and target addresses you have configured are wrong, it should respectively be 0xFA and 0x01.

Here is a modified version of exemple "02_client_request_ecu_reset_USDT" that corresponds to your need (it successfully communicates for instance with example 05_server_simulator).

Code: Select all

int main()
{
	char buffer[BUFFER_SIZE];
	uds_status status;
	cantp_handle tp_handle;
	uds_msgconfig config_physical;
	uds_msg msg_request;
	uds_msg request_confirmation;
	uds_msg response;
	uds_sessioninfo new_sessioninfo;
	uds_sessioninfo read_sessioninfo;
	int server_addr = 0xFA;

	// Initialize variables
	tp_handle = PCANTP_HANDLE_USBBUS1; // TODO: modify the value according to your available PCAN devices.
	buffer[0] = '\0';
	memset(&config_physical, 0, sizeof(uds_msgconfig));
	memset(&msg_request, 0, sizeof(uds_msg));
	memset(&request_confirmation, 0, sizeof(uds_msg));
	memset(&response, 0, sizeof(uds_msg));
	memset(&new_sessioninfo, 0, sizeof(uds_sessioninfo));
	memset(&read_sessioninfo, 0, sizeof(uds_sessioninfo));

	// Print version informations
	status = UDS_GetValue_2013(PCANTP_HANDLE_NONEBUS, PUDS_PARAMETER_API_VERSION, buffer, BUFFER_SIZE);
	printf("PCAN-UDS API Version - %s: %s\n", buffer, STATUS_OK_KO(status));

	// Initialize client
	status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0, 0);
	printf("Initialize channel: %s\n", STATUS_OK_KO(status));

	// Change the default address to listen to
	server_addr = 0xFA;
	status = UDS_SetValue_2013(tp_handle, PUDS_PARAMETER_SERVER_ADDRESS, &server_addr, sizeof(server_addr));
	printf("Set PUDS_PARAMETER_SERVER_ADDRESS: %s\n", STATUS_OK_KO(status));

	// Initialize a physical configuration
	config_physical.can_id = -1;
	config_physical.can_msgtype = PCANTP_CAN_MSGTYPE_EXTENDED;
	config_physical.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL;
	config_physical.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
	config_physical.type = PUDS_MSGTYPE_USDT;
	config_physical.nai.source_addr = 0xfa;
	config_physical.nai.target_addr = 0x01;

	// Execute ECUReset and wait response
	status = UDS_SvcECUReset_2013(tp_handle, config_physical, &msg_request, PUDS_SVC_PARAM_ER_HR);
	printf("Execute ECUReset service: %s\n", STATUS_OK_KO(status));
	status = UDS_WaitForService_2013(tp_handle, &msg_request, &response, &request_confirmation);
	printf("Wait for service: %s\n", STATUS_OK_KO(status));

	// Free message structures
	status = UDS_MsgFree_2013(&msg_request);
	printf("Free request message: %s\n", STATUS_OK_KO(status));
	status = UDS_MsgFree_2013(&request_confirmation);
	printf("Free request confirmation: %s\n", STATUS_OK_KO(status));
	status = UDS_MsgFree_2013(&response);
	printf("Free response message: %s\n", STATUS_OK_KO(status));

	// Close client
	status = UDS_Uninitialize_2013(tp_handle);
	printf("Uninitialize channel: %s\n", STATUS_OK_KO(status));

	// Exit
	system("PAUSE");
	return EXIT_SUCCESS;
}
Best regards,
Fabrice

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Sat 11. Sep 2021, 09:43

Hello,

// Initialize client
status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_250K, (cantp_hwtype)0, 0, 0);
printf("Initialize channel: %s\n", STATUS_OK_KO(status));

we are getting KO indicating not initialize channel.
1) We are using PCAN UDS plug and PLAY hardware. How we can initialize for the same?

2) What the difference between two API? How we can add UDSapi classes ?

result = UDSApi::Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);

// Initialize client
status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0, 0);
printf("Initialize channel: %s\n", STATUS_OK_KO(status));

3) How to configure timeout ?
// Define TimeOuts
UlBuffer = CVO_UDS_SET_ULBUFFER_VALUE;
Status = UDS_SetValue(Channel, PUDS_PARAM_TIMEOUT_REQUEST, &UlBuffer, sizeof(UlBuffer));
printf(" Set TIMEOUT_REQUEST: %i (%d)\n", (int)Status, UlBuffer);
Status = UDS_SetValue(Channel, PUDS_PARAM_TIMEOUT_RESPONSE, &UlBuffer, sizeof(UlBuffer));
printf(" Set TIMEOUT_REQUEST: %i (%d)\n", (int)Status, UlBuffer);

Thanks.

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Sat 11. Sep 2021, 17:22

Shail wrote:
Sat 11. Sep 2021, 09:43
Hello,

// Initialize client
status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_250K, (cantp_hwtype)0, 0, 0);
printf("Initialize channel: %s\n", STATUS_OK_KO(status));

we are getting KO indicating not initialize channel.
1) We are using PCAN UDS plug and PLAY hardware. How we can initialize for the same?

2) What the difference between two API? How we can add UDSapi classes ?

result = UDSApi::Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);

// Initialize client
status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0, 0);
printf("Initialize channel: %s\n", STATUS_OK_KO(status));

3) How to configure timeout in UDSApi:: APIs and Is mandatory to configure timeout?

// Define TimeOuts
UlBuffer = CVO_UDS_SET_ULBUFFER_VALUE;
Status = UDS_SetValue(Channel, PUDS_PARAM_TIMEOUT_REQUEST, &UlBuffer, sizeof(UlBuffer));
printf(" Set TIMEOUT_REQUEST: %i (%d)\n", (int)Status, UlBuffer);
Status = UDS_SetValue(Channel, PUDS_PARAM_TIMEOUT_RESPONSE, &UlBuffer, sizeof(UlBuffer));
printf(" Set TIMEOUT_REQUEST: %i (%d)\n", (int)Status, UlBuffer);

4) Is any example for the PCAN UDS UDSApi::Initialize_2013 or PCAN User manual?

Thanks.
MODERATOR: Double posting will not speed up anythink - user get his 1st warning - Next time we will delete the thread where a double post is made.

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by F.Vergnaud » Mon 13. Sep 2021, 10:39

Hello,

1) You need to check the returned status, common error is the channel is already initialized or the value is invalid (double check the value of tp_handle).
2) &4) As usual check the UDS manual, §3.3 p.19 UDSapi defines a class that represents the PCAN-UDS 2.x API to be used within the Microsoft's .NET Framework.
3) Timeouts configuration are not mandatory, check the multiple examples included in the package most of them are not configuring them.
You can find that timeouts are configured in samples 11/12.
Best regards,
Fabrice

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Tue 14. Sep 2021, 05:56

Hello,

We are getting status as 1 when using api mentioned below.
// Initialize client
status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0, 0);

PUDS_STATUS_NOT_INITIALIZED = PCANTP_STATUS_NOT_INITIALIZED, // Not Initialized.

We are getting error while declaring class as mentioned in manual.
public ref class UDSApi abstract sealed

We are using PCAN-USB 1 IPEH-002021 hardware.
https://www.peak-system.com/PCAN-USB.199.0.html?&L=1

1) How we can initialize the API for the same hardware?
2) How we can declare UDSapi classes and use api available?
TPUDSStatus res;
res = UDSApi.Initialize(UDSApi.PUDS_USBBUS1, TPUDSBaudrate.PUDS_BAUD_500K);
3) can u give example for PCAN-USB 1 IPEH-002021 hardware.? What are the configuration steps require before using API?

F.Vergnaud
Software Development
Software Development
Posts: 305
Joined: Mon 9. Sep 2013, 12:21

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by F.Vergnaud » Tue 14. Sep 2021, 09:43

Hello,

1) PUDS_STATUS_NOT_INITIALIZED points out that the channel could not be initialized, please assert that:
- the value of tp_handle is correct (since you have connected a PCAN-USB device, it should be PCANTP_HANDLE_USBBUS1)
- the device is not already opened by another application.

2) UDSapi class is only available for other programming languages: C#.Net, C++.Net, VB.Net and Delphi.
Pure C and C++ applications shall use the functions of the API. There is no difference between UdsApi and the 'UDS_' functions.

3) There is an example for each API function in the manual... See manual §3.8.1 UDS_Initialize_2013 p.501.
There are 12 C++ examples included in the UDS package, they all use UDS_Initialize_2013 functions...
There is no specific configuration to make for your device, this is a classic USB device.
Best regards,
Fabrice

Shail
Posts: 49
Joined: Tue 28. Apr 2020, 10:09

Re: PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL addresing conf

Post by Shail » Wed 15. Sep 2021, 04:25

Hello,

We are still getting error for uds initiation.

As per manual, page 509,

Code: Select all

uds_status result;
// The Plug & Play channel (PCAN-PCI) is initialized
result = UDS_Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);
if (!UDS_StatusIsOk_2013(result))
MessageBox(NULL, "Initialization failed", "Error", MB_OK);
else
MessageBox(NULL, "PCAN-PCI (Ch-2) was initialized", "Success", MB_OK);
// All initialized channels are released
UDS_Uninitialize_2013(PCANTP_HANDLE_NONEBUS);
1) In that UDS_Initialize_2013 API using only 2 parameter. when we are trying to use error C2198: 'UDS_Initialize_2013': too few arguments for call?

2) As request configuration as mentioned below, we are getting error for initialization. error code 01?

Code: Select all

	// Initialize variables
	tp_handle = PCANTP_HANDLE_USBBUS1; // TODO: modify the value according to your available PCAN devices.
	null_handle = 0;
	server_address = PUDS_ISO_15765_4_ADDR_ECU_1;
	buffer[0] = '\0';
	memset(&request_msg, 0, sizeof(uds_msg));
	srand((unsigned int)time(NULL));

	// Print version informations
	status = UDS_GetValue_2013(PCANTP_HANDLE_NONEBUS, PUDS_PARAMETER_API_VERSION, buffer, BUFFER_SIZE);
	printf("PCAN-UDS API Version - %s: %s\n", buffer, STATUS_OK_KO(status));

	// Initialize channel
	status = UDS_Initialize_2013(tp_handle, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0, 0);
	printf("Initialize channel: %s\n", STATUS_OK_KO(status));
3) Why 3rd parameter of UDS_Initialize_2013 (cantp_hwtype) API 0 indicate PCANTP_HWTYPE_ISA but we are using PLUG and PLAY device USB?

Code: Select all

typedef enum _cantp_hwtype {
PCANTP_HWTYPE_ISA = PCAN_TYPE_ISA,
PCANTP_HWTYPE_ISA_SJA = PCAN_TYPE_ISA_SJA,
PCANTP_HWTYPE_ISA_PHYTEC = PCAN_TYPE_ISA_PHYTEC,
PCANTP_HWTYPE_DNG = PCAN_TYPE_DNG,
PCANTP_HWTYPE_DNG_EPP = PCAN_TYPE_DNG_EPP,
PCANTP_HWTYPE_DNG_SJA = PCAN_TYPE_DNG_SJA,
PCANTP_HWTYPE_DNG_SJA_EPP = PCAN_TYPE_DNG_SJA_EPP,
} cantp_hwtype;

Thanks,
Last edited by F.Vergnaud on Wed 15. Sep 2021, 09:55, edited 1 time in total.
Reason: code formatting

Locked