Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplexing with XNAT and CAN

Hello,
I have problems sending multiplexed frames with XNET and CAN bus. The attached code shows my solution for "normal" frames. But I don't understand the XNET documentation doing this for multiplexed frames. How I can get the data into the subframes?
(The dbc with the definition of the multiplexed signal is available, already)

0 Kudos
Message 1 of 5
(3,890 Views)

I've never had to deal with subframes with muxed signals. In the Database Editor I would just create a frame, create a signal under it, assign the Signal Type to Multiplexer, then create N signals with the Signal Type Multiplexed and set Mode Value to each unique value of the Multiplexer.  I've also opened a DBC in the Database Editor and had it create the signals appropriately.  Then you just write to your signals and it takes care of it.

 

I created a Frame to Signal conversion API that has a Mux example with an included DBC with mux signals in it.  You can open it and run it to get an idea how the XNet database looks, and how writing signals works, but in recent versions it doesn't call the XNet API as much for doing the conversion.

0 Kudos
Message 2 of 5
(3,855 Views)

Okay, that maybe simplifies the workflow. But how can I send the signals with the Rate, specified in the dbc? So far I can only send messages with a fixed rate timed by hardware with the session "Frame Out Queued". Signals seem to be only software timed?!

0 Kudos
Message 3 of 5
(3,837 Views)

What's wrong with writing them with a Single Point mode session type?

 

http://zone.ni.com/reference/en-XX/help/372841M-01/nixnet/modesignaloutputsinglepoint/

 

I admit I've never used this on Muxed signals so I'm not sure how it actually works.  If your intent is to do something like alternate the mux value between writes, then I suspect you will need something like Frame Out Queued, or Signal Out Waveform/XY.  In both of these cases the frames go out at the specified rate by the database, but the values that go out come from a queue that you are constantly filling, and will be popped off when the frames get written.  I typical solution to this is to have a separate running loop that just pushes more frame (or signal) values into the queue as the remaining items in the queue get smaller.

 

I could see a feature request where the writing of muxed frames gets a feature where you specify the order of the mux to go out, and then can use a single point write, and have the hardware alternate between values.

0 Kudos
Message 4 of 5
(3,834 Views)

Yesterday I found the solution (see attachment). You are right. Signals can be sent with specified rate in the dbc, too. A conversion from frame to signal or vice versa is not necessary.

0 Kudos
Message 5 of 5
(3,829 Views)