07-05-2022 05:44 AM
Hello
Using the C APIs under VC++6, I can successfully create two sessions (send and receive) on a NI-XNET USB-8502 CAN adapter.
It receives all CAN messages from some 3rd party kit, which use extended (ie 29bit) IDs.
When attempting to transmit packets with extended IDs, the ID is truncated to "standard" (ie. 11bit) ID.
Using the the nxSetProperty with the nxPropFrm_CANExtID property parameter fails with the error -1074384755 (nxErrInvalidPropertyId).
Why does this property setting fail?
Thanks in advance
Gary Partis
Solved! Go to Solution.
07-05-2022 08:28 AM
nxPropFrm_CANExtID is a property for a database frame object. You might have been using it in another context.
To make a CAN indentifer extended, you have to set bit 29 in the identifier which is a flag defining standard or extended identifier. Bit 0 to 28 are the 29 bits for the identifier value.
Here is a snipped from a modified CAN_Frame_Stream_Output example demonstrating this. nxFrameId_CAN_IsExtended is defined in nixnet.h as 0x20000000, which is the same as (1<<29).
// Set the second frame's parameters (skipping the payload for now).
l_pFrame->Timestamp = 0;
l_pFrame->Flags = 0;
l_pFrame->Identifier = 5 | nxFrameId_CAN_IsExtended;
l_pFrame->Type = nxFrameType_CAN_Data;
l_pFrame->PayloadLength = 2;
07-05-2022 08:52 AM
Hello
That worked perfectly, many thanks 🙂
I double checked the CAN_Frame_Stream_Output example I have installed and the ORing of bit 29 is not present, so may be add this to the example for one of the two packets send? 🙂
Kind regards
Gary Partis