Hello
I have users reporting strange problems with the PEAK USB CAN interface, when used with a software application, using the Peak PCAN-ISO TP and UDS libraries.
Difficult to reproduce problem, for example, sometimes the application do not communicate.
Normally the problem goes away when the user:
- exits the application
- unplugs the USB cable
- waits a few seconds
- plugs the USB cable
- restarts the application
Just wondering if there is a way to force a hardware reset.
thanks and regards
PCAN-ISO TP: How reset the hardware interface
-
- Posts: 21
- Joined: Thu 28. Apr 2022, 14:48
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: reset the hardware interface
Hello Fabio,
Currently this sounds like physical issues with the bus itself, if you ask me.
My recommendation:
Those users should make sure they are using the proper termination (120 Ohm on Bus-ends) and the right Bitrate/Bit-Timing,
they should verify this first before proceeding. If this is a physical issue with the bus correcting it will save your further headaches further down the line.
However, to reset a channel you can use the 'unitialize' function:
PCAN-ISO-TP API – Documentation for API Version 3.x
Page 102
Chapter 3.6 Methods
(...)
Methods Description
Initialize_2016
Initializes a PCANTP channel.
InitializeFD_2016
Initializes a PCANTP channel with CAN-FD support.
Uninitialize_2016
Uninitializes a PCANTP channel.
usage example:
Link to documentation for PCAN-UDS API:
https://www.peak-system.com/produktcd/P ... an_eng.pdf
Please let me know if the issue could be resolved!
Best Regards
Marvin
Currently this sounds like physical issues with the bus itself, if you ask me.
My recommendation:
Those users should make sure they are using the proper termination (120 Ohm on Bus-ends) and the right Bitrate/Bit-Timing,
they should verify this first before proceeding. If this is a physical issue with the bus correcting it will save your further headaches further down the line.
However, to reset a channel you can use the 'unitialize' function:
PCAN-ISO-TP API – Documentation for API Version 3.x
Page 102
Chapter 3.6 Methods
(...)
Methods Description
Initialize_2016
Initializes a PCANTP channel.
InitializeFD_2016
Initializes a PCANTP channel with CAN-FD support.
Uninitialize_2016
Uninitializes a PCANTP channel.
usage example:
Code: Select all
uds_status result;
// The Plug & Play channel (PCAN-PCI) is initialized
result = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,cantp_baudrate.PCANTP_BAUDRATE_500K);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Initialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was initialized", "Success");
// Release channel
result = UDSApi.Uninitialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Uninitialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was released", "Success");
Link to documentation for PCAN-UDS API:
https://www.peak-system.com/produktcd/P ... an_eng.pdf
Please let me know if the issue could be resolved!
Best Regards
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
-
- Sales & Support
- Posts: 1083
- Joined: Fri 20. Sep 2019, 13:31
Re: reset the hardware interface
In addition to my previous answer, because i forgot:
You can alternatively set PUDS_PARAMETER_RESET_HARD via UDS_SetValue_2013(), to perform a hard reset (and keep settings and mappings):
PUDS_PARAMETER_RESET_HARD
Access: Can be set.
Description: Resets the CAN controller and clears internal reception and transmission queues. This
parameter provides a way to uninitialize then initialize the CAN channel without losing any configured
mappings and PUDS/PCANTP related settings.
Possible values: 1.
Default value: NA.
PCAN-Device: All PCAN devices (excluding PCANTP_HANDLE_NONEBUS channel).
Best Regards
Marvin
You can alternatively set PUDS_PARAMETER_RESET_HARD via UDS_SetValue_2013(), to perform a hard reset (and keep settings and mappings):
PUDS_PARAMETER_RESET_HARD
Access: Can be set.
Description: Resets the CAN controller and clears internal reception and transmission queues. This
parameter provides a way to uninitialize then initialize the CAN channel without losing any configured
mappings and PUDS/PCANTP related settings.
Possible values: 1.
Default value: NA.
PCAN-Device: All PCAN devices (excluding PCANTP_HANDLE_NONEBUS channel).
Best Regards
Marvin
---
Marvin Heidemann
PEAK-Support Team
Marvin Heidemann
PEAK-Support Team
-
- Posts: 21
- Joined: Thu 28. Apr 2022, 14:48
Re: reset the hardware interface
Thanks I will try to apply both suggestions - unninitialize and reset. I will let you know when I receive feedback from the field.