Author Topic: LIN protocol decoder for Pulseview  (Read 1455 times)

0 Members and 1 Guest are viewing this topic.

Offline AtlanTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: sk
LIN protocol decoder for Pulseview
« on: July 06, 2026, 04:06:00 am »
Where can I find a working decoder for LIN bus? I have a feeling it's not checking the checksum properly. I'll post a picture later.
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 3080
  • Country: au
Re: LIN protocol decoder for Pulseview
« Reply #1 on: July 06, 2026, 04:29:09 am »
You can do a search on 'Arduino lin bus' there appears to be a few useful hits e.g. https://github.com/NaokiS28/LINduino
 

Online HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: gb
Re: LIN protocol decoder for Pulseview
« Reply #2 on: July 06, 2026, 09:45:28 am »
You can see the source code of the sigrok LIN decoder here:
https://github.com/sigrokproject/libsigrokdecode/blob/master/decoders/lin/pd.py

It definitely handles and validates checksums, but maybe you're hitting some corner case or even a bug.

It would help if you could explain how it's not appearing to handle checksums correctly.
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3887
  • Country: gb
Re: LIN protocol decoder for Pulseview
« Reply #3 on: July 06, 2026, 10:17:35 am »
Where can I find a working decoder for LIN bus? I have a feeling it's not checking the checksum properly. I'll post a picture later.

I suggest attaching a pulseview .sr session file for others to view the data and try the decoder.
There are very slight different checksum methods for V1 and V2 LIN (just over data bytes, or data bytes and PID).
 

Offline AtlanTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: sk
Re: LIN protocol decoder for Pulseview
« Reply #4 on: July 06, 2026, 10:40:17 am »
Foto. Lin 2.1
« Last Edit: July 06, 2026, 10:42:39 am by Atlan »
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Offline AtlanTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: sk
Re: LIN protocol decoder for Pulseview
« Reply #5 on: July 06, 2026, 11:46:50 am »
Yes, but the program has some problem.
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Online HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1935
  • Country: gb
Re: LIN protocol decoder for Pulseview
« Reply #6 on: July 06, 2026, 12:21:17 pm »
I think both checksums A7 and 6B are correct according to the LIN enhanced checksum algorithm.

Yes, indeed, they are correct.

But it seems in OP's screenshot that the first packet is being flagged as "Checksum Invalid" (the dark purple annotation on the very bottom row).

@Atlan, are you sure you have configured the LIN decoder settings correctly?
 

Offline AtlanTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: sk
Re: LIN protocol decoder for Pulseview
« Reply #7 on: July 06, 2026, 01:15:50 pm »
I am attaching the files, there is nothing to configure in the decoder, especially when the CRC OK light is on next to the image, is it not wrong to calculate the CRC in pulse view or compare the calculations

the calculation in pulse view is done like this   

def checksum_is_valid(self, pid, data, checksum):
        if self.lin_version == 2:
            id_ = pid & 0x3F

            if id_ != 60 and id_ != 61:
                checksum += pid

        for d in data:
            checksum += d[2]

        carry_bits = int(checksum / 256)
        checksum += carry_bits
       
        return checksum & 0xFF == 0xFF
« Last Edit: July 06, 2026, 01:31:09 pm by Atlan »
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 3887
  • Country: gb
Re: LIN protocol decoder for Pulseview
« Reply #8 on: July 06, 2026, 03:37:25 pm »
The pulseview sr file was sampled at 20kHz according to metadata, but that's about the same as the LIN baud rate.
Try sampling at 100kHz.

Edit: I realise the checksum test fails when it shouldn't, based on uart data, but I see some framing errors. When possible I use signalling rate x5 for sample rate.
« Last Edit: July 06, 2026, 05:29:44 pm by voltsandjolts »
 

Offline AtlanTopic starter

  • Super Contributor
  • ***
  • Posts: 1053
  • Country: sk
Re: LIN protocol decoder for Pulseview
« Reply #9 on: July 06, 2026, 07:39:23 pm »
I use 1Mhz but that stupid program needs to be set up after each use, find the driver, set the device, upload the settings, but it doesn't set the trigger or sampling. What's the point of saving such settings?
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->