Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET behavior when arbitration loss occurs: CAN

Hi,

 

Suppose I am transmitting a signal using say Signal Single-Point onto the bus from my XNET card.  I want to make sure that the signal has successfully transmitted onto the network (after e.g. repeatedly losing arbitration) before I stop the interface.  I understand that by default (while the session property "Single Shot?" is off), the card will repeatedly retry according to CAN protocol, but if I stop the interface before it wins arbitration, that doesn't help anymore.

 

Can I check this by the "Number of Values Pending" property?  The documentation didn't seem to clear to me about how this property behaves for arbitration loss.

 

Is there another way aside from having a simultaneous read session with the "Echo Transmit" property enabled? That would obviously work but would complicate the routine more than I would like.

 

Thanks

0 Kudos
Message 1 of 11
(3,568 Views)

Anyone?

0 Kudos
Message 2 of 11
(3,469 Views)

I think reading the signal back on a trigger certainly is an option.  But correct me if I'm wrong, it sounds like you set a single point value, and then basically don't want to stop, until that signal's new value has been written at least once.  So what I think would be a good technique is to create a Signal Single Point Read session, on all the values you want to perform this check on.  Then read these values before stopping.  If the read values are the same as the last written values, then that means the new data has gone out and you are good to stop.  Otherwise the new values haven't been written and are either waiting for a valid ACK from another device on the bus, or maybe there is retransmit due to data loss.

 

You can use property nodes to read things like the queue of data waiting to be written, but that will just return the number of items in the queue.  It won't return the actual values of those signals.

0 Kudos
Message 3 of 11
(3,464 Views)

Hi Hooovahh,

 

What you're saying makes sense.  This is basically what I was thinking of for the simultaneous read session.  Thanks.

0 Kudos
Message 4 of 11
(3,159 Views)

Hi all,

 

On this similar query asked, there is XNET Wait (Transmit Complete).vi

in the XNET--> Notify pallette. I tried to use it in one of sample example, but didn't really get the significance of it. Definitely its a important check to make sure the Transmitted frame is successfully received by DUT. Anyone used this wait function before? or throw some light on any useful implementation. 

Voyager7277_0-1616760103229.png

 

0 Kudos
Message 5 of 11
(2,856 Views)

I'd have to do some testing to see if that function is appropriate for what OP was asking for.  I believe the intention of this function, is to be used somewhere that you have a queued write, and want to know when the queue is empty and all frames have been written.  I'd have to do some tests to see the behavior of the function on things like a Single Point write.  I'm unsure how this function would behave.  It is possible you perform the write with the new payload values, and then this function will wait until that new data has been written at least once.  Or it is possible it will return immediately on a Single Point write.  The help isn't clear to me how it will behave in these session types, and I don't currently have a setup to test with.

 

However I will add that in my environment it doesn't really matter.  If I ask an ECU to perform some operation with a CAN write, even if I waited until that CAN message was received, I still need to wait some amount of time for the ECU to act on it.  Say I asked it to turn on an output to some PWM value.  I can't just expect the PWM to be running at the same microsecond that the CAN message went out.  So what I'm saying is, when I've used the Singe Point write, I typically just have to have some kind of wait before I expect the action I asked the ECU to do, to actually be measurable.  For this reason I've never used this function.  Even on the queued sessions where I expect a response I'll just perform the write, then sit in a loop waiting for the response from the ECU.  Waiting for the transmit to be complete isn't helpful if I just need to keep waiting anyway.

0 Kudos
Message 6 of 11
(2,851 Views)

Hi Hovaahhh,

 

Well, this statement is given in the function description which says... 

"You can use this VI to guarantee that all frames have been transmitted before stopping this session." 

 

I wonder what does "guarantee" indicates here?..(such a strong word! whoever developed this VI at NI seems like he/she must have tested in hardcore way fullproof kinof.. jokes apart :D)

 

like you said, this could mean if am using Frame output queued session VI and I have 5 frames to be transmitted to DUT and after Frame Write.vi, if the session queue internal memory gets "empty" (maybe after all  frames transmitted from XNET device), means "guarantee"? but still i dont believe this means you have transferred all frames to DUT unless you get some ACK from DUT that all 5 frames received with correct CRC check n all.

 

Hoovahhh.. i still have CRIO9054 with MCP2515 setup working, if needed we can do a remote session. Let me know. Thanks! it's a good opportunity for me to get more insight on CAN from you.

0 Kudos
Message 7 of 11
(2,845 Views)

@Voyager7277 wrote:

 

like you said, this could mean if am using Frame output queued session VI and I have 5 frames to be transmitted to DUT and after Frame Write.vi, if the session queue internal memory gets "empty" (maybe after all  frames transmitted from XNET device), means "guarantee"? but still i dont believe this means you have transferred all frames to DUT unless you get some ACK from DUT that all 5 frames received with correct CRC check n all.


That's how I interpret the help for the Queued session types.  I write 5 frames with XNet Write, each goes out one at a time waiting for the ACK from any node on the bus, and only after all 5 have been ACK'ed will the Transmit Complete return.  Again for single point I can guess how it will function, but I would need to test it first.

0 Kudos
Message 8 of 11
(2,841 Views)

This wait function does not accept single point output session types (whether frame or signal), I believe it will generate an error if you try.  I came across this in my testing.

 

 

With respect to your comment about environment, for me it is a matter of context.  If my test setup for validating hardware and/or firmware, then whether or not the message actually made it to the bus is much more important, as if the device does not respond to even a single valid message I need to know about it.  If the message never makes to the bus, then I can't fault my DUT.  In other contexts where I am performing processes on already proven HW/FW, I don't necessarily care and might just spam the system with requests until I get what I want.

 

Admittedly part of my issues here are solvable via software architecture where I write in some more termination options for my lower level XNET wrapper functions I have made in order to deal with the "less than straightforward" handling of multiplexing by XNET.  Having a "stop" notifier wired in that can be tied to some arbitrary external condition might be a more modular approach.

 

 

0 Kudos
Message 9 of 11
(2,837 Views)

I should add also: the single point mode is arguably the root of the evil here.  If I could do it all over again I would never have used this mode for any of my drivers, but when first starting out it seems like the obvious thing to do if all you want to do is write one item.  I think with a queued session that you ask to write 1 item, and use the wait VI with single shot transmit set false, the problem is solved.

0 Kudos
Message 10 of 11
(2,836 Views)