Moxa MGate 5121 reads J1939 data and adjusts the storage position on the Modbus side

May 27, 2025 Leave a message

Application topology:

 

info-1080-380

 

The gateway reading scheme is as follows:

 

info-1080-572

 

Gateway working mode settings

 

1. Set the protocol read by the gateway on the CAN bus to J1939 protocol. After saving and applying, the following figure is shown.

 

info-1080-507

 

2. Set the J1939 terminal reading parameters

 

2.1 Click to view J1939 parameters

 

info-1080-569

 

2.2 Configure the gateway local ID to 5 and the baud rate to 250K

 

info-1080-671

 

2.3 After confirming the CAN bus parameters, click Protocol Traffic to view the J1939 message as follows

 

info-1080-556

 

2.4 After confirming that accurate data has been received, return to the J1939 parameter configuration page for configuration.

 

info-1080-569

 

3. Follow the steps below to configure the read J1939 data

 

3.1 D1 data reading, setting name, reading address, PGN, the key is offset0 and date length1

 

info-882-425

 

3.2 D2 data reading

 

info-756-471

 

3.3 D3 data reading

 

info-763-632

 

3.4 D4 data reading

 

info-639-491

 

3.5 D5 data reading

 

info-632-617

 

3.6 D6 data reading

 

info-644-664

 

3.7 D7 data reading

 

info-559-571

 

3.8 D8 data reading

 

info-571-646

 

3.9 After configuration, please remember to click Done, then click Save, and then enable all configurations, so that all configurations can be saved completely.

 

info-1080-251

 

3.10 After saving, go to the diagnostic page to check whether the tags are saved in the corresponding data in order.

 

info-1080-500

 

After confirming that the data is saved in the corresponding data, the next step is to set the data mapping relationship on the Modbus TCP slave side.

 

4. Modbus TCP slave address mapping

 

4.1 Enter the Modbus data mapping web page

 

info-1080-605

 

4.2 Click this to configure the Modbus TCP slave parameters

 

info-554-252

 

4.3 Set the TCP slave port number to 502 and the ID to 1

 

info-1080-448

 

4.4 Add TAGS. As shown in the figure below, add J1939 data in order. First, map D1 to address 30000.

 

info-1080-411

 

4.5 Set the read J1939 data

 

info-1080-426

 

4.6 Set the J1939 data of the first Modbus register map

 

info-1080-514

 

4.7 Click DONE to save

 

info-1080-569

 

4.8 You can see that the 30000 address of the Modbus TCP slave has been mapped to the data of D1.

 

info-1080-498

 

4.9 Same as above, continue to add tags to map other J1939 data to the Modbus TCP slave end in sequence

 

info-1080-535

 

4.10 Click SAVE and GO TO APPLY SETTINGS, and finally click APPLY

 

info-1080-148

info-1080-202

 

Modbus TCP Master Read

 

1. Use Modscan to read the data and compare the original J1939 data as follows

 

Modscan connection settings are as follows

 

info-554-470

 

1.2 The reading status is as follows

 

info-1080-582

 

The above description shows that the function of data conversion and adjustment of the number of saved bits has been set up and communication is normal.