J1939 Mapping

I have a IXXAT CAN@net NT 420 and one J1939 sensor connected to CAN port 2.
This sensor do not have a changeable source address, so that’s why I bought this IXXAT to be able to use all 4 of the same type later.

I just want to send off 4 sensor values per sensor to a MQTT broker.

I have the connection with the broker established and got a test message through using the Action Rules.

Now I needs some help with configuring the J1939 Mapping.

Hi Lars,

Have you reviewed the J1939 Mapping Section in the User Manual? There are some examples there.

Let me know if you have any questions after reviewing those.

Kyle

Yes, I have, but I need some guidance configuring this device.
If I don’t need to route messages between CAN channels, and just send all data via MQTT from these J1939 sensors, do I still need to setup the regular “Mapping Table” or just the “J1939 Mapping table” ?
I would like to talk to someone about this setup.

I’m pretty sure that you only need to set up the J1939 Mapping table and Action Rules. I can set up a Teams meeting with you and try to pull in someone from the IXXAT team that has experience with this type of setup. Let me see when they would be available. Are there certain days that work better for you or are you just looking for ASAP? It will most likely have to be earlier in the day (before noon).

Hi Lars,

I emailed Andreas about your project and he had some feedback. I will summarize:

  1. Multiple J1939 sensors can not be connected to the same CAN bus if the source address is not changeable, because they use CAN messages with the same identifiers.

     Please connect the four J1939 sensors
     to the separate CAN ports of the CAN@net NT 420.
    (Please terminate each of the four CAN busses correctly
     using CAN termination resistors at each end of each CAN bus)
    
  2. If the four J1939 sensors are separately connected to four CAN ports then you can configure the transmission of the MQTT

     a) using the Action Rules
    

or 
    
b) using the MQTT/CAN Bridging

  1. Using the J1939 Mapping Table you can configure the CAN@net NT 420 so that the PGNs from CANN2, CAN3 and CAN4 (from the Sensor2, Sensor3 and Sensor4) will be forwarded with another source number to the CAN1 using other identifiers (without any collisions).

  2. In regards to setting up a meeting

    I would recommend using the way described above:
    Using the Action Rules the CAN messages can be published complete in the JSON format or only certain database.
    Using the MQTT/CAN Bridging the CAN messages can be published in JSON format only.

    I am to happy (to do a Teams call) when I get a detailed problem description in a written form before the meeting
    (so that I have time to think about it :and be prepared if he has any further technical questions.)

I do have 4 channels but I’m currently just using onbe of the sensors on channel 2.
I think my problem is how I enter the CAN Identifier for the IF event.
The sensors spec says:
PGN number: 0xFD08
Source Address: 0x3F
Byte0-1 measurement 1
Byte 2-3 measurement 2
Byte 4-5 measurement 3
Byte 6-7 measurement 4

What should my CAN identifier be?
Should I use STD or Extended ?

  1. The CAN identifier should be something like: 0x18FD083F (but I am not positive, especially about the priority).

    I think the best way to determine the CAN identifier is to check it using the canAnalyser V3 mini:

    • Please configure the CAN@net NT 420 for VCI-Mode
    • Configure (add and start) the CAN@net NT 420 in the “VCI device server control”
    • Start the canAnalyser V3 mini, select the correct Baudrate (250kBd or 500kBd) and
      start the second CAN-Controller of the CAN@net NT 420 in the canAnalyser V3 mini
    • You should now see which identifiers are received from the J1939 sensor.
  2. J1939 always use extended (29bit) CAN identifiers.

  3. J1939 usually uses the CAN baudrate 250kB or 500kB (Do not forget the CAN termination resistors)

So when configuring the NT420 in VCI Mode, are the configurations for LocalCAN Bridge still active, or is it either or?

I can get the CAN interfaces to come online, following your instructions above, in the canAnalyzer3 Mini, but no data is showing being received

I would like to set up a meeting with Andreas.

I’m at least now able to see data in the canAnalyzer and the ID shows as “18FEEE3F”,
as for PGN : FEEE,
but I’m not able to see anything from PGN FD08 or FF31 which are also available on this sensor.

I figured out a bit more. I had the CAN ports set to TX passive.
Afterning turning that off I can see all the messages from the other PGN.

This brings up a new question.
Can I apply any math/scaling to the byte data before sending to MQTT broker?

Or is maybe that only possible with Lua ?

If that’s the case, ant examples of that would be great.

Thanks

Yes, it is “either or”.
Unfortunately the CAN@net NT 420 can not be configured for several modes simultaneously.

Unfortunately the math/scaling of data bytes is not possible using the “Action rules” and “MQTT/CAN Bridging”

Yes, you can change the data bytes and send MQTT messages using Lua script

Yes, the LUA programming examples are in the following directory:

c:\Users\Public\Documents\HMS\Ixxat CanGWconfig\Examples\Lua\examples\can_demo.lua

Awesome, I got it to work with a simple Lua script and one CAN message writing successfully to the MQTT broker.

What I’m not clear about is how I would add a second CAN ident to the payload .
Would I just add that to the can.register_msg() statement, and if so, how would I do that correctly?

Andreas send me this pseudo code (I’m sorry the formatting went a little nuts trying to copy and paste it here):

function initialize()
print("initialize")
    can.register_msg({                                 -- registration for the receiving of the message 1
    format  = "ext",
    data_as = "array",
    ident   = 0x001,
    topic   = 1,
    port    = 1,
})
can.register_msg({                                 -- registration for the receiving of the message 2
    format  = "ext",
    data_as = "array",
    ident   = 0x002,
    topic   = 2,
    port    = 1,
})

end

-- The function on_can is called if a CAN message was received

function on_can(topic, port, format, ident, data)
if  topic == 1 then                                -- if message 1 received
    local payload1 = json.encode({
                                  port   = port,
                                  format = format,
                                  ident  = ident,
                                  data   = data
                               })
    print("publish MQTT message")
    mqtt.publish("/ixxat_CAN@net/Message1", payload1, 0)

    elseif topic == 2 then
    local payload2 = json.encode({
                                  port   = port,
                                  format = format,
                                  ident  = ident,
                                  data   = data
                               })
    print("publish MQTT message")
    mqtt.publish("/ixxat_CAN@net/Message2", payload2, 0)
end

end

I got it all to work ! Thanks for the help.

Now I have a different issue.
I’m posting data to the MQTT broker with a Lua script, but data stops posting after around 30 min.
If I power cycle, it starts back up.

correction, it’s more around 20 min

I just noticed that the Gateway configurator tool shows the following in the Dashboard’s error box:
Status: Error
Alloc Err: 86
Mailbox Err: 0

Any information on what this means?

The above error info was for CAN3 where nothing is hooked up.
After reset it shows Error status : Operational

We are trying to reproduce the problem, but haven’t had any success yet.

Can you please make sure to terminate all CAN interfaces on the CAN@net NT even if nothing is connected (even the unconnected CAN controllers should be terminated with a CAN termination resistor).

Maybe the CAN controller goes into the CAN-Bus-Off mode?

Are there CAN Error Frames on the CAN bus?

Can you please add the “CAN Bus-Off detected then Recovery" Action rules for each CAN controller?

All interfaces are now terminated.
I added the action rules you described. Same thing is still happening.
I did not see any info about Error frames omn the CAN bus. Where exactly do yuu want me to look?
The STAT LED on the NT 420 is flashing Red/Green before and after it stops sending data.