GrovePi hang on digitalRead in Pi4

Hi,
I can’t run the grove_button.py example. It hang on the digitalRead(). I have a Pi4 Model B 1G. I updated the firmware. Version is 1.4.0 . Here is my log file:

Check space left

Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 3.6G 11G 26% /
devtmpfs 299M 0 299M 0% /dev
tmpfs 428M 0 428M 0% /dev/shm
tmpfs 428M 5.9M 422M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 428M 0 428M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 48M 205M 19% /boot
tmpfs 86M 4.0K 86M 1% /run/user/1000

Check for dependencies

python 2.7.16-1 install ok installed
python-pip 18.1-5+rpt1 install ok installed
git 1:2.20.1-2+deb10u3 install ok installed
libi2c-dev 4.1-1 install ok installed
python-serial 3.4-4 install ok installed
python-rpi.gpio 0.7.0-0.1~bpo10+4 install ok installed
i2c-tools 4.1-1 install ok installed
python-smbus 4.1-1 install ok installed
scratch 1.4.0.6~dfsg1-6 install ok installed

I2C still in blacklist
SPI still in blacklist

Check for addition in /modules

I2C-dev already there
i2c-bcm2708 already there
spi-dev already there

Hardware revision

RPI4 Pi 4 Model B 1G

Check the /dev folder

i2c-1
ttyAMA0

USB device status

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
Raspbian for Robots Version

cat: /home/pi/di_update/Raspbian_For_Robots/Version: No such file or directory

Hostname

raspberrypi

Checking I2C bus for devices

Checking I2C bus 0

NOTE: it is normal for this one to fail
Error: Could not open file /dev/i2c-0' or /dev/i2c/0’: No such file or directory

Checking I2C bus 1

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Checking for firmware version

Thanks for you help!

1 Like

same Problem with all Sensors, doeasn’t mather if it is a digital or analgoRead or a digitalWrite on a Relay… strange behaviour

1 Like

Just to let you know that I fixed the problem by slowing the clock in the /boot/config.txt from 700 to 600. Other posts suggested that the Pi 4 is too fast for actual GrovePi library… I didn’t want to add delays before each port reading so I prefer to lose a little bit of clock speed. Tell me if it fixes your problems too…

1 Like

I haven’t tried it yet, but what kind of errors are you getting while it hangs on?

Will try your suggestion and give you a feedback.

1 Like

The Pi-4 has caused other issues on other platforms as well - see my posting about flashing GoPiGo-3 firmware using a Pi-4.

Viz.:

It’s just too fast and too advanced for the older software.

Also note that the Pi-4 must be used with Raspbian Buster or later - or a Raspbian for Robots version based on Buster or later.

Other sites have reported issues with the new 8 gig Pi-4’s that were not present with earlier Pi-4 models.

The Pi-4 is a cool beanie, can be useful, and I have one installed in my GoPiGo-3; but the Grove-Pi software was written at a time when the Pi-3 was still experimental, (and not available), so the Pi-4 is perhaps a bit much.

Note that I do not have a Grove-Pi and my examples are drawn from other issues reported on other platforms or other sites.

My, (unqualified), suggestion is to limit the Grove-Pi to earlier versions of the Raspberry Pi unless and until you are more expert at this.

On a more personal level, I want to thank everyone here for providing both exposure and support for the Grove-Pi. Many of us here have absolutely no experience with the Grove-Pi so I want to personally invite you to stay and lurk - I am learning much from your postings.

I also hesitate to impose on you all, but the presence of people using the Grove-Pi here on these fora is invaluable and I hope you can stay, lurk, post what you accomplish, and help others with Grove-Pi issues.

Thanks again and welcome in!

1 Like

I am having similar problems with RP4, GrovePi and C#/Dotnet 5.0. Somebody suggested that slowing the clock down in config.txt could help - I cannot find any setting to do with clock speed however. Anyone have details?

1 Like

As I said here:

The base operating system can be very important so we need to know what you are using.

Raspbian GNU/Linux 11 (bullseye) and the board (GrovePi+) software is level 1.4.0

Ahhh!

Bullseye. . .  That’s probably 99.999% of the problem right there.

Switch to the “Legacy” operating system, (Buster), try again. and let us know what happens.

So I should image Raspberry Pi OS (Legacy) (Debian Buster) released 2021-12-02?

What is the timeline for Bullseye compatibility?

1 Like

Absolutely!

Modular Robotics is working on it, but - as of right now - there is no ETA.  Not only are they not commenting publicly about a proposed release date, they’re not even commenting PRIVATELY about it!

Seriously, right now Bullseye is still a moving target and any work they do on it today is likely to be broken tomorrow.

The whole reason that the Raspberry Pi Foundation has taken the unprecedented step of supporting two operating systems at the same time is that Bullseye breaks too many things - and the coding effort required to bring all this stuff forward is massively huge.

Sorry about that, but you will find that Buster will probably do everything you need.

Let us know if you have any further difficulties.

Quick recap: Installed Buster with the same dotnet version, the same hardware, and the same configuration. I then installed my software. Analog inputs work, but they did before, the digital outputs work, but they did before, However, the digital inputs are still not being correctly read. I have tried differing digital input sensors (button, proximity, and magnet ) and all display similar problems during read.

I intend to explore the possibility of reading the digital inputs with python to narrow the problem domian.

1 Like