Not able to communicate with Notecard on RPi using Python serial interface

I’m not understanding the serial interface to the Notecard on Raspberry Pi with Pi Carrier.

Expanding on this basic question I have, what is the relationship between the Notecard’s serial interface via the 40 pin I/O connector and the USB connector on the Pi Carrier?


The code below fails on both these ports:

equivalent I2C code works fine.

I have the ‘serial txrx’ switch in the on position on the Pi Carrier board.

Configured serial to not be console, but serial hardware enabled in raspi-config.
No difference if code is run as root or not.

#!/usr/bin/env python3

# 202106091413  
# testing blues wireless card on raspberry pi
# using serial interface

import time
import sys

import notecard
from periphery import Serial

port = Serial("/dev/ttyAMA0", 9600)
card = notecard.OpenSerial(port)


req = {"req": "card.status"}

rsp = card.Transaction(req)

program output:

pi@pi-mod-2b-v1:~/blues_wireless $ sudo ./
Traceback (most recent call last):
  File "./", line 16, in <module>
    card = notecard.OpenSerial(port)
  File "/usr/local/lib/python3.7/dist-packages/notecard/", line 219, in __init__
  File "/usr/local/lib/python3.7/dist-packages/notecard/", line 164, in __init__
  File "/usr/local/lib/python3.7/dist-packages/notecard/", line 204, in Reset
  File "/usr/local/lib/python3.7/dist-packages/notecard/", line 104, in serialReset
    raise Exception("Notecard not responding")
Exception: Notecard not responding

Hey @dproffer, thanks for the question and welcome to the community!

I have a Pi and Pi carrier on my desk and will try to reproduce your issue today. In the meantime, can you confirm what Notecard Firmware version you are running? If you’re not yet on 1.5.5 can you update? I want to make sure we rule out any comms bugs that have already been resolved in a developer firmware release.

Thanks for the help. Yes the Notecard is on 1.5.5 when I did the serial test:

> {"req":"card.version"}
 "body": {
  "org": "Blues Wireless",
  "product": "Notecard",
  "version": "notecard-1.5.5",
  "ver_major": 1,
  "ver_minor": 5,
  "ver_patch": 5,
  "ver_build": 13080,
  "built": "May 28 2021 17:11:58"
 "version": "notecard-",
 "device": "dev:xxxx",
 "name": "Blues Wireless Notecard",
 "sku": "NOTE-NBGL500",
 "board": "1.11",
 "api": 1

Hey @dproffer, my apologies, but it slipped my mind that the Notecarrier Pi only supports I2C for programmatic interaction. The RX/TX dip switch provides access to the Notecard AUX_TX and AUX-RX pins for debugging, not host-Notecard interactions.

Hmmmm, okay. You might want to clarify the documentation…
which leads to the second part of my initial question… what are the various serial interfaces that I see on the several carriers I have and how do these relate to the USB serial interface that is exposed on the carriers???

I ventured down the serial route because I have a bunch of I2C sensor code that uses a different I2C library. Also, I am not sure if you have noticed but I2C is a bit fragile and the libraries such as python-periphery are not well documented and robust…

Thanks for help and if you can clarify the serial interfaces.

note-python is the official Python library for communicating with the Notecard over serial or I²C.
This library works in a desktop setting, on Single-Board Computers like the Raspberry Pi, and on Microcontrollers with MicroPython or CircuitPython support.

Hey @dproffer, the serial interfaces on the Notecard that our Notecarriers connect to are documented in the Notecard datasheet in this section.

Out of curiosity, which I2C library are you using? It might be something I can add support for at the library-level. We’ve not had any major issues with periphery thus far, but I do agree that it’s documentation leaves quite a bit to be desired.

Thank you @bsatrom for the link describing the Notecard’s I2C, UART and USB interfaces, interesting. The speed limit of 9600 bps on the UART would slow down things like host firmware updates but does not seem like it would be a limit for most use cases of the Notecard. I have gotten back to exploring the Notecard again and I am going to try and see if I can get the UART working via GPIO on a Intel Linux device I have. Hope I can get it to work via UART, as I have discovered that this device’s I2C master configuration is too fast for the Notecard. You folks could have used some design charrettes or user focus groups when you made some of your initial hardware decisions :exploding_head: IMHO.

The python periphery library seems okay. Especially, correct me if I am wrong, but I thought I got it to work without having to do privilege elevation. A limit of other libraries I have tried. However, when I saw that the only ‘documentation/example’ I could find for periphery library was a EEPROM example, I definitely had a DWR moment. My experience with a couple I2C memory chips left me with the belief that I2C memory is a real special corner case…

I have explored a couple Python I2C libraries, I find myself using the SMBUS2 library mostly, link below. I have code running on Intel Linux and Raspberry Pi with it and it runs on both without code change. The holy grail is to add the same on Circuit Python and MicroPython, however, I am not sure if that is possible or if anyone is trying to do those ports.

I have been able to replace the underlying I2C calls in a number of I2C peripheral libraries with SMBUS2 equivalent without too much difficulty and pretty solid operation. Among these are a number of the Adafruit I2C display libraries.

On a side note, you might have a look that this company’s I2C sensors for some of your demo/examples, link below. Nothing wrong with the SeeedStudio Groove examples, however the code with them is pretty complex and large. Often, I find a lot of IoT stuff I do is close to the bare metal of the processor/system, even now in Python. And these low cost I2C sensors from Electric Dollar have nice code examples that is closer to the bare metal. FYI.

smbus2 - A drop-in replacement for smbus-cffi/smbus-python in pure Python

Electric Dollar Store I2C sensors

There are a couple efforts to rationalize GPIO, I2C and other physical I/O across platforms. However, I am not versed on how far or broad they are succeeding:

Eclipse Mraa

correction, wrong library referenced:
Pure python (i.e. no native extensions) access to Linux IO including I2C and SPI. Drop in replacement for smbus and spidev modules.

I think it would be useful if you could abstract your use of I2C such that ideally different one could be slotted in based on other hardware or software requirements. Good hunting!