Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET Write Frame Output Queued Mode: How to keep rotating through payloads.

Solved!
Go to solution

For this message ID, I have 16 different payloads to rotate through for XNET Write Frame Output.

 

Initially, I used Event Data timing type and XNET Write with Frame Output Single-Point mode in a while loop that keeps changing the payload.

 

Every once in a while, loop iterations took much longer than normal and caused a critical error with the DUT.

 

Now I'm trying to use Cyclic Data timing type and Frame Output Queued mode to avoid using a while loop.

 

If I simply queue 16 payloads, it will end up sending the last payload repeatedly after the first 15 payloads.

 

Is there any clean way to rotate through the payloads? After that last one, the first payload should be sent and so on.

 

Any helpful input would be appreciated.

0 Kudos
Message 1 of 3
(1,440 Views)
Solution
Accepted by topic author Chickentree

Oh yes, the bucket filling technique.  I mentioned this in a blog post Part 9 of my CAN blog.  You are on the right track and you do need to use a Frame Output Queued, but you need to write more frames over and over again, making sure the queue doesn't get empty.

 

Now if you are doing this because you have a counter or CRC that needs to be updated, then I'd suggest you also read Part 10 of my CAN blog.  You see XNet hardware has the ability to have code loaded on it, that will modify the frame payload before sending it out.  So if you need a counter to go up, or a CRC to be calculated you can have the card do that work for you without needing to constantly fill a bucket with frames to go out.

 

This technique is not documented, and NI doesn't advertise the feature but the demo code I have in that post should show you how it works, and you can then decide if you want to use this feature or go back to the bucket filling technique which takes more work, is harder to maintain, and uses more system resources but is officially supported.

Message 2 of 3
(1,430 Views)

Awesome, Hooovahh. Extremely helpful! In fact, I bookmarked your blog a while ago but haven't checked everything yet. Yes, it is for CRC 🙂

 

 

0 Kudos
Message 3 of 3
(1,425 Views)