Raspberry Pi I2C notworking?

I’m following this tutorial:
https://dev.blues.io/get-started/tutorials/sensor-tutorial/notecarrier-pi/raspberry-pi/python/

Everything seems to work until I actually run the python code:

import json

import notecard

from periphery import I2C

productUID = “com.planmeca.kustaa.nyholm:kustin1”

port = I2C("/dev/i2c-1")

card = notecard.OpenI2C(port, 0, 0)

req = {“req”: “hub.set”}

req[“product”] = productUID

req[“mode”] = “continuous”

print(json.dumps(req))

rsp = card.Transaction(req)

print(rsp)

This results in:

nyholku@raspberrypi:~ $ python3 test.py
{“req”: “hub.set”, “product”: “com.planmeca.kustaa.nyholm:kustin1”, “mode”: “continuous”}
Traceback (most recent call last):
File “test.py”, line 13, in
rsp = card.Transaction(req)
File “/home/nyholku/.local/lib/python3.7/site-packages/notecard/notecard.py”, line 307, in Transaction
raise Exception(“notecard request or response was lost”)
Exception: notecard request or response was lost

NB I use python3 in case it makes any difference. Python (2) did not work

hi @nyholku
This appears to be a bug that got pushed out a couple of days ago. We are taking a look to see what went wrong.

Cheers,
-Greg

Hey @nyholku just to confirm your library version, can you run the following and let us know what you see?

pip freeze | grep note-python

Also, to confirm the tutorial steps, when you run sudo i2cdetect -y 1 you see 17 in the list, correct?

pip3 freeze | grep note-python
note-python==1.4.1

sudo i2cdetect -y 1
[sudo] password for nyholku:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – 17 – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – –

I tried as suggested:

ip3 install note-python==1.4.0
Looking in indexes: Simple index, piwheels - Simple index
Collecting note-python==1.4.0
Downloading h ttps://files.pythonhosted.org/packages/58/d6/30bc3f0bc8749deb3d1ad15161c9303b8d01bc64c713b9f45bede2ee2b47/note_python-1.4.0-py3-none-any.whl
Requirement already satisfied: filelock in ./.local/lib/python3.7/site-packages (from note-python==1.4.0) (3.0.12)
Installing collected packages: note-python
Found existing installation: note-python 1.4.1
Uninstalling note-python-1.4.1:
Successfully uninstalled note-python-1.4.1
Successfully installed note-python-1.4.0
nyholku@raspberrypi:~ $ python3 test.py
{“req”: “hub.set”, “product”: “com.xxxxxxxxxxxxxxxxxxxxxxxxxxx”, “mode”: “continuous”}
Traceback (most recent call last):
File “test.py”, line 13, in
rsp = card.Transaction(req)
raise Exception(“notecard request or response was lost”)
Exception: notecard request or response was lost
nyholku@raspberrypi:~ $

Thanks very much for your response.

Can you send us some version information from your system?

$ cat /etc/os-release
$ cat /proc/cpuinfo | grep Model
$ python3 --version

sudo /etc/os-release

[sudo] password for nyholku:

sudo: /etc/os-release: command not found

nyholku@raspberrypi:~ $ sudo cat /etc/os-release

PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)”

NAME=“Raspbian GNU/Linux”

VERSION_ID=“10”

VERSION=“10 (buster)”

VERSION_CODENAME=buster

ID=raspbian

ID_LIKE=debian

HOME_URL=“h ttp://www.raspbian.org/”

SUPPORT_URL=“h ttp://www.raspbian.org/RaspbianForums”

BUG_REPORT_URL=“h ttp://www.raspbian.org/RaspbianBugs”

nyholku@raspberrypi:~ $ sudo cat /proc/cpuinfo | grep Model

Model : Raspberry Pi 4 Model B Rev 1.4

nyholku@raspberrypi:~ $ python3 --version

Python 3.7.3

I was able to reproduce the issue at last. Turns out this was a known issue in the firmware version.

I recommend updating the Notecard to the latest available firmware version on Notehub following the process here:
https://dev.blues.io/notehub/notehub-walkthrough/#manage-notecard-firmware

You can view an older version of this topic here:

1 Like

After update to firmware 1.5.5 it works!

python3 test.py
{“req”: “hub.set”, “product”: “com.planmeca.kustaa.nyholm:kustin1”, “mode”: “continuous”}
{}

Now towards the next learning event :wink: :wink:

BTW The firmware update paused or stuck at 33% and 66% and when queried the status via the serial terminal the device idle and at some time it reported modem being off to conserve power. I got impatient and requested sync again. Eventually it all panned out.

Are those pauses during firmware update normal?

1 Like