REXGEN 2REXGEN 2 IMU GNSSREXGEN AirREXGEN ProDeveloper
REXGEN XML examples: GNSS, IMU, analogue and RTC data onto CAN
Load a ready-made configuration that puts the logger's GNSS position, IMU motion, analogue inputs or clock onto a CAN bus. Then adjust the channel, bit rate, identifiers and rates to suit.
Before you start
Each example is an XML file with a matching DBC file in the Rexgen_XML_Examples repository on GitHub. Every file validates against the schema. Use them to feed live position or motion to a CAN dashboard or instrument cluster. You can also use the logger as a GNSS or IMU module for another CAN data logger.
- A model with the source. GNSS and IMU need REXGEN 2 IMU GNSS, REXGEN Air or REXGEN Pro. Analogue inputs need REXGEN 2, REXGEN 2 IMU GNSS, REXGEN Air or REXGEN Pro. The clock example runs on any of these.
- REXDESK, to load the file. See REXGEN XML configuration: how it fits together.
- A CAN tool that reads DBC files, to check the output on the bus.
Every example sends on CAN 0 at 500 kbit/s. The "with recording" version of each file adds a recorder. It records every output message and source to internal storage from power-on, in files of up to 100 MiB or one hour. It also streams the same data to REXDESK over USB.
Change the channel, bit rate, identifiers and rates
The same edits apply to every example. Open the file in a text editor, change the value and load it again.
- CAN channel
-
PhysicalNumberin theCANINTERFACE:0for CAN 0,1for CAN 1, up to the channels your model has. See REXGEN XML reference: CAN interfaces and bit timing. - Bit rate
-
CANBusSpeedin theCANINTERFACE, in bit/s. - Identifier
-
MessageIdentStartandMessageIdentEndin theCANMESSAGE, both set to the new identifier in decimal. Change the DBC file to match, or it no longer decodes the message. - Transmission period
-
Periodin theCANMESSAGE, in milliseconds. - Sampling rate
-
SamplingRatein theGNSSINTERFACE,ACCELEROMETER,GYROorINTERNAL_PARAMETER, orRatein theADC, in milliseconds. - IMU range
-
RangeHiandRangeLowin eachACCELEROMETER(g) andGYROblock, notSamplingRate. - Log file size and length
-
MaxLogSize(bytes) andMaxLogTime(seconds) in theSDINTERFACEof the "with recording" files.
This is the first GNSS message, 299 (12B hex), sent every 100 ms on the interface with UID 4:
<CANMESSAGE UID="20">
<MessageIdentStart>299</MessageIdentStart>
<MessageIdentEnd>299</MessageIdentEnd>
<Direction>OutputPeriodic</Direction>
<DLC>8</DLC>
<IsExtended>false</IsExtended>
<InterfaceUID>4</InterfaceUID>
<Period>100</Period>
<TriggeringMessageUniqueID>0</TriggeringMessageUniqueID>
<DefaultHex>0000000000000000</DefaultHex>
<CANFD_Option>NORMAL_CAN</CANFD_Option>
<InputMessageUID>0</InputMessageUID>
<Name/>
<isJ1939>false</isJ1939>
<J1939Source>0</J1939Source>
<J1939Destination>0</J1939Destination>
<Downsampling>0</Downsampling>
<Delay>0</Delay>
<NextOutputMessageID>0</NextOutputMessageID>
</CANMESSAGE>
GNSS position to CAN
This example runs on REXGEN 2 IMU GNSS, REXGEN Air and REXGEN Pro. The logger reads the receiver every 100 ms and sends five messages every 100 ms. All signals are little-endian (Intel).
| Identifier | Bits 0 to 31 | Bits 32 to 63 |
|---|---|---|
| 299 (12B hex) | Altitude | Speed over ground (bits 32 to 47) |
| 300 (12C hex) | Longitude | Latitude |
| 301 (12D hex) | Date and time | Ground distance |
| 302 (12E hex) | Course over ground | Number of satellites |
| 303 (12F hex) | Fix quality | Not used |
A CANSIGNAL writes each GNSSMESSAGE value into its message. Altitude, for example, goes into a signed 32-bit field scaled by 0.01:
<CANSIGNAL UID="22">
<InputType>COMMON</InputType>
<InputUID>13</InputUID>
<MessageUID>20</MessageUID>
<StartBit>0</StartBit>
<BitCount>32</BitCount>
<Endian>INTEL</Endian>
<DefaultValue>0</DefaultValue>
<ParA>0.01</ParA>
<ParB>0</ParB>
<SignalType>SIGNED</SignalType>
<Name>Altitude</Name>
</CANSIGNAL>
The files are GNSS2CAN_Only.xml and ReXgen_IMU_Out_V3.dbc in the GNSS_to_CAN folder.
GNSS to CAN with recording
GNSS2CAN_SD.xml sends the same five messages and streams them over USB. It also records them with all eleven GNSS values in the file, including the GNSS timestamp and geoid separation, which are not sent on CAN. The files are in the GNSS_to_CAN_SD folder.
IMU motion to CAN
This example runs on REXGEN 2 IMU GNSS, REXGEN Air and REXGEN Pro. The logger samples each axis every 100 ms (10 Hz) and sends two messages every 100 ms. The accelerometer uses the ±16 g range and the gyroscope a ±500 range.
| Identifier | Bits 0 to 15 | Bits 16 to 31 | Bits 32 to 47 | Factor |
|---|---|---|---|---|
| 296 (128 hex) | AccelX | AccelY | AccelZ | 0.001 |
| 297 (129 hex) | GyroX | GyroY | GyroZ | 0.01 |
All six signals are signed, little-endian and 16 bits long. One ACCELEROMETER or GYRO block for each axis feeds one signal:
<ACCELEROMETER UID="8">
<PhysicalNumber>0</PhysicalNumber>
<Axis>X</Axis>
<SamplingRate>100</SamplingRate>
<RangeHi>16</RangeHi>
<RangeLow>-16</RangeLow>
</ACCELEROMETER>
<CANSIGNAL UID="16">
<InputType>COMMON</InputType>
<InputUID>8</InputUID>
<MessageUID>14</MessageUID>
<StartBit>0</StartBit>
<BitCount>16</BitCount>
<Endian>INTEL</Endian>
<DefaultValue>0</DefaultValue>
<ParA>0.001</ParA>
<ParB>0</ParB>
<SignalType>SIGNED</SignalType>
<Name>AccelX</Name>
</CANSIGNAL>
The accelerometer ranges on REXGEN 2 IMU GNSS are ±2, ±4, ±8 and ±16 g.
The files are IMU2CAN.xml and ReXgen_IMU_Out_V3.dbc in the IMU_to_CAN folder.
IMU to CAN with recording
IMU_out_SD.xml sends the same two messages and streams them over USB. It also records them and the six axes. Its UIDs differ from IMU2CAN.xml, so do not mix blocks from the two files. The files are in the IMU_to_CAN_SD folder.
Analogue inputs to CAN
This example runs on REXGEN 2, REXGEN 2 IMU GNSS, REXGEN Air and REXGEN Pro. The logger reads analogue inputs 0 and 1 every 100 ms and sends them every 100 ms in message 298 (12A hex). Input 0 is in bits 0 to 15 and input 1 in bits 16 to 31. Both are signed, little-endian and scaled by 0.01. The DBC also defines two digital signals in bits 32 to 63 that this file does not fill.
The full file is the complete valid example in the overview guide. See REXGEN XML configuration: how it fits together.
The files are ADC2CAN_Only.xml and ReXgen_IMU_Out_V3.dbc in the ADC_to_CAN folder.
Analogue inputs to CAN with recording
ADC2CAN_SD.xml adds a recorder for the message and both inputs, and streams them over USB. The files are in the ADC_to_CAN_SD folder.
Real-time clock to CAN
The logger reads its real-time clock once a second as an INTERNAL_PARAMETER. It sends the value every 1,000 ms in message 516 (204 hex) as a 32-bit unsigned value. This signal is big-endian (Motorola), so its start bit is 7, as in the DBC line 7|32@0+.
<INTERNAL_PARAMETER UID="1200">
<InputUID>0</InputUID>
<Parameter_Type>RTC</Parameter_Type>
<Value_Type>ULONG</Value_Type>
<SamplingRate>1000</SamplingRate>
</INTERNAL_PARAMETER>
<CANSIGNAL UID="44">
<InputType>COMMON</InputType>
<InputUID>1200</InputUID>
<MessageUID>42</MessageUID>
<StartBit>7</StartBit>
<BitCount>32</BitCount>
<Endian>MOTOROLA</Endian>
<DefaultValue>0</DefaultValue>
<ParA>1</ParA>
<ParB>0</ParB>
<SignalType>UNSIGNED</SignalType>
<Name>RTC</Name>
</CANSIGNAL>
RTC2CAN.dbc gives the RTC signal a range of 0 to 255, which is too small for a 32-bit value. Widen it in your copy.
The files are RTC2CAN.xml and RTC2CAN.dbc in the RTC_DATA_TO_CAN_BUS folder.
Where to go next
Products in this guide
Still stuck?
Our engineers answer support questions on every Influx Technology product.