Tips & tricks
Below we’ve collected tips & tricks on data logging based on user experiences:
Reduce your file size
You can typically reduce your file size by 90%+ by applying some of the below:
- Filters: Use filters to decide what CAN IDs you wish to record or reject
- Prescalers (Time/Count): Log a CAN ID only every X ms - or for every Yth observation
- Prescalers (Data): Log a CAN ID only when data byte X or Y changes
- Control signal: Log/transmit data only when configurable thresholds are crossed (advanced)
- Compression: Use compression to cut the data size by 50-70%+ (efficiency is data dependent)
For detailed examples of setting up filters and control signals, see the CANedge Docs.
Example: A simple way to set up CAN ID filters & prescalers
- Record an unfiltered log file and open it via asammdf
- Use your DBC to decode the data and identify which CAN IDs are needed for your use case
- In the config editor enable the ‘Advanced’ view and find the filter section (CAN CH1/CH2)
- Delete the two default ‘acceptance filters’ from the filter list (these are setup to log all CAN IDs)
- Add a new
Masktype filter entry for each CAN ID you wish to record
- Set the ID to your CAN ID (HEX) and the filter mask to
- Consider adding a prescaler to reduce the frequency of the recorded IDs
Example: Creating J1939 PGN filters
You can also use the above method to filter for a 18-bit J1939 PGNs (instead of 29-bit CAN IDs). To do so, you replace the filter mask
3FFFF00. For the ID field enter the PGN followed by
00 (for example
F00400 for the PGN
As a tip, you can load your raw J1939 data in the asammdf GUI and DBC decode it. If you look at the ‘CAN logging’ summary, you’ll be able to see specifically which J1939 PGNs were matched by the DBC and which were not matched. You can then create a filter list of the matched PGNs to quickly optimize your log file size.
Set a manual bit-rate
The CANedge is plug & play with auto bit-rate detection. However, it is recommended to use a manual bit rate when possible to reduce boot time and improve performance.
Use the default real-time clock timezone (UTC)
The CANedge lets you modify the timezone by offsetting the RTC by a number of hours vs the default timezone (UTC). However, we generally recommend to keep the default UTC timezone to keep things simple. First, the offset will not accomodate daylight saving time. Second, most of the data processing software supports viewing the data timestamps in your local PC time (incl. asammdf, the MDF4 converters, Python APIs and dashboards).
Take care when transmitting data
If you intend to transmit data into the CAN bus, make sure you know what you are doing.
There are two cases to be particularly aware of:
- Custom frames: If you transmit custom CAN frames into the CAN bus, make sure you understand the implications to avoid inducing unintended behavior into e.g. a vehicle
- Battery drainage: If the device transmits data while a vehicle is off, it may wake the ECUs and cause battery drainage. Use the control signal to control transmissions in this case
Use both channels
The CANedge has 2xCAN + 2xLIN channels. In some applications you’ll directly require multiple channels. In other use cases, you can e.g. use Channel 2 to add extension modules. For example, you can use the CANmod.gps to add GNSS and 3D inertial sensor data - or the CANmod.temp to add thermocouple temperature sensor data.
Consider an advanced bit-rate
The CANedge supports a range of standard bit rates, which are optimized for most CAN based applications. However, you may be able to optimize the logging performance if you optimize the bit rate for your specific setup (cable length etc) via an advanced bit-rate.