Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to XNET write and read in parallel on the same interface

Solved!
Go to solution

Hello. I need help to setup CAN interface to write and read on the same interface.

I am using NI PXI-8513/2. I am using CAN1 as interface.

My DUT is sending CAN status messages every 100ms. I have to read them in order to send akntoowlege back to keep DUT CAN interface happy and not getting errors.

So, I want to open Strim Session and readall  frames in the loop. At the same time I need to be able to write to DUT one frame at the time..

I only need to read one frame at the time too, but since I know the ID I can pull it from the stream.

What I confuse about is how to set up the the same interface CAN1 to be able to write and read in parallel.

I think I would get errors that interface is already used.

Since I am new to CAN, I was reading and writing only when needed. But, sometimes I was getting errors on my messages. Sometimes I get message, sometime I miss it. But, when I run CAN test penal as sniffer it sends and writes every time.I was told that is because it acknowledge every message.

 

I open to any suggestions to the best way to set up interface.

I guess I can use CAN2 and the splitter to go around this issue, but I would like to use one interface if possible.

 

Thank you 

 

0 Kudos
Message 1 of 3
(3,992 Views)
Solution
Accepted by topic author Rus_K

Hi Rus,

The XNET hadrware takes care of most of the low level detials for you. The reading and writing circuitry are both connected to the bus at all times. When you write to the hardware it will try to place a frame on the bus at the first oppurtunity that it can. If the frame looses arbitration the hardware will re-attempt to send the frame until is succeeds. The recieving hardware will monitor the activity on the bus regardless of what is transmitting it. The receiving hardware will usually throw away a frame that was sent by the transmitting hardware but there is a Echo Transmit property to bypass this behavior too.

 

Take a look at the shipping example: CAN -> NI-XNET -> Intro to Sessions -> Multiple Sessions -> CAN Frame Input Output Same Port Single Point.vi. Keep in mind that this example will need to use a second CAN interface to acknowledge the frames it transmits. I would recoment running this example against the CAN Frame Output Single Point example which would emulate your ECU if a cyclic frame type is chosen.

Jeff L
National Instruments
0 Kudos
Message 2 of 3
(3,970 Views)

Thank you. It does run just find with multiple sections. 

0 Kudos
Message 3 of 3
(3,901 Views)