chrisys / train-departure-display

A replica, near real-time, miniature UK railway station train departure sign based upon a Raspberry Pi Zero and 256x64 SPI OLED display
243 stars 75 forks source link

SPI Device Not Found #1

Closed Kincade120 closed 1 year ago

Kincade120 commented 5 years ago

Attempting to run the python code on Raspian, I get

/home/pi/.local/lib/python3.7/site-packages/luma/core/interface/serial.py:185: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  self._gpio.setup(pin, self._gpio.OUT)
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/luma/core/interface/serial.py", line 280, in __init__
    self._spi.open(port, device)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./src/main.py", line 256, in <module>
    serial = spi()
  File "/home/pi/.local/lib/python3.7/site-packages/luma/core/interface/serial.py", line 284, in __init__
    raise luma.core.error.DeviceNotFoundError('SPI device not found')
luma.core.error.DeviceNotFoundError: SPI device not found

My python version is 3.7.3

Not sure where Im going wrong here.

stuartbain commented 5 years ago

Is SPI enabled in Raspbian?

sudo raspi-config

Select 5 Interfacing Options, then P4 SPI, Yes (to enable the SPI interface)

kdavis commented 5 years ago

@stuartbain That fixed it for me! Thankyou!

chrisys commented 5 years ago

Good stuff @KeirDavis1 - thanks for helping @stuartbain. Would be great to see some photos when you finish the project.

KGS-STEAM commented 1 year ago

Hi, I'm getting a similar error trying to run through the balena deployment, any help appreciated. I can see that the "spi=on" DT parameter is set so not sure what's going on.

Starting Train Departure Display v0.3.8 main /usr/src/python-packages/luma/core/interface/serial.py:206: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. main self._gpio.setup(pin, self._gpio.OUT) main Traceback (most recent call last): main File "/usr/src/python-packages/luma/core/interface/serial.py", line 309, in init main self._spi.open(port, device) main FileNotFoundError: [Errno 2] No such file or directory main
main During handling of the above exception, another exception occurred: main
main Traceback (most recent call last): main File "src/main.py", line 325, in main serial1 = spi(port=1,gpio_DC=5, gpio_RST=6) main File "/usr/src/python-packages/luma/core/interface/serial.py", line 320, in init main raise luma.core.error.DeviceNotFoundError('SPI device not found') main luma.core.error.DeviceNotFoundError: SPI device not found

BobBurrows48 commented 1 year ago

Having exactly the same issues as KGS-STEAM. tried on both a pi zero w and a pi zero 2 w. same outcome. Was worried I'd brought a duff screen but maybe not.

any help would obviously be really appreciated.

many thanks

Bob

gjwell commented 1 year ago

Same here, I have tried 2 Pi zero w's two different displays. I have changed the 0Ohm resistor from R6 to R5 to enable 4SPI. triple checked wiring. metered out connections to ensure continuity and checked 3v supply to display. I guess the next thing to try is check the displays with an arduino.

any help would be really appreciated.

Dreadmond commented 1 year ago

Have you tried adding spi1-3cs using the “Define DT overlays” option? It’s found under device configuration on balena cloud.

It’s mentioned in the guide for setting up dual screens, but I seemed to need it for a single screen.

On Sat, 11 Feb 2023 at 13:47, gjwell @.***> wrote:

Same here, I have tried 2 Pi zero w's two different displays. I have changed the 0Ohm resistor from R6 to R5 to enable 4SPI. triple checked wiring. metered out connections to ensure continuity and checked 3v supply to display. I guess the next thing to try is check the displays with an arduino.

any help would be really appreciated.

— Reply to this email directly, view it on GitHub https://github.com/chrisys/train-departure-display/issues/1#issuecomment-1426775186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWAMUOW4BI3CQWBEUCT5I6TWW6J7LANCNFSM4ILLNYRQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

gjwell commented 1 year ago

@Dreadmond. You are a star!! This is exactly what I needed. Just tried it ant it works! Thank you so much for taking the time.

KGS-STEAM commented 1 year ago

Agreed thank you so much @Dreadmond ! Worked like a charm!

chrisys commented 1 year ago

Thanks for sharing this guys - I'll take a look here as this definitely wasn't necessary in the past!

chrisys commented 1 year ago

Note to myself - it looks (from the logs) like the device is trying to run in dualScreen mode anyway, which explains why enabling the second SPI port resolves the error. Probably something to do with the recent changes to configuration options

jruys commented 1 year ago

+1 - That setting fixed it for me too, thanks @Dreadmond! Already bough a replacement screen as I assumed the old one was broken.

chrisys commented 1 year ago

OK should be fixed now - thanks for reporting it all!