我有以下 DTS 文件,但无法使 GPIO 外部中断正常工作。我已阅读有关中断概述的
文档,并尝试启用 EX
ti 以控制 GPIOB 引脚 12。
- /dts-v1/;
- #include "STM32mp157.dtsi"
- #include "stm32mp15xa.dtsi"
- #include "stm32mp15-pinctrl.dtsi"
- #include "stm32mp15xxac-pinctrl.dtsi"
- #include "stm32mp15xx-dkx.dtsi"
- / {
- model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
- compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
- chosen {
- stdout-path = "serial0:115200n8";
- };
- button {
- compatible = "test,button";
- input-gpios = <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; //Works with pull-up once the driver is loaded.
- interrupts-extended = <&gpiob 12 IRQ_TYPE_EDGE_FALLING>;
- interrupt-names = "qwerty";
- status = "okay";
- };
- led {
- extern-led {
- compatible = "test,led";
- gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>;
- linux,default-trigger = "cpu";
- };
- };
- };
我遇到的问题是,对于我所有的 gpio_to_irq() 调用,我得到以下信息:
- [ 64.996864] platformdev: loading out-of-tree module taints kernel.
- [ 65.003005] mod_probe() function was called.
- [ 65.006308] mod_probe got miscdev minor id: 125
- [ 65.010898] gpio_to_irq(0) = 88
- [ 65.015773] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 1 already requested.
- [ 65.022853] gpio_to_irq(1) = -6
- [ 65.025872] gpio_to_irq(2) = 89
- [ 65.028910] gpio_to_irq(3) = 90
- [ 65.032338] gpio_to_irq(4) = 91
- [ 65.035218] gpio_to_irq(5) = 92
- [ 65.038271] gpio_to_irq(6) = 93
- [ 65.041395] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 7 already requested.
- [ 65.049669] gpio_to_irq(7) = -6
- [ 65.052846] gpio_to_irq(8) = 94
- [ 65.055812] gpio_to_irq(9) = 95
- [ 65.058943] gpio_to_irq(10) = 96
- [ 65.062249] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 11 already requested.
- [ 65.070436] gpio_to_irq(11) = -6
- [ 65.073796] gpio_to_irq(12) = 97
- [ 65.076859] gpio_to_irq(13) = 98
- [ 65.080112] gpio_to_irq(14) = 99
- [ 65.083319] gpio_to_irq(15) = 100
- [ 65.086619] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 0 already requested.
- [ 65.094764] gpio_to_irq(16) = -6
- [ 65.098248] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 1 already requested.
- [ 65.106281] gpio_to_irq(17) = -6
- [ 65.109559] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 2 already requested.
- [ 65.117624] gpio_to_irq(18) = -6
- [ 65.120821] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 3 already requested.
- [ 65.128995] gpio_to_irq(19) = -6
- [ 65.132198] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 4 already requested.
- [ 65.140258] gpio_to_irq(20) = -6
- [ 65.143562] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 5 already requested.
- [ 65.151648] gpio_to_irq(21) = -6
- [ 65.154987] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 6 already requested.
- [ 65.163127] gpio_to_irq(22) = -6
- [ 65.166210] gpio_to_irq(23) = 78
- [ 65.169463] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 8 already requested.
- [ 65.177710] gpio_to_irq(24) = -6
- [ 65.180905] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 9 already requested.
- [ 65.189071] gpio_to_irq(25) = -6
- [ 65.192273] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 10 already requested.
- [ 65.200433] gpio_to_irq(26) = -6
- [ 65.203808] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 11 already requested.
- [ 65.212052] gpio_to_irq(27) = -6
- [ 65.215234] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 12 already requested.
- [ 65.223441] gpio_to_irq(28) = -6
- [ 65.226725] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 13 already requested.
- [ 65.235007] gpio_to_irq(29) = -6
- [ 65.238204] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 14 already requested.
- [ 65.246450] gpio_to_irq(30) = -6
- [ 65.249632] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 15 already requested.
- [ 65.258245] gpio_to_irq(31) = -6
- [ 65.261203] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 0 already requested.
- [ 65.269297] gpio_to_irq(32) = -6
- [ 65.272615] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 1 already requested.
- [ 65.280607] gpio_to_irq(33) = -6
- [ 65.283951] stm32mp157-pinctrl soc:pin-controller@50002000: irq line 2 already requested.
- [ 65.292116] gpio_to_irq(34) = -6
当我对 EXTI 引脚 12 输入执行 IRQ 请求时,使用上面提供的 gpio_to_irq 编号(#97),我得到了 IRQ,但它没有触发,因为我相信 EXTI 控制器没有正确监听 GPIOB 引脚 12。
我想连接到 gpio 28(GPIOB 引脚 12),但是 GPIOA 引脚 12 已经声明了中断。那么我该如何更改 EXTI 控制器以遵循我在 DTS 文件中定义的内容并改为监听 GPIOB 12 ?
我尝试了以下 DTS 编辑:
中断扩展 = <&exti 28 IRQ_TYPE_EDGE_FALLING>;
------
中断扩展 = <&gpiob 12 IRQ_TYPE_EDGE_FALLING>;
------
中断父母= <&gpiob>;
中断 = <12 IRQ_TYPE_EDGE_FALLING>;
------
如果有人能解释我的 DTS 文件应该读取什么,我将不胜感激。
编辑:我暂时将输入按钮连接到 GPIO A12 引脚,linux 中断按预期工作,那么是什么配置错误导致 EXTI 未连接到 GPIO 端口 B?我不能使用 pin A12,我更想了解这个外围设备是如何配置的。
0