-
Notifications
You must be signed in to change notification settings - Fork 13
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
GPIO busy - Cs pin in use #17
Comments
If I add an overlay to remap CS0 to another pin (GPIO28): I'm not getting an error, but nothing seems to happen (I suppose I need to work more on the code for this display) Is this library using the Cs pin as general purpose GPIO or is it using the hardware SPI CS0? |
Looks like the mode of your spi pins is wrong. My output on a Pi4: The Library talks to the displays over SPI (with System.Device.Spi.SpiDevice) see EPaperDisplayHardware.cs |
Hi, thanks for the quick response. The remapped Cs0 on 28 is shown as an output. Now it is shown as output (not sure whay as input before), but when I run the code, I still get this at the point where it calls: GpioController?.OpenPin(GpioSpiCsPin); System.IO.IOException: Device or resource busy : '/sys/class/gpio/export' (note I modified it a little for me to pass an existing GpioController object instead of initialzing a new one) I will see if I can get it working using the remapped pin. From what I see in the code, you seem to use GPIO8 as any other standard GPIO, since you drive that pin manually. |
The Waveshare C Examples did the combo of SPI and direct Pin set for Command / Data Maybe the 2.7 inch Display did not need this. But i have no idea why your existing GpioController is busy (try with a new one just for testing). |
Guys, I'm was struggling with exactly the same issue yesterday evening :) I'm pretty much a beginner when it comes to GPIO and hardware-oriented programming. Can you let me know which commands you issued on the Raspberry Pi 4 to switch the Pins from "in" to "out"? |
Should be the line "dtparam=spi=on" in the config.txt on the Raspbery Pi. The "Quick Setup" guide in the Wiki should work for existing displays. |
Unfortunately, I don't know what made it switch from input to output... So far I updated the Init method with the commands from the corresponding C code and now I can at least start the display and clear the screen or set it to full black. I noticed that the C code also has a bunch of other methods to draw lines or text, do partial updates that seem to be missing in this library, but at least I am getting somewhere. |
I followed all the steps mentioned in the Wiki page (thanks!) and I enabled the SPI (dtparam=spi=on). Still, it fails to OpenPin. I can remember that your code worked, when I reconfigured the csproj to work with .NET framework (instead of .NET). Very strange.
|
@thomasgalliker , can you try with adding this line to config.txt? This will remap the CS0 pin to GPIO28, so that the library can actually use the pin directly. |
Very strange, maybe a OS / Framework change? What do you guys run on your PIs? pi@raspberrypi:~ $ dotnet --version |
$ dotnet --version |
I did a system upgrade now, but my Display is still working. sudo apt update pi@raspberrypi:~ $ uname -a Do you run other GPIO Things on your pi? |
My Raspberry 4 Model B 2GB dumps following:
|
@pspeybro your advice resolved the problem, now the image is displayed :) AWESOME. But what does this dtoverlay do and why do I have to do this manually? |
Thats interesting, do you use the Raspberry PI OS from: If Yes, which Image did you use? |
@eXoCooLd yes, I used the original Raspberry Pi Imager to flash the sdcard. I tried following two operating systems, both had this "is busy" issue:
The 32bit version is the one I have installed now. |
Ok I will try a clean new Installation on the weekend. |
@thomasgalliker by default, the hardware spi cs0 pin is on gpio8. The dtoverlay line remaps this to a gpio for which there is no pin on the 40-pin header (gpio28). The reason I did this, was because this library and the waveshare example code in C are actively opening the gpio8 pin and setting it high/low, as if it was any other gpio. @eXoCooLd , yes, i am using other gpio's, in fact, almost all are used for 8 relays, 1-wire, an mcp3008 ADC through software spi, some devices on I2C bus and the 2in7 display. |
Ok I did a clean installation on a other sd-card and now I got the same problem. |
Hi,
I was trying to test this with a 2.7 inch display on a raspberry pi zero W 2 with .Net 6.
I modified the code a little bit to add a config for this display.
I have SPI enabled through raspi-config.
If I do this command:
sudo cat /sys/kernel/debug/gpio
It shows me that a number of GPIO's are in use, and in particular, the SPI pins:
gpio-7 ( |spi0 CS1 ) in hi ACTIVE LOW
gpio-8 ( |spi0 CS0 ) in hi ACTIVE LOW
I was trying to run the example, but that complained about a missing library for some reason, so I copied the example code to my project to test it.
The EPaperDisplayHardware constructor will try to open GPIO8 for the Cs pin and actively control that pin, but this generates an exception because that pin is already claimed for SPI0 CS0 (as the command above indicated).
How come you do not seem to have this issue?
Am I missing a setting here?
Would SoftwareSpi work for these kind of displays?
The SpiDevice documentation seems to be lacking some examples or details so it is not easy to find up to date info.
The text was updated successfully, but these errors were encountered: