Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

filtering can frames with frame api (part 2)

(... continued)

            m_attrList[4] =       NC_ATTR_COMP_STD;
            m_valueList[4] =    NC_CAN_ARBID_NONE; //the special value 0xCFFFFFFF


- the documentation says for that constellation the Neatwork Interface is best able to filter out incoming standard frames except those handled
  by CAN Objects

- well, I created a CANObject to receive frames with ArbID 0x82, a frame that should be handled by this object, not by the CAN Interface Object
- I thought for any frame the callback should not be invoked I create a CANObject for receiving with a corresponding ArbID
- but the result is bad, the callback, which should be invoked when a frame is handled through the CAN Network Interface Object, is never invoked, if a frame comes in, independent of its ArbID
- I don't know what kind of CommType is to be assigned to the NC_ATTR_COMM_TYPE attribute?!?
- here is the cration code of the CANObjekt:


            m_attrList[0] = NC_ATTR_COMM_TYPE;
            m_valueList[0] = NC_CAN_COMM_RX_UNSOL; // I am not sure!
            m_attrList[1] = CC.NC_ATTR_PERIOD;
            m_valueList[1] = 0;
            m_attrList[2] = CC.NC_ATTR_DATA_LEN;
            m_valueList[2] = 3;
            m_attrList[3] = CC.NC_ATTR_TX_RESPONSE;
            m_valueList[3] = CC.NC_FALSE;
            m_attrList[4] = CC.NC_ATTR_RX_CHANGES_ONLY;
            m_valueList[4] = CC.NC_FALSE;
            m_attrList[5] = CC.NC_ATTR_READ_Q_LEN;
            m_valueList[5] = readQLen;
            m_attrList[6] = CC.NC_ATTR_WRITE_Q_LEN;
            m_valueList[6] = writeQLen;
           
            iStatus = CC.ncConfig("CAN0::STD0x00000082", 7, m_attrList, m_valueList);
            iStatus = CC.ncOpenObject("CAN0::STD0x00000082", objNOTRXHandle);
          


- it semms the callback is blocked since an opened CANObject exists beside an opened CAN Network Interface Object (both for receiving frames)
- BUT WHY?

- what else can I do?


thank you for your help
0 Kudos
Message 1 of 4
(4,025 Views)
Hi woodz,
 
that was a lot of information. But if i understood it right there is one general  problem in your application. In your first posting you mentioned to hav a single port CAN Series 2 Device. But  then you wrote you have created 2 CAN Network Interface Objects, one for receiving, another for transmitting frames.
This is not possible. You can not create two Network Interface Objects on a single port device.  Network Interface Object does mean to initialize the CAN Port.
The second available Object is ID based and the Name is only CAN Object . In this case it is possible to create an object for a single Message ID which has advanced properties.
In your case configure only one port for read with notification  and then additionally objects for certain ID's  on the same port.
 
Attached you can find two examples showing how to create  a notification for a read on a Network Interface Object. (Port) and how to use the filters on the dvice.
 
Hope that helps
 
DirkW
0 Kudos
Message 2 of 4
(4,011 Views)
Hello DirkW,

thank you for your answer. I am glad to hear (see)  from someone. Yes, what you say sounds very intelligent. Although I want mention, it is already possible to create 2 Interface Objects, because my app has functioally done right. But it is not very reasonable. If I create 2 Objects, after opening them with "CAN0" in the initial string their handles both are same. The objects both are refer to the CAN0 Interface. That is what I figured out.
I have known your 2 examples before my 1st post. But I was confused with the Filter example. Function is only guarateed I the 2 Ports of the card are bridged together. I thaught it doesn't matter I can use the code and replace all "CAN1" to "CAN0". But now, I think I understood the difference between the Object types, I hope.

I have got another question. How can I obtain, having a timestamp for sent Frames? Up to now only received frames can have it. The NCTYPE_CAN_STRUCT supports it. But what if I use NCTYPE_CAN_DATA via can Objects to transmit frames? No timestamp field is avialable.

thank you for your answer
0 Kudos
Message 3 of 4
(3,996 Views)

Hi woodz,

One's again, it is possible to have more then one writing or reading ID based (CANX::STDx) Object per port, but the Network Interface Object which initializes the port is only possible one's per port. Remember you can also write and read using the Network Interface handle (Read and Write net).

The ID based Objects are stored on the device and can handle special communication tasks like periodic transmit or remote frames.

To your new question: The only way to get timestamps for writing processes is to enable self reception for the Port. If this is enabled, a read mult net reads back automatically all frames you sent out. Additionally you get the timestamp for your frames.

I would suggest to read the manual about the set attribute function, before start implementing this feature

DirkW

0 Kudos
Message 4 of 4
(3,985 Views)