-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to init gpiozero spi device #3
Comments
Taking a look at the Amazon listing, I think you might have the wrong driver. The error messages are a bit of a red herring. |
Thanks for the response! I was using EPD7in5v2 as the demo on that link says
and so I assumed EPD7in5v2 was the correct driver. I will admit I am a bit confused about just which drivers to use, so it is entirely possible I am mistaken! To further complicate matters, my display does have a small sticker that says "V2" on it... Regardless, I did just test your suggestion
this behaved the same, with the program hanging at
Also, I have done some troubleshooting of my own, with mixed success: I noticed that the driver board has some switches on them (see below image) but was unfortunately unable to find any explicit documentation on what they should be set to. While still using my original config
I tried just switching them to see if that would have any affect. Changing "Display Config" did nothing. Changing "Interface Config" to 1 (3-line SPI) seems to have some sort of affect. When using 3-line SPI if I run
This does seem like progress, but despite that, the display still does not work, or even turn on. I have also tested 3-line SPI with the EPD7in5 drivers and it behaves the same (hangs at I should perhaps mention I am doing all this while SSHed into my Pi. I don't think that would be affecting things? |
It sounds like your panel must be the V2 then. I was just going off the link on the Amazon listing. The V2 sticker on the board/panel is a better indication. Being SSHed into the rpi shouldn't make a difference. The 3/4 wire SPI selection does seem to though. As far as papertty is concerned it seems to think it's working, since it got up to the "Started displaying" line. One thing you could try is running the commands from within startpapertty.sh with different arguments. Other than that I'm not sure what to suggest. It sounds like papertty is communicating with the board now at least. |
Alright. I have noticed that there seem to be a few different 7in5 drivers
Thus far I have been using EPD7in5v2 (assuming I have a V2 display). Do you know what the 'b' model drivers are? Could those be the correct ones? Unfortunately You mentioned
So does that mean the line I will also note, on the off chance this is relevant, that once it says Thanks for all your help with this. |
The "b" models are the color panels. The box or the driver board might have something to say if it's B&W or color. The fact that it got up to the One suggestion I would have is to try the test programs made by waveshare. |
Alright, I have done some more testing with the demo code. Following this guide, and on a fresh install, I tried both the C and python examples. C with Notably, both demos only worked when the driver board was set to 4-line SPI, and hung when set to 3-line SPI. This is opposite to the behavior I saw when working with papertty-init. At this point, I am pretty confident that the issue is with papertty-init/papertty as the fact that the demos work seem to suggest that the HW is good, and I am using the right driver. I'll keep working on this and see if I can somehow figure out the issue. |
If it's working with the waveshare demo code then it's sounding like an issue with papertty. Looking at https://github.com/waveshareteam/e-Paper/blob/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd/ You could try putting the board in 4-line SPI and updating the EPD7in5v2 class in drivers_full.py to more closely match the waveshare version. |
I made a fork of papertty and for my initial attempt added a few lines from the epd7in5_V2.py driver which seemed to be missing from papertty's
Is there any documentation you can point me to that might help me better understand papertty and the waveshare drivers? I am afraid with only intermediate python skills and my unfamiliarity with e-ink displays figuring out what changes need to be made is proving tricky. Thanks! |
What you've added looks correct to me. It might be that you need to override one of the functions which it's currently inheriting from WaveshareFull. I'm not aware of any resources for learning papertty. Waveshare does have documentation, but its usefulness varies. |
So, I have finally had some more time to look at this again... As you suggested, I added some basic print statements to the code. print("Starting command block 1") # runs fine
# from line 92 of epd7in5_V2.py
self.send_command(0x06) # btst
self.send_data(0x17)
self.send_data(0x17)
self.send_data(0x28)
self.send_data(0x17)
print("Starting command block 2") # runs fine
self.send_command(self.POWER_SETTING)
self.send_data(0x07) # VDS_EN, VDG_EN
self.send_data(0x07) # VCOM_HV, VGHL_LV[1], VGHL_LV[0]
self.send_data(0x3f) # VDH
self.send_data(0x3f) # VDL
print("Starting command block 3")
print("Sending power on")
self.send_command(self.POWER_ON)
print("Waiting")
self.wait_until_idle() # Hangs here. Never goes idle? It runs fine all the way up to the def wait_until_idle(self):
self.send_command(0x71)
while self.digital_read(self.BUSY_PIN) == 0: # 0: busy, 1: idle
print(f"Busy pin is {self.digital_read(self.BUSY_PIN)}")
self.send_command(0x71)
print("Sending 0x71")
self.delay_ms(200) # adjusting this to 200 ms to match waveshare code and have found that the BUSY_PIN never goes to 1. Running gpiozero not found - defaulting to RPi.GPIO
Setting spacing to 0.
Failed to init gpiozero spi device
Starting command block 1
Starting command block 2
Starting command block 3
Sending power on
Waiting
Busy pin is 0
Sending 0x71
Busy pin is 0
Sending 0x71
Busy pin is 0
Sending 0x71
Busy pin is 0
Sending 0x71
Busy pin is 0 That makes me think that something is wrong with the proceeding blocks of code, but from what I can see, they all match the waveshare drivers. I also took a look at the reset function (which I am pretty sure is not the issue, but might as well be sure). The only diffrance I could see between the waveshare drivers and PaperTTY is waveshare has |
I've taken another look at the waveshare code. Going by the waveshare docs
So in short the board has changed in an incompatible way with the old driver The display code and init code look pretty similar though. send_command and send_data currently only change the DC pin. You could try copying those functions from my EPD2in13v4 driver (drivers_partial.py) and putting them in the EPD7in5v2 class.
I'm thinking that although the BUSY pin is never changing, it's because of one/all of the send_data and send_command requests before it not working properly. |
Okay, I just gave that a try. Unfortunately, nothing changed. I did confirm that the new functions are being used, it is just still getting stuck in the "busy pin is 0" loop. I also took another look at the waveshare driver and saw that their version of those functions is different than yours # functions from waveshare driver
def send_command(self, command):
print("Using WS New Func!")
self.digital_write(self.DC_PIN, 0)
self.digital_write(self.CS_PIN, 0)
self.spi_writebyte([command])
self.digital_write(self.CS_PIN, 1)
def send_data(self, data):
print("Using WS New Func!")
self.digital_write(self.DC_PIN, 1)
self.digital_write(self.CS_PIN, 0)
self.spi_writebyte([data])
self.digital_write(self.CS_PIN, 1)
def send_data_multi(self, data):
print("Using WS New Func!")
self.digital_write(self.DC_PIN, 1)
self.digital_write(self.CS_PIN, 0)
self.SPI.writebytes2(data)
self.digital_write(self.CS_PIN, 1)
def spi_writebyte(self, data):
self.SPI.writebytes(data) so I tested those as well. They also did not work, with it still stalling with busy pin 0. For reference, the latest version of the code I'm using. |
Going over the comments on the reset function again, it sounds a lot like what you're running into.
I'd suggest playing with those values a bit to see if you can get past the wait_until_idle after POWER_ON. |
Good idea. That comment does seem to describe the error I am getting. I messed around with the reset function though, and could not find a fix. First, for reference, the waveshare function # Hardware reset
def reset(self):
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20)
epdconfig.digital_write(self.reset_pin, 0)
epdconfig.delay_ms(2)
epdconfig.digital_write(self.reset_pin, 1)
epdconfig.delay_ms(20) I tested a few different things, such as:
None of these changed the behavior (getting stuck with busy 0). I also confirmed that the reset pin is 17 in both the waveshare code and PaperTTY. Looking at the issues over on the waveshare repo, I saw this issue, which made me think maybe waveshare's I also saw this issue, and out of curiosity tried changing the line in while self.digital_read(self.BUSY_PIN) != 0 That did cause the code to run all the way through
but the screen is blank, so I don't think that is a fix. Another thing I saw, was this mention of the Also tested this old issue, by changing def wait_until_idle(self):
self.send_command(0x71)
count = 0
print("Entering while loop....")
print(f"Busy pin is {self.digital_read(self.BUSY_PIN)}")
print(f"Count is {count}")
while (self.digital_read(self.BUSY_PIN) == 0) and (count < 100): # 0: busy, 1: idle
print(f"Busy pin is {self.digital_read(self.BUSY_PIN)}")
self.send_command(0x71)
print("Sending 0x71")
self.delay_ms(20) # adjusting this to 200 ms to match waveshare code
count += 1
print(f"Count is {count}") Intrestingly enough, the code made it through the init process
only to enter
No idea if this is progress towards a fix, or just me breaking it in a new way... I also think this issue predates the new V2 code, so it might not be relevant to my screen. I will say this comment is a bit concerning, as it implies that there may be issues in waveshare's code, although again considering the example runs fine, maybe not? So far, those are all the ideas I have. As usual, the latest changes are on my fork. And thanks for your continued help with this. I'd be even more lost without it! |
I have been working the same issue all morning using a RPI zero2W, 7in5v2 (verified), Bookworm, 3-line SPI, and gpiozero. Here is the feedback from SSH with no screen flicker: Has anyone found a fix for this? |
Hi @jamesmpls80 I'm afraid I don't have much to offer in the way of a fix. This thread is pretty much up to date with my attempts to find one, which so far have been unsuccessful. I will admit to being pretty stumped at this point, and I have kind of put this project on the back burner for now... If you decide to try more troubleshooting, perhaps this thread and my fork of attempted fixes may be of some help, if only as a starting point. None of it works fully, but maybe you will see something I have missed. If you do manage to get it working, do let me know! I'd love to be able to get my screen functioning. |
Hello!
I am trying to get papertty-init to run on my Pi4,. I am using a fresh install of Raspberry Pi OS Lite and this e-ink display. I have ran papertty-init cli with the following settings:
papertty-init runs and reports the installation has finished. When I reboot the screen does not work, and if I manually run
bash startpapertty.sh
it saysand freezes. My
/boot/firmware/config.txt
does haveand I have rebooted multiple times, so I believe SPI is working. Any guidance on how to fix this?
The text was updated successfully, but these errors were encountered: