可以使用
/sys/class/gpio 点亮 LED。
但是如何在uboot 启动成功后,自动点亮LED。需要在哪里编写led驱动呢?
离线
gpio 命令, 如果没有这个命令就在 make menuconfig 开启这个命令.
还是不是那么明白,如何操作
离线
dts 可選定一枝GPIO 長亮 LED
leds {
compatible = "gpio-leds";
pwr {
label = "nanopi:green:pwr";
gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
default-state = "on"; <<<-- 這個就是長亮
};
status {
label = "nanopi:blue:status";
gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
};
};
离线
@electronic_s
我是用的tiny200 suniv-f1c100s-generic.dts在这里增加吗?
buildroot-mangopi-r/output/build/uboot-2020.07/arch/arm/dts/suniv-f1c100s-generic.dts
离线
@electronic_s
我是用的tiny200 suniv-f1c100s-generic.dts在这里增加吗?
buildroot-mangopi-r/output/build/uboot-2020.07/arch/arm/dts/suniv-f1c100s-generic.dts
修改后
执行以下内容
rm ./output/images/*.dtb
make linux-clean-for-rebuild
make linux -j8
make
?
离线
Mr.Liu 说:@electronic_s
我是用的tiny200 suniv-f1c100s-generic.dts在这里增加吗?
buildroot-mangopi-r/output/build/uboot-2020.07/arch/arm/dts/suniv-f1c100s-generic.dts修改后
执行以下内容
rm ./output/images/*.dtb
make linux-clean-for-rebuild
make linux -j8
make?
rm output/build/uboot-2020.07/.stamp_built
make
这样应该会生成新的 dtb 和 img 文件, 而且build速度更快
离线
@哇酷小二
在/uboot-2020.07/arch/arm/dts/suniv-f1c100s-generic.dts增加了
leds {
compatible = "gpio-leds";
lfled {
label = "ledPE3";
gpios = <&r_pio 4 3 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
重新刷了,PE3 不亮
离线
@electronic_s
// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/dts-v1/;
#include "suniv-f1c100s.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
/ {
model = "Allwinner F1C100s Generic Device";
compatible = "allwinner,suniv-f1c100s",
"allwinner,suniv";
aliases {
serial0 = &uart1;
spi0 = &spi0;
};
chosen {
stdout-path = "serial0:115200n8";
};
leds {
compatible = "gpio-leds";
lfled {
label = "ledPE3";
gpios = <&pio 4 3 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
};
增加了PE3,但是PE3没有输出高
离线
gpio 命令, 如果没有这个命令就在 make menuconfig 开启这个命令.
抱歉怎么开启呢?
内核配置 还是 哪个位置的配置?
离线
@哇酷小二
只是修改/uboot-2020.07/arch/arm/dts/suniv-f1c100s-generic.dts
还是其他的地方也需要修改?
离线
我记得不用改 dts,在menuconfig / cmd 里面添加gpio即可,或者你直接改 .config 文件
make uboot-menuconfig
选择完配置,直接make编译?还是 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
离线
哇酷小二 说:我记得不用改 dts,在menuconfig / cmd 里面添加gpio即可,或者你直接改 .config 文件
make uboot-menuconfig
选择完配置,直接make编译?还是 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4
drivers/misc/status_led.c:29:4: error: ‘CONFIG_LED_STATUS_BIT’ undeclared here (not in a function); did you mean ‘CONFIG_LED_STATUS_BOOT’?
{ CONFIG_LED_STATUS_BIT,
^~~~~~~~~~~~~~~~~~~~~
CONFIG_LED_STATUS_BOOT
drivers/misc/status_led.c:30:3: error: ‘CONFIG_LED_STATUS_STATE’ undeclared here (not in a function); did you mean ‘CONFIG_LED_STATUS_BOOT’?
CONFIG_LED_STATUS_STATE,
^~~~~~~~~~~~~~~~~~~~~~~
CONFIG_LED_STATUS_BOOT
In file included from drivers/misc/status_led.c:8:
include/status_led.h:21:44: error: ‘CONFIG_LED_STATUS_FREQ’ undeclared here (not in a function); did you mean ‘CONFIG_LED_STATUS_ON’?
#define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ)
^~~~~~~~~~~~~~~~~~~~~~
drivers/misc/status_led.c:31:3: note: in expansion of macro ‘LED_STATUS_PERIOD’
LED_STATUS_PERIOD,
^~~~~~~~~~~~~~~~~
scripts/Makefile.build:265: recipe for target 'drivers/misc/status_led.o' failed
make[4]: *** [drivers/misc/status_led.o] Error 1
scripts/Makefile.build:419: recipe for target 'drivers/misc' failed
make[3]: *** [drivers/misc] Error 2
Makefile:1782: recipe for target 'drivers' failed
make[2]: *** [drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
CC common/board_r.o
LD common/built-in.o
package/pkg-generic.mk:266: recipe for target '/home/fly/mangopi/buildroot-mangopi-r/output/build/uboot-2020.07/.stamp_built' failed
make[1]: *** [/home/fly/mangopi/buildroot-mangopi-r/output/build/uboot-2020.07/.stamp_built] Error 2
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2
使用了Enable BOOT LED 报错
离线
我最近也碰到了同样的问题。
离线
之前和你一样是小白,但是我现在点亮了。
离线
之前和你一样是小白,但是我现在点亮了。
请教一个问题
board/widora/mangopi/r3/devicetree/linux/devicetree.dts
在deicetree.dts增加
&lradc {
vref-supply = <®_vcc3v3>;
status = "okay";
button@200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <200000>;
};
};
报错
linux-5.4.99 devicetree.dtb
DTC arch/arm/boot/dts/devicetree.dtb
Error: arch/arm/boot/dts/devicetree.dts:296.31-32 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:285: recipe for target 'arch/arm/boot/dts/devicetree.dtb' failed
make[3]: *** [arch/arm/boot/dts/devicetree.dtb] Error 1
Makefile:1262: recipe for target 'devicetree.dtb' failed
make[2]: *** [devicetree.dtb] Error 2
package/pkg-generic.mk:266: recipe for target '/home/fly/mangopi/buildroot-mangopi-r/output/build/linux-5.4.99/.stamp_built' failed
make[1]: *** [/home/fly/mangopi/buildroot-mangopi-r/output/build/linux-5.4.99/.stamp_built] Error 2
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2
离线
使用liggpiod吧,配置一下设备树即可 或者使用led子系统
离线