Cannot Send ID Above 7FF

The free CAN Software API (Application Programming Interface) for Windows®

Cannot Send ID Above 7FF

Postby davestephans » Tue 24. Oct 2017, 09:38

I am currently writing an application in VB6 using the "PCANBasic.dll" and have today come across a problem that I was not expecting.

The application can receive messages with an ID range up to 1FFFFFFF - this has been tested.

The problem I am having is that I cannot send any messages with an ID greater than 7FF. I do not get any errors but the message that is actually sent is stripped of all bits above bit 11 - e.g.

7FF arrives as 7FF - as expected
8FF arrives as 0FF - only the first 11 bits are used for the ID
9FF arrives as 1FF - only the first 11 bits are used for the ID

The LEN of the message and the DATA within the message are unaffected, it just sends it with the wrong ID.

I have tried calling "CAN_FilterMessages(PCAN_USBBUS1, &H0, &H1FFFFFFF, PCAN_MODE_EXTENDED)", but this has no effect on the message being sent, nor is it actually required because if it is omitted my application is still able to receive up to 1FFFFFFF anyway.

I have been working on this application for a few weeks and unless I can overcome this problem then I cannot continue, your help would be greatly appreciated.

Kind regards,
davestephans
 
Posts: 1
Joined: Tue 24. Oct 2017, 09:35

Re: Cannot Send ID Above 7FF

Postby K.Wagner » Tue 24. Oct 2017, 10:14

Hello,

without looking at the code is quite difficult to see where the problem is. Are you setting the MsgType field of the CAN message structure to PCAN_MESSAGE_EXTENDED before sending the message?
Best regards,
Keneth
K.Wagner
Software Development
Software Development
 
Posts: 546
Joined: Wed 22. Sep 2010, 12:36
Location: Darmstadt, Germany

Re: Cannot Send ID Above 7FF

Postby ginopeak » Fri 15. Mar 2019, 18:30

Hello Wagner,

Could you please provide a code snippet for transmitting and receiving extended CAN frame with CCP?
I am using C# environment to create a CCP tool.
How to set the extended message type while using CCP?

Could you please help me on this urgently.

Thanks in advance.
ginopeak
 
Posts: 1
Joined: Fri 15. Mar 2019, 15:56

Re: Cannot Send ID Above 7FF

Postby K.Wagner » Mon 18. Mar 2019, 09:52

Hello,

PLEASE: don't send questions to our support and at the same time post them in the forum; use only one way. This just slow down our work.

This topic is related to PCAN-Basic, but you are talking about CCP, so, which API are you actually using? PCAN-Basic or PCAN-CCP?

if you are using PCAN-Basic directly, then you just need to set the MsgType to EXTENDED, within the message being sent, in order to send an extended message:
Code: Select all
TPCANMsg msg;
TPCANStatus result;
char strMsg[256];

// A CAN message is configured
//
msg.ID = 0x100;
msg.MSGTYPE = PCAN_MESSAGE_EXTENDED;
msg.LEN = 3;
msg.DATA[0] = 1;
msg.DATA[1] = 2;
msg.DATA[2] = 3;

// The message is sent using the PCAN-USB Channel 1
//
result = CAN_Write(PCAN_USBBUS1, &msg);
if(result != PCAN_ERROR_OK)
{
    // An error occurred, get a text describing the error and show it
    //
    CAN_GetErrorText(result, 0, strMsg);
    MessageBox(strMsg);
}
else
    MessageBox("Message sent successfully");


You can read using the CAN_Read function. It will read anything coming on the bus, standard and extended messages.

If you are using PCAN-CCP, then you need to set the extended bit (Most Significant Bit on each) of your Extended-Ids for CRO and CTO, for instance:
Code: Select all
CRO: 0x18EF02F9 --> 0x98EF02F9
DTO: 0x18EFF902 --> 0x98EFF902
Best regards,
Keneth
K.Wagner
Software Development
Software Development
 
Posts: 546
Joined: Wed 22. Sep 2010, 12:36
Location: Darmstadt, Germany


Return to PCAN-Basic



This website uses cookies for analytics, for logins to the online shop and the forum, and for the handling of an order. By browsing this website you agree to the use of cookies. Detailed information on their use can be found in our privacy policy.

OKPrivacy Policy