OverflowError: can't convert negative number to unsigned

grovepi
stretch

#1

Hello

I am new and have a problem, that GrovePi does not answer correct.
Reboot only does not help, but shutdown and switch off does.
Since i had this severel times, i would like to ask the experts what to do.

I get following error message:

Traceback (most recent call last):
  File "/home/pi/Desktop/Kony/k1/multi_digital_read_led_blink.py", line 58, in <module>
    grovepi.digitalWrite(led0,d2)
  File "/home/pi/Desktop/GrovePi/Software/Python/grovepi.py", line 209, in digitalWrite
    write_i2c_block(address, dWrite_cmd + [pin, value, unused])
  File "/home/pi/Desktop/GrovePi/Software/Python/grovepi.py", line 173, in write_i2c_block
    return bus.write_i2c_block_data(address, 1, block)
  File "/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/util.py", line 59, in validator
    return fn(*args, **kwdefaults)
  File "/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/smbus.py", line 269, in write_i2c_block_data
    list_to_smbus_data(data, vals)
  File "/usr/local/lib/python3.5/dist-packages/smbus_cffi-0.5.1-py3.5-linux-armv7l.egg/smbus/smbus.py", line 303, in list_to_smbus_data
    data.block[i + 1] = val
OverflowError: can't convert negative number to unsigned

The program i use is modifid: multi_digital_read_led_blink.py

#!/usr/bin/env python

# GrovePi LED blink test for the Grove LED Socket (http://www.seeedstudio.com/wiki/Grove_-_LED_Socket_Kit)
#
# The GrovePi connects the Raspberry Pi and Grove sensors.  You can learn more about GrovePi here:  http://www.dexterindustries.com/GrovePi
#
# Have a question about this example?  Ask on the forums here:  http://www.dexterindustries.com/forum/?forum=grovepi
#
'''
## License

The MIT License (MIT)

GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright (C) 2017  Dexter Industries

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


import time
import grovepi

# Connect the Grove Button to digital port D2,D3 and D4
button2 = 2
button3 = 3
# Connect the Grove LED to digital port D4,D5,D6
led0 = 4
led1 = 5
led2 = 6

grovepi.pinMode(button2,"INPUT")
grovepi.pinMode(button3,"INPUT")
grovepi.pinMode(led0,"OUTPUT")
grovepi.pinMode(led1,"OUTPUT")
grovepi.pinMode(led2,"OUTPUT")

while True:
    try:
        d2=grovepi.digitalRead(button2)
        d3=grovepi.digitalRead(button3)
        #Blink the LED
        grovepi.digitalWrite(led0,d2)
        grovepi.digitalWrite(led1,d2)		# 
        grovepi.digitalWrite(led2,not d2)		# 
        print ("LED",d2,d3)
        time.sleep(1)

    except IOError:			# Print "Error" if communication error encountered
        print ("Error")

And i use original raspberry NOOBS_v2_7_0 added with:

Setup GrovePi:

sudo curl -kL dexterindustries.com/update_grovepi | bash

sudo reboot

sudo i2cdetect -y 1

cd /home/pi/Desktop/GrovePi/Firmware
sudo chmod +x firmware_update.sh
sudo ./firmware_update.sh

Any idees, what the problem might be?

Thanks


#2

Hi @skybird,

Can you tell us what version of Raspbian are you using? You can do this by entering the following command:

cat /etc/os-release

We need to determine if you’re using Jessie or Stretch release.

Thank you!


#3

Hi RobertLucian

Here you are:

PRETTY_NAME=“Raspbian GNU/Linux 9 (stretch)”

NAME=“Raspbian GNU/Linux”

VERSION_ID=“9”

VERSION=“9 (stretch)”

ID=raspbian

ID_LIKE=debian

HOME_URL=“http://www.raspbian.org/

SUPPORT_URL=“http://www.raspbian.org/RaspbianForums

BUG_REPORT_URL=“http://www.raspbian.org/RaspbianBugs

Thank you for your support.


#4

Hi @skybird,

So I’ve researched a little bit into this issue and it seems like smbus is not compatible with the last release of Raspbian, that is Stretch.

In the very near future, we have already planned to replace smbus with another library that does work with the latest release.

Until then, all I can recommend is to either downgrade the kernel version, or switch to Jessie. The other option, which I wouldn’t have much hope, is to wait for smbus's team to come up with a fix for it.

Thank you!


#5

Thank you
RobertLucian

I will download Jessie, and work with that relaese for the moment.

Where will i find information what is supported by GrovePI?

To see, when Dexter will support stretch.

Thanks


#6

Hi @skybird,

We already have started to work on porting the GoPiGo to Stretch, so after we’re done with it, we’ll probably move on to fixing the GrovePi.

Where will i find information what is supported by GrovePi?

Are you asking us what sensors can be used with the GrovePi? If so, here’s a link for it:
https://www.dexterindustries.com/grovepi/
If you just scroll waay down the page, you’ll see a matrix list of all the sensors we support for it.

Thank you!


#7

Hi RobertLucian

I am asking about the software.

How can I find out that the new VERSION = “9 (stretch)” is supported?

Will this be announcement on the Dexter homepage?

Thank you, Kony


#8

Hi @skybird,

We’ll probably announce it here on the forum as pinned-post or there will be something on the GrovePi’s homepage (on our website).

Thank you!


#9

Thank you
RobertLucian


#10