当前位置:网站首页>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 .
边栏推荐
- Data Lake (VII): Iceberg concept and review what is a data Lake
- Self built shooting range 2022
- Hide Chinese name
- Redis6 data type and operation summary
- 南理工在线交流群
- Clock cycle
- Matlab paper chart standard format output (dry goods)
- Datapipeline was selected into the 2022 digital intelligence atlas and database development report of China Academy of communications and communications
- Simple PHP paging implementation
- Laravel框架运行报错:No application encryption key has been specified
猜你喜欢
C object storage
嵌入式软件架构设计-消息交互
When using Tencent cloud for the first time, you can only use webshell connection instead of SSH connection.
Operational research 68 | the latest impact factors in 2022 were officially released. Changes in journals in the field of rapid care
Write API documents first or code first?
Self built shooting range 2022
Catch all asynchronous artifact completable future
MySQL - database query - sort query, paging query
Interviewer soul torture: why does the code specification require SQL statements not to have too many joins?
[daily question] 1200 Minimum absolute difference
随机推荐
那些考研后才知道的事
ELK 企业级日志分析系统
jasypt配置文件加密|快速入门|实战
Require, require in PHP_ once、include、include_ Detailed explanation of the efficiency of repeated introduction of once class library
redis6数据类型及操作总结
Integer = = the comparison will unpack automatically. This variable cannot be assigned empty
Shuttle INKWELL & ink components
Solve the problem of "unable to open source file" xx.h "in the custom header file on vs from the source
这18个网站能让你的页面背景炫酷起来
mysql获得时间
French scholars: the explicability of counter attack under optimal transmission theory
zabbix 监控
法国学者:最优传输理论下对抗攻击可解释性探讨
南理工在线交流群
Laravel框架运行报错:No application encryption key has been specified
restTemplate详解
Flutter 3.0更新后如何应用到小程序开发中
leetcode 10. Regular Expression Matching 正则表达式匹配 (困难)
These 18 websites can make your page background cool
内网穿透工具 netapp