Skip to content

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

Open
sespivak wants to merge 1 commit into
sigrokproject:masterfrom
sespivak:i2c_packet
Open

i2c_packet: new decoder for forming packets from i2c data#92
sespivak wants to merge 1 commit into
sigrokproject:masterfrom
sespivak:i2c_packet

Conversation

@sespivak
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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