Up Squared GPIO stuck on high signal? GPIO pins not working correctly?
I'm currently trying to control some LED strips with my Up Squared (N4200), but I cannot seem to get them working. After a lot of debugging to get to the root of the problem, I found out that the GPIO pins may be malfunctioning.
My Up Squared is running Ubuntu 16.04, my BIOS version is 1.8 and the output of
uname -srv is:
Linux 4.10.0-42-generic #5000~upboard10-Ubuntu SMP Tue Dec 19 12:58:48 UTC 2017
I have a 9 jumper cables connected to (what I think are) pins 3, 5, 7, 11, 13, 15, 19, 21, and 23 as shown in the picture below. Due to debugging, none of these cables were actually attached to anything.
mraa library, I was trying to execute the following code:
import mraa import time redPin = mraa.Gpio(19) time.sleep(0.1) redPin.dir(mraa.DIR_OUT) while True: print("On") redPin.write(1) redPin.dir(mraa.DIR_IN) print("Should be 1:", redPin.read()) redPin.dir(mraa.DIR_OUT) time.sleep(2) print("Off") redPin.write(0) redPin.dir(mraa.DIR_IN) print("Should be 0:", redPin.read()) redPin.dir(mraa.DIR_OUT) time.sleep(2)
When I execute this code as root, I get the following output:
On ('Should be 1:', 1) Off ('Should be 0:', 1) On ('Should be 1:', 1) Off ('Should be 0:', 1) On ('Should be 1:', 1) Off ('Should be 0:', 1) (and so on..)
Keep in mind that the specific cable was not attached to anything. I currently don't have access to a multimeter, so I can't really check if these readings are in accordance to what is actually emitted through the cable. However, when I attach this cable to the according MOSFET in my LED powering circuitry (built following this tutorial, though with IRLB8721 MOSFETs), the LED strip does light up, but does not turn on and off like the code should make it do (or even slightly change brightness for that matter).
Seeing as I'm not inclined to believe that the printed output is expected behaviour, what could be wrong here? Might it be something in my BIOS settings (haven't checked those yet)? And / or should I update my BIOS? Am I using the wrong pins? Or is there something wrong with my Up Squared?