当前位置:网站首页>Rk3566 add LED
Rk3566 add LED
2022-07-05 13:47:00 【Matchstick MCU】
Designed on the motherboard 5 individual LED, among 2 A green led For operation indication , One rgb The light is indicated by status , Used separately 5 individual GPIO Mouth control LED, All are high-level lights .
linux The system already comes with it leds-gpio The driver , Just enable the driver in the kernel .
LED Drive enable
General kernel has been enabled LED Support for GPIO connected LEDs:
stay DTS Add to file LED Description of :
leds{
compatible = "gpio-leds";
user1_led: user1 {
label = "user1";
gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "on";
};
user2_led: user2 {
label = "user2";
gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
blue_led: blue {
label = "blue";
gpios = <&gpio4 RK_PC0 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
green_led: green {
label = "green";
gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
red_led: red {
label = "red";
gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
};
This description is added under the root node .
debugging
modify DTS Post compiled kernel , take boot.img Burn into the motherboard , After the motherboard starts , Enter into /sys/class/leds/ View under directory led Whether to add successfully :
[[email protected]:/]# cd /sys/class/leds/
[[email protected]:/sys/class/leds]# ls
blue green mmc0:: red user1 user2
5 individual led It has been added successfully .
towards led Under the lamp name brightness Write non 0 or 0 Value , Corresponding led It will light up 、 destroy .
[[email protected]:/sys/class/leds]# echo 1 > user1/brightness
[[email protected]:/sys/class/leds]# echo 0 > user1/brightness
Problems encountered
The first revision DTS After the boot.img Burn into the motherboard , Enter into /sys/class/leds/ Under the table of contents , I don't see the added led, Check the boot log :
[[email protected]:/]# dmesg | grep leds
[ 1.318922] leds-gpio: probe of leds failed with error -16
Show leds-gpio Detection failure , Repeated testing dts file , No errors found .
see gpio usage :
gpiochip2: GPIOs 64-95, parent: platform/fe750000.gpio, gpio2:
gpio-73 ( |xgpio-pin ) out lo
Find out xgpio-pin And user1 Defined gpio The conflict .
lookup dts The document is about gpio-73 Related description :
WORKLED {
compatible = "9tripod,xgpio";
pinctrl-names = "default";
def_val=<0>;
pinctrl-0 = <&io2_b1>;
gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>;
};
WORKLED Used this GPIO, Delete this description , Compile the kernel again , take boot.img Burn into the motherboard ,led It was added successfully .
remaining problems
although user1 The default trigger is configured as heartbeat, however user1 It doesn't go out automatically , There may be some heartbeat Some functions of are not configured well .
边栏推荐
猜你喜欢
Network security - Novice introduction
:: ffff:192.168.31.101 what address is it?
不知道这4种缓存模式,敢说懂缓存吗?
Jenkins installation
Self built shooting range 2022
Win10——轻量级小工具
[server data recovery] a case of RAID5 data recovery stored in a brand of server
Flutter 3.0更新后如何应用到小程序开发中
Backup and restore of Android local SQLite database
Mmseg - Mutli view time series data inspection and visualization
随机推荐
Jetpack Compose入门到精通
Personal component - message prompt
Parsing XML using Dom4j
53. 最大子数组和:给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
About the problem and solution of 403 error in wampserver
Zhubo Huangyu: it's really bad not to understand these gold frying skills
stm32逆向入门
Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
jasypt配置文件加密|快速入门|实战
Simple PHP paging implementation
一网打尽异步神器CompletableFuture
With 4 years of working experience, you can't tell five ways of communication between multithreads. Dare you believe it?
FPGA learning notes: vivado 2019.1 add IP MicroBlaze
:: ffff:192.168.31.101 what address is it?
[public class preview]: basis and practice of video quality evaluation
法国学者:最优传输理论下对抗攻击可解释性探讨
leetcode 10. Regular expression matching regular expression matching (difficult)
Nantong online communication group
Jenkins installation
Clock cycle