Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c_packet: new decoder for forming packets from i2c data #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sespivak
Copy link

@sespivak sespivak commented Aug 7, 2022

i2c_packet protocol decoder stacks with i2c PD and allows to combine several data bytes from "START" i2c condition until "STOP" and puts this data in a dedicated annotation.

Possible data formats for data output are hex, ascii, dec, bin and oct.

Снимок экрана от 2022-08-12 16-50-15

Example of logging data packets with the sigrok-cli:

$ sigrok-cli -d fx2lafw -c samplerate=1M --continuous \
             -P i2c:scl=D2:sda=D3,i2c_packet:transaction=yes \
             -A i2c_packet
i2c_packet-1: 0x08 WR: 04 [SR] 0x08 RD: 05 00 00 04 11 00 00 0A 00 01
i2c_packet-1: 0x08 WR: 04 [SR] 0x08 RD: 05 00 00 04 11 00 00 0A 00 01
i2c_packet-1: 0x08 WR: 04 [SR] 0x08 RD: 05 00 00 04 11 00 00 0A 00 01

Tests added in PR sigrokproject/sigrok-test#19

@sespivak sespivak changed the title i2c_packet: new decoder to form packets from i2c data i2c_packet: new decoder for forming packets from i2c data Aug 7, 2022
@sespivak sespivak force-pushed the i2c_packet branch 14 times, most recently from e03d170 to a05d3a9 Compare August 13, 2022 07:05
@jk-ozlabs
Copy link

I get the following error when running pulseview:

srd: Failed to load decoder i2c_packet: annotation class/row IDs contain duplicates

It looks like the annotations and annotations_rows entries need to be distinct.

This helps for me:

diff --git a/decoders/i2c_packet/pd.py b/decoders/i2c_packet/pd.py
index ab365cc..5c299c7 100644
--- a/decoders/i2c_packet/pd.py
+++ b/decoders/i2c_packet/pd.py
@@ -64,7 +64,7 @@ class Decoder(srd.Decoder):
         ('data', 'Data'),
     )
     annotation_rows = (
-        ('data', 'Data', (Ann.DATA,)),
+        ('packet', 'Packet', (Ann.DATA,)),
     )
 
     def __init__(self):

@sespivak
Copy link
Author

@jk-ozlabs Thank you, this error fixed.

@sespivak sespivak force-pushed the i2c_packet branch 2 times, most recently from 036bad2 to 100544f Compare August 31, 2022 05:08
i2c_packet protocol decoder stacks with i2c PD and allows
to combine several data bytes from "START" i2c condition
until "STOP" and puts this data in a dedicated annotation.

Possible data formats for data output are hex, ascii, dec, bin and oct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants