Hallo,
ich habe Probleme beim Setzen des Parameters: PCANTP_PARAM_CAN_UNSEGMENTED
Mit welchem Typ muss man die Getvalue Funktion aufrufen ?
Ich habe es mit Uinteger, Byte, Byte() versucht.
Als Status erhalte ich jedes Mal: -2080374784 was darauf hin deutet, dass auf einen falschen Speicherbereich zugegriffen wird bzw. etwas mit dem Marshalling nicht geklappt hat.
Set Receive Non Iso Tp CAN Frames
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: Set Receive Non Iso Tp CAN Frames
Hello C.L.W.,
Parameter PCANTP_PARAM_CAN_UNSEGMENTED requires a numeric buffer, the minimum expected size is 1. Here are examples for both C++ and C#.
C++ example:
C# example:
Parameter PCANTP_PARAM_CAN_UNSEGMENTED requires a numeric buffer, the minimum expected size is 1. Here are examples for both C++ and C#.
C++ example:
Code: Select all
TPCANTPStatus sts;
BYTE param = PCANTP_CAN_UNSEGMENTED_ALL_FRAMES; // value: 1=ON, 2=ALL
sts = CANTP_SetValue(ChannelRcv, PCANTP_PARAM_CAN_UNSEGMENTED, ¶m, 1);
...
Code: Select all
TPCANTPStatus sts;
uint iBuf = CanTpApi.PCANTP_CAN_UNSEGMENTED_ON;
TPCANTPParameter param = TPCANTPParameter.PCANTP_PARAM_CAN_UNSEGMENTED;
sts = CanTpApi.SetValue(m_pctpHandle, param, ref iBuf, sizeof(uint));
...
Best regards,
Fabrice
Fabrice
Re: Set Receive Non Iso Tp CAN Frames
Thanks for your quick reply
Valid values of the Parameter should be:
But it is only possible to set Unsegmented_Off. It isn't possible to use Unsegmented_On or Unsegmented_AllFrames
result of IsoTpApi.GetValue is still -2080374784
Valid values of the Parameter should be:
Code: Select all
Public Enum FrameReception As Integer
<Description("Disable reception of unformatted (NON-ISO-TP) CAN frames (default): only ISO 15765 messages will be received")>
Unsegmented_Off = &H0
<Description("Enable reception of unformatted (NON-ISO-TP) CAN frames: received messages will be treated as either ISO 15765 Or as an unformatted CAN frame")>
Unsegmented_On = &H1
<Description("Enable reception of unformatted (NON-ISO-TP) CAN frames: received messages will be treated as ISO 15765, unformatted CAN frame, Or both (user will able to read fragmented CAN frames")>
Unsegmented_AllFrames = &H2
End Enum
Code: Select all
Public Sub GetFrameReception(ByRef fr As FrameReception)
Try
Dim buffer As UInteger
Status = IsoTpApi.GetValue(Handle, PCANTP_PARAM_CAN_UNSEGMENTED, buffer, CType(System.Runtime.InteropServices.Marshal.SizeOf(buffer), UInteger))
frameReception = CType(buffer, FrameReception)
Catch ex As Exception
SetLog(StatusDescription, ex, LogLevel.DEBUG, True)
End Try
End Sub
-
- Software Development
- Posts: 305
- Joined: Mon 9. Sep 2013, 12:21
Re: Set Receive Non Iso Tp CAN Frames
Thank you for your input. The problem is a typo in the VB.Net header where PCANTP_PARAM_CAN_UNSEGMENTED is defined. The parameter value should be &HE9 instead of &H9.
PCAN-ISO-TP.vb, line 273 was:
You can fix the issue by changing the value in your VB header to:
Sorry for the inconvenience.
PCAN-ISO-TP.vb, line 273 was:
Code: Select all
''' <summary>
''' 1 BYTE data stating if unsegmented (NON-ISO-TP) CAN frames can be received
''' </summary>
PCANTP_PARAM_CAN_UNSEGMENTED = &H9
Code: Select all
''' <summary>
''' 1 BYTE data stating if unsegmented (NON-ISO-TP) CAN frames can be received
''' </summary>
PCANTP_PARAM_CAN_UNSEGMENTED = &HE9
Best regards,
Fabrice
Fabrice