From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

looking for drivers for USB 8473

I'm still trying to get the NI USB CAN 8473 working.

(I was working on some other stuff for a while, but I'm back to this.)

 

The KB from DirkW does not really supply much information, at least to me. It seems to list some APIs that are supported with warnings, and then those that are not supported. None of these apply to what I'm doing.

 

First, I am not sure about my initializations, and cannot seem ti find any documentation that in any clear way identifies how initializing the USB device is different that initializing a PCMCIA or PCI device.  (I use the exact same code for the PCMCIA and PCI CAN devices.)

 

Can someone give me a document for initializing the USB CAN device?

 

 

Here is how I am initializing things (I modified this from how I do things for the PCMCIA and PCI, this builds and runs, but I suspect it is not correct):

 

attr_id=0;

AttrIdList[attr_id] = NC_ATTR_BAUD_RATE;
AttrValueList[attr_id++] = CAN_500KBPS;

AttrIdList[attr_id] = NC_ATTR_START_ON_OPEN;
AttrValueList[attr_id++] = NC_TRUE;

AttrIdList[attr_id] = NC_ATTR_READ_Q_LEN;
AttrValueList[attr_id++] = 150; //10;
AttrIdList[attr_id] = NC_ATTR_WRITE_Q_LEN;
AttrValueList[attr_id++] = 0; //10;

AttrIdList[attr_id] = NC_ATTR_CAN_COMP_STD;
AttrValueList[attr_id++] = 0; //NC_CAN_ARBID_NONE;
AttrIdList[attr_id] = NC_ATTR_CAN_MASK_STD;
AttrValueList[attr_id++] = NC_CAN_MASK_STD_DONTCARE;
AttrIdList[attr_id] = NC_ATTR_CAN_COMP_XTD;
AttrValueList[attr_id++] = 0; //NC_CAN_ARBID_NONE;
AttrIdList[attr_id] = NC_ATTR_CAN_MASK_XTD;
AttrValueList[attr_id++] = NC_CAN_MASK_XTD_DONTCARE;

/* CAN0 is configured as PORT1, High Speed CAN */
Status = ncConfig("CAN0", attr_id, AttrIdList, AttrValueList);

//Original, doesn't work Status = ncOpenObject("CAN0::std0xD0", &RxHandle);
Status = ncOpenObject("CAN0", &RxHandle);


TxHandle = RxHandle;

//Original, doesn't work Status = ncOpenObject("CAN0::std0xB0", &AckHandle);
Status = ncOpenObject("CAN0", &AckHandle);

0 Kudos
Message 11 of 16
(4,874 Views)

OK, I think I got too far from my original code, so I'm looking for something that will work.

Since my original code works with the NI CAN PCMCIA and PCI devices, I went back to that (but still have the stuff above if that is going to work).

 

Here is what I'm truing to get working:

 


    AttrIdList[0] = NC_ATTR_BAUD_RATE;
    AttrValueList[0] =CAN_500KBPS ;

    AttrIdList[1] = NC_ATTR_START_ON_OPEN;
    AttrValueList[1] = NC_TRUE;

    AttrIdList[2] = NC_ATTR_READ_Q_LEN;
    AttrValueList[2] = 0;
    AttrIdList[3] = NC_ATTR_WRITE_Q_LEN;
    AttrValueList[3] = 0;

    AttrIdList[4] = NC_ATTR_CAN_COMP_STD;
    AttrValueList[4] = NC_CAN_ARBID_NONE;
    AttrIdList[5] = NC_ATTR_CAN_MASK_STD;
    AttrValueList[5] = NC_CAN_MASK_STD_DONTCARE;
    AttrIdList[6] = NC_ATTR_CAN_COMP_XTD;
    AttrValueList[6] = NC_CAN_ARBID_NONE;
    AttrIdList[7] = NC_ATTR_CAN_MASK_XTD;
    AttrValueList[7] = NC_CAN_MASK_XTD_DONTCARE;

    /* CAN0 is configured as PORT1, High Speed CAN */
    Status = ncConfig("CAN0", 8, AttrIdList, AttrValueList);

    /* arbitration ID  xD0 */

    AttrIdList[0] = NC_ATTR_COMM_TYPE;
    AttrValueList[0] = NC_CAN_COMM_RX_UNSOL;

    AttrIdList[1] = NC_ATTR_PERIOD;
    AttrValueList[1] = 0;

    AttrIdList[2] = NC_ATTR_CAN_DATA_LENGTH;
    AttrValueList[2] = 8;

    AttrIdList[3] = NC_ATTR_CAN_TX_RESPONSE;
    AttrValueList[3] = NC_FALSE;

    AttrIdList[4] = NC_ATTR_RX_CHANGES_ONLY;
    AttrValueList[4] = NC_FALSE;

    AttrIdList[5] = NC_ATTR_READ_Q_LEN;
    AttrValueList[5] = 260;
    AttrIdList[6] = NC_ATTR_WRITE_Q_LEN;
    AttrValueList[6] = 0;

    /*ArbID of xD0 */
    Status = ncConfig("CAN0::STD0xD0", 7, AttrIdList, AttrValueList);


the first ncConfig is OK, this second one is giving me an error;
-1074388723
= 0xBFF6210D
Which, using ncStatusToString gives:
Your application uses a feature that is not supported by your NI CAN or LIN hardware. Solutions: Contact NI to upgrade your CAN hardware ; Consult the Program Reference.....

 

I did take out the ::STD0xD0 and it does not give an error, but I am not sure that is the right thing to do, since it must be there for a reason.

 

I guess what I'm really looking for, is a document that describes how to get the USB device working, since it does not work with the same code that works for PCMCIA and PCI devices.    If there is no documentation, then I guess help with this code would be VERY MUCH appreciated.

0 Kudos
Message 12 of 16
(4,870 Views)

Hi Ken,

 

Perhaps the KB is to difficult to understand, buit it describes that USB CAN devices do not support CAN objects for specific IDs. Your second config configures ID D0 as a single object and thats what the error message trys to tell you, is not supported.

Workaround : use the Network Interface handle and use the read mult to receive all IDs and then filter the desired one.

 

DirkW

0 Kudos
Message 13 of 16
(4,859 Views)

Dirk,

sorry, but it is not too difficult to understand, it just does not answer what I was asking (and it does not say WHAT a CAN Object actually is).

 

I called NI tech support, and finally got an answer to my questions about the NI USB CAN 8473, 

using arbitration IDs is not supported in the USB device, like it is in the PCMCIA and PCI devices, because the USB device does not include hardware timing and filtering, which is needed for the use of arbitration IDs.

 

As for your solution of accepting all CAN IDs will not work.

My software running on the PC, from Lab Windows CVI, communicates with my module by sending a command and waiting for a response from the module.   [I cannot change the software on my module; it is already in production, and used across several projects that I support.]

My module will not receive any of the messages from the software on the PC because it will  not include the arbitration ID,

my module will not send anything out unless it gets a command from my software running on the PC.

 

The person I talked with on call in support said I will have to implement the Arbitration ID in software for the USB.

In this document:

http://zone.ni.com/devzone/cda/tut/p/id/2732

scrolling down to "CAN Terminology" 

there is a description of the CAN data packet, this shows the arbitration ID and data bytes of a message.

 I have also documented the messages my code is sending using an NI CAN PCMCIA card, so I know what the data I am sending looks like.

Now I just have to create the code to perform this.

0 Kudos
Message 14 of 16
(4,856 Views)

Looking at the KB, I think it implies that you can't do a

 

ncWaitForState

ncReadMult

 

Because the ncWaitForState won't return a NC_ST_READ_MULT state.

0 Kudos
Message 15 of 16
(4,851 Views)

anAlias, that is not correct, it states there are special considerations for the first set of functions, and they are listed below.

 

I have this working.

 

The problem is the USB device (the 8473) does not include the HW features found in the PCI and PCMCIA (which is reasonable, considering the price difference).

So, I started with my code that works on the PCMCIA and PCI devices, and changed the structures that each use:

Tx buffer type is NCTYPE_CAN_FRAME     instead of NCTYPE_CAN_DATA

Rx buffer type is NCTYPE_CAN_STRUCT   instead of NCTYPE_CAN_DATA_TIMED

 

There were other changes, that I think become obvious once you figure out what to enter for each of the fields of these structures; and use the buffer from this structure to read or write the data to be transmitted.

 

The new types include additional information that defines the Arbitration ID, which was the important part that I needed.

The other devices use ncConfig commands with "CAN0::STD0x0D0" to define for the PCI and PCMCIA devices the Arbitration ID, and that is included at the hardware level, transparent to the user.

 

 
Message Edited by Ken (This is my stinking alias) on 10-10-2008 09:15 AM
0 Kudos
Message 16 of 16
(4,820 Views)