GPIO’s: How do I read/write to the GPIOs? I don’t see the config-pin tool, so I’ve tried doing this using “gpioset” and “gpioget”, but all the microbus pins as well as the user button return “device or resource busy”. I’m not sure if exporting the pin ( sudo echo xx > /sys/class/gpio/export ) will work. Its not clear to me how these pins are mapped to gpio numbers. I’m definitely missing something here and a would appreciate it if someone could point me in the right direction.
Is there a device tree file available for the Sony IMX219 (RPi Camera Module 2) camera? This camera is not detected on the BeaglePlay.
this should generate src/arm64/overlays/k3-am625-beagleplay-csi2-imx219.dtbo overlay file that is copied over to /boot/firmware and /boot/firmware/extlinux/extlinux.conf is updated accordingly.
NOTE:
I do have arducam imx219 probing
I dont seem to be able to use bayer2rgb to be able to do the capture properly
# Set to Bayer 8 bit mode as that is all that bayer2rgb can support.
media-ctl -V '"imx219 4-0010":0[SRGGB8_1X8/640x480]'
# This is'nt working - complains of out of memory, but have'nt debugged.
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! video/x-bayer,width=640,height=480,format=rggb ! bayer2rgb ! video/x-raw,format=BGRx ! autovideosink
# This just dumps a black screen
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-bayer,width=640,height=480,format=rggb ! bayer2rgb ! video/x-raw,format=BGRx ! autovideosink
on GPIO access directly for mikrobus - you might want to disable the mikrobus nodes to natively control the gpios… I think the mikrobus might be taking control of the gpios.
add a line to the end of /boot/overlays/extlinux/extlinux.conf to use this overlay on boot:
fdtoverlays /overlays/leds-disable.dtbo
and reboot.
gpioinfo will show these pins are unused
line 3: "USR0" unused output active-high
line 4: "USR1" unused output active-high
line 5: "USR2" unused output active-high
line 6: "USR3" unused output active-high
now you can use these pins with gpiod. Also note that these pins are part of gpiochip2. here’s some python that grabs gpiochip2, gpioline 3, and flashes one of the LEDs.
I’m getting the same results for the CSI camera where it dumps a black screen. I’ve noticed that the driver used is the j721e-csi2rx. Is this correct?
debian@BeaglePlay:~$ v4l2-ctl --all
Driver Info:
Driver name : j721e-csi2rx
Card type : j721e-csi2rx
Bus info : platform:30102000.ticsi2rx
Driver version : 5.10.162
Capabilities : 0xa5200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x25200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Media Driver Info:
Driver name : j721e-csi2rx
Model : TI-CSI2RX
Serial :
Bus info : platform:30102000.ticsi2rx
Media version : 5.10.162
Hardware revision: 0x00000001 (1)
Driver version : 5.10.162
Interface Info:
ID : 0x03000015
Type : V4L Video
Entity Info:
ID : 0x00000013 (19)
Name : 30102000.ticsi2rx context 0
Function : V4L2 I/O
Pad 0x01000014 : 0: Sink
Link 0x02000017: from remote pad 0x1000003 of entity '30102000.ticsi2rx': Data, Enabled, Immutable
Priority: 2
Video input : 0 (30102000.ticsi2rx context 0: ok)
i would like to use the CS from the mikrobus as an unused output active-high could you tell me how to know what overlay it is. I used linux-mikrobus but it didn’t work.
Thanks
What are the changes I need to make in the Makefile?
The following output is displayed when I execute ‘/opt/source/dtb-5.10-ti/src/arm64$ git diff’
“diff --git a/Makefile b/Makefile
old mode 100644
new mode 100755”
I have been trying to use the mikrobus pins as gpio also. After installing gpiod using both apt and pip3, I succeeded in running gpioinfo and noted the lines labeled “MIKROBUS_GPIO01_*” were incidentally already labeled as “unused”. Subsequently, I adapted the python script provided above by @toddm (thanks! ). After attaching an LED and protective circuitry to the mikrobus pin labeled “pwm”, I essentially wrapped the code requesting a line and setting its direction and value inside a function so as to allow myself to naturally cycle through the mikrobus gpio lines one-by-one to see which line number matched the signal name. Here is the code I used, noting that some of the syntax is modified in accordance with the documentation obtained by using, help(gpiod)
Since the output of gpioinfo had listed the mikrobus gpios as taking up lines 7-14 and 22-25 from gpiochip3, I simply entered sequential integers beginning with 7 into the above function and by my LED flashing observed that ‘PWM’ corresponded to gpio line 11. With respect to your original question, I’d be surprised if ‘CS’ were not among those lines mentioned above… EDIT: ‘CS’ corresponds to line 13 on gpiochip3.
Something that needs be mentioned also is that I am already loading a device tree overlay in /boot/firmware/extlinux/extlinux.conf, which is one of those pre-compiled and included with debian bullseye and is enabled by the following line:
I’m honestly not sure if this .dtbo is entirely necessary as I had previously applied it while toying with the mikrobus pins. It’s also essential to raise the topic of taking sufficient precautions when using the gpio pins with external circuitry, such as a current-blocking diode to prevent accidental loading onto the io pins - eg. via a loose ground connection - which could possibly seriously damage to on-board components.
Good luck and hope this helps
N
UPDATE:
I just investigated this further and indeed confirmed that the device tree overlay I used is responsible for availing the mikrobus gpio lines to the user. As mentioned earlier this overlay is found in /boot/firmware/overlays/k3-am625-beagleplay-release-mikrobus-set-gpios-all.dtbo and it came with the monthly release of debian bullseye (minimal) I got from here.