Jump to content

Orange Pi 0+ 2 GPIO interrupt failed with brcmfmac module ?


hankso

Recommended Posts

I wouldn't ask for help here if I could find enough information to solve my problem.

My program takes user-space GPIO interrupts as signals. It depends on this feature and GPIO interrupts are not replaceable. Testing code is as follows (on Pin12/PA07/GPIO7) by using SysfsGPIO:

  • echo 7 > /sys/class/gpio/export
  • echo in > /sys/class/gpio/gpio7/direction
  • echo falling > /sys/class/gpio/gpio7/edge

 

Check if it works with command `cat /proc/interrupts`:

  • watch -n3 "cat /proc/interrupts | grep sunxi_pio"

After configuration, give GPIO7 a pulse by attaching it to 3V3.

 

This method does works on Orange Pi 0+ H5 running Armbian 5.60.

/etc/armbian-release:

  • BOARD=orangepizeroplus
  • BOARD_NAME="Orange Pi Zero Plus"
  • BOARDFAMILY=sun50iw2
  • VERSION=5.60
  • LINUXFAMILY=sunxi64
  • BRANCH=next
  • ARCH=arm64
  • IMAGE_TYPE=stable
  • BOARD_TYPE=conf
  • INITRD_ARCH=arm64
  • KERNEL_IMAGE_TYPE=Image

 

Content of /proc/interrupts would be like:

  • CPU0    CPU1    CPU2    CPU3
  •     10           0           0           0   sunxi_pio_edge   7 Edge   gpiolib
  •       0           0           0           0   sunxi_pio_edge 38 Edge  gpiolib
  •       0           0           0           0   sunxi_pio_edge 76 Edge  gpiolib

Abviously kernel get that interrupt.

 

 

However, it doesn't work on Orange Pi 0+ 2 H5 running Armbian 5.60.

/etc/armbian-release:

  • BOARD=orangepizeroplus2-h5
  • BOARD_NAME="Orange Pi Zero Plus 2"
  • BOARDFAMILY=sun50iw2
  • VERSION=5.60
  • LINUXFAMILY=sunxi64
  • BRANCH=next
  • ARCH=arm64
  • IMAGE_TYPE=stable
  • BOARD_TYPE=conf
  • INITRD_ARCH=arm64
  • KERNEL_IMAGE_TYPE=Image

 

The content of /proc/interrupts is:

  • CPU0    CPU1    CPU2    CPU3
  • 2080           0           0           0   sunxi_pio_level   7 Level  brcmf_obb_intr
  •       0           0           0           0   sunxi_pio_edge   7 Edge   gpiolib
  •       0           0           0           0   sunxi_pio_edge 38 Edge  gpiolib

 

This time, kernel doesn't catch interrupt and the only difference between OPi 0+ and OPi 0+ 2 is the first line: sunxi_pio_level 7 Level brcmf_obb_intr.

It seems brcmf has already occupied GPIO7 with level interrupt.

lsmod | grep brcmf:

  • brcmfmac   229376 0
  • brcmutil       16384 1 brcmfmac
  • cfg80211   303104 1 brcmfmac

If I remove mod brcmfmac then the wireless connection will fail, which is not what I want.

 

So my question is:

  1. Is GPIO7 occupied by module brcmfmac?
  2. If it is, can I change the pin that brcmfmac use to let my program use GPIO7?
  3. What role does GPIO7 play in network connection? In OPi 0+ there is no such problem.

 

I need both network and GPIO interrupt features in my program. It's hard to change from GPIO7 to another pin because of hardware design in my project.

Think you guys.

Edited by hankso
syntax error
Link to comment
Share on other sites

2 hours ago, hankso said:

It's hard to change from GPIO7 to another pin because of hardware design in my project.

You should check schematics of both boards carefully. PA7 on ZeroPlus2 is not on the header, it is on camera port, the pin on the header is there as PD1. So check if your interrupt is working using PD1.

Link to comment
Share on other sites

Oh YES you are right! GPIO pin number has changed from OPi 0+ to OPi 0+2.

In Xunlong Orange Pi Zero Plus 2 page on linux-sunxi.org it said that

Quote

The Orange Pi Zero Plus 2 has a 26-pin, 0.1" unpopulated connector with several low-speed interfaces. It's marketed as Raspberry Pi-compatible. Please refer to the Orange Pi Zero wiki page for now, as the Orange Pi Zero Plus 2 details are still TODO.

I thought pinout was same on two boards, but, they are NOT.

It's PD11(GPIO107) now. Sadly, PD11 doesn't support interrupt, so I guess I have to modify my hardware design to make it compatible for both board.

Thanks a lot!

 

BTW, in case someone make stupid mistakes like me, I draw some pinouts and upload here. Wish it would be helpful.

 

Orange Pi Zero Pinout

Orange Pi Zero Plus Pinout

Orange Pi Zero Plus 2

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines