Python2 I2C commands fail

serial-example.py works fine when toggling the Notecarrier Hat switch for UART to ON

The issue is when trying over I2C
i2cdetect -y 1 shows that port 17 is available

Using the GitHub unchanged notecard.py and i2c-example.py the response is
“Transaction error: line 49: Exception: notecard request or response was lost”
This appears right after the “Performing transactions”, so in the line
rsp = card.Transaction(req)

req is {“req”:“card.status”} but the same error occurs when switching to {“req”:“card.version”}

Hey @Francois, I’ll take a look and see if I can reproduce this issue today.

Hey @Francois thanks again for posting this. Those examples still had some old garbage attributes in the card.status request, which was the cause of the issue. I’ve removed those and verified on a pi on my desk that they are working.

@bsatrom it works with a simple card.status or
{“req”:“file.changes”,“file”:“vitals.qo”}
but it doesn’t with a longer command like
{“req”: “note.add”,“file”:“vitals.qo”,“body”:{“date”: 1610449350,“mac”: “a4:c1:38:cf:08:f0”,“type”: “scale”,“unit_measurement”: “kg”,“weight_result”: 677}}

the longer command above works in serial

@bsatrom update: the following steps were required to fix the issue:

  1. replace entirely the older version of notecard_pi.py by the currently posted notecard.py on GitHub – replacing just the OpenI2C function with the code shown in the GitHub example is not enough – long commands will fail or maybe it was:
  2. upgrade firmware to 12332 from 12220
1 Like

Thanks @Francois I am fairly confident it was the 12332 upgrade as I was able to repro your issue yesterday with a vanilla Pi and new Pi Kit. Glad that did the trick!