SampleCode rgb_display_pillow_bonnet_buttons.py exception

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
Cornflake
 
Posts: 4
Joined: Mon Nov 29, 2021 12:09 pm

SampleCode rgb_display_pillow_bonnet_buttons.py exception

Post by Cornflake »

Hi
I Try the Sample Code for the Display and Buttons Bonnet.
After installing the display and drivers, it show my Raspi Console and looks all ok.
But the Samplecode from this Page:
https://learn.adafruit.com/adafruit-1-3 ... thon-setup
didn't work.

I get the following Exception after starting the SampleCode:
...:~ $ sudo python3 rgb_display_pillow_bonnet_buttons.py
Traceback (most recent call last):
File "rgb_display_pillow_bonnet_buttons.py", line 49, in <module>
spi = board.SPI()
File "/usr/local/lib/python3.7/dist-packages/board.py", line 289, in SPI
return busio.SPI(SCLK, MOSI, MISO)
File "/usr/local/lib/python3.7/dist-packages/busio.py", line 286, in __init__
self._spi = _SPI(portId)
File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 22, in __init__
self._spi = spi.SPI(device=(portid, 0))
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/spi.py", line 167, in __init__
raise IOError("{} does not exist".format(device))
OSError: /dev/spidev0.0 does not exist

I even try the Kernelcode firmware reset to an older Version. After this the Display getting dark.

Can you give me advice to solve this problem please.

Greetings Cornelius

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: SampleCode rgb_display_pillow_bonnet_buttons.py exceptio

Post by adafruit_support_carter »

OSError: /dev/spidev0.0 does not exist
You need to enable SPI.

Did you go through the setup here?
https://learn.adafruit.com/circuitpytho ... spberry-pi

User avatar
Cornflake
 
Posts: 4
Joined: Mon Nov 29, 2021 12:09 pm

Re: SampleCode rgb_display_pillow_bonnet_buttons.py exceptio

Post by Cornflake »

Hi
Yes I activate SPI and do the installing-circuitpython-on-raspberry-pi Setup
But if I execute: ls /dev/i2c* /dev/spi*
There is no /dev/spidev0.0

Then I added at the end of config.txt following lines:
<#########

dtoverlay=dwc2

# --- added by adafruit-pitft-helper Tue Nov 30 01:17:39 2021 ---
hdmi_force_hotplug=0
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=drm-tftbonnet13,rotate=0,fps=60
# --- end adafruit-pitft-helper Tue Nov 30 01:17:39 2021 ---
enable_uart=1


# The following line is NEW!
dtoverlay=spi1-3cs

########>

Then I get: /dev/i2c-1 /dev/i2c-2 /dev/spidev1.0 /dev/spidev1.1 /dev/spidev1.2
But even no /dev/spidev0.0

Can I switch in the samplecode the spidev to 1.0 ?

For Information:
I use the Raspi in OTG Mode and connect over SSH

cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
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"

User avatar
Cornflake
 
Posts: 4
Joined: Mon Nov 29, 2021 12:09 pm

Re: SampleCode rgb_display_pillow_bonnet_buttons.py exceptio

Post by Cornflake »

I found the solution.

I have to remove the lines or comment it with "#":
# --- added by adafruit-pitft-helper Tue Nov 30 01:17:39 2021 ---
hdmi_force_hotplug=0
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=drm-tftbonnet13,rotate=0,fps=60
# --- end adafruit-pitft-helper Tue Nov 30 01:17:39 2021 ---

This should be getting more clear in the tutorial text.
Can I change/switch it over SSH? When I activate it, I can see the Console on the Display thats helpful if I don't run any own programm.


The sample rgb_display_pillow_bonnet_buttons.py now works.
But the buttons react slow, on the display the click is shown perhaps 500ms after. That is not useable for eg. games.
Can this be getting faster?

Thank you for your effort

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: SampleCode rgb_display_pillow_bonnet_buttons.py exceptio

Post by adafruit_support_carter »

The script in that guide should have taken care of enabling SPI. When you ran the test:
https://learn.adafruit.com/circuitpytho ... 3030038-18
after running the script, did it say SPI was OK?

User avatar
Cornflake
 
Posts: 4
Joined: Mon Nov 29, 2021 12:09 pm

Re: SampleCode rgb_display_pillow_bonnet_buttons.py exceptio

Post by Cornflake »

Hi

Yes it looks like it works:

Code: Select all

Hello blinka!
Digital IO ok!
I2C ok!
SPI ok!
done!
On the link https://learn.adafruit.com/adafruit-1-3 ... thon-setup
my problem was not know that displaying the active console block the /dev/spidev0.0
and not to know how to disable it. It would perhaps for other helpful if this info get more clear communicated in the guide.

thanks

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”