Closed wfd3 closed 4 years ago
great
Not sure this is fully working, I am having issues. I can read a pin using something like raspi-gpio but cant do the same in code with the library. Also seems like eventually something get corrupted and the system dies.
If I dont manually set the pull mode of the pins outside my App using raspi-gpio my app will not work. i.e. pin.PullUp() does not seem to be working. I dont have a Raspberry version 3 to test if this is the case as well.
If you send a test case for me to look at, and instructions on what you're doing outside the test case to make it work, I'll see if I can reproduce.
I have now tested with a Raspberry PI 3 and everything works fine so its a Raspberry 4 related issue.
err := rpio.Open()
var pin = rpio.Pin(17)
pin.PullUp()
I would expect to see the internal pullup for GPIO 17 set but this is not the case which can be confirmed when running a raspi-gpio get
from the command line and looking at the entries for GPIO 17
Serge
It looks like the IO base and offsets are different on the BCM2711, just from a quick comparison with the raspi-gpio source. I've not been able to find a set of docs on the 2711 yet, but I'll keep looking or I'll use raspi-gpio as a basis.
I'll try to have a patch out here in a day or so.
Sounds good. Thanks for looking into this.
I have a patch that works for the limited use case above. Take a look at https://github.com/wfd3/go-rpio and let me know if that works for you.
A few things:
Once I have this all cleaned up and tested, I'll generate a pull request.
Good stuff, will test this out start of next week. Thanks !
OK, Here's the pull request. This contains the original changes to move the base address for Pi 4 and the changes to make pull-up and pull-down work correctly. All tests pass and all examples work, where "work" means they behave the same on Pi3 and Pi 4. Note that example/spi/spi.go doesn't appear to work on either board, but I'll admit I haven't looked deeply at it.
Any updates on this? Is the RPI 4 supported for SPI ? I'm running with root and I'm getting the SpiMapError = errors.New("SPI registers not mapped correctly - are you root?")
error
@wfd3 Awesome job guys! I don't have an RPi 4, but since it didn't break functionality for RPi3 I assume I can merge this.
If some third person could verify the functionality, that would be great.
@stianeikeland Can you bump the version and add @wfd3 to the list in the readme?
As requested, a pull request for my changes to support Pi4. Note that this is a bit different than the patch I attached to be bug in that it encapsulates error checking in the readBase() helper function.