当前位置:网站首页>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 .
边栏推荐
- ETCD数据库源码分析——集群间网络层客户端peerRt
- Kafaka log collection
- 不知道这4种缓存模式,敢说懂缓存吗?
- Redis6 master-slave replication and clustering
- C object storage
- FPGA learning notes: vivado 2019.1 add IP MicroBlaze
- [server data recovery] a case of RAID5 data recovery stored in a brand of server
- 华为推送服务内容,阅读笔记
- 49. 字母异位词分组:给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。 字母异位词 是由重新排列源单词的字母得到的一个新单词,所有源单词中的字母通常恰好只用一次。
- Shandong University Summer Training - 20220620
猜你喜欢
Aikesheng sqle audit tool successfully completed the evaluation of "SQL quality management platform grading ability" of the Academy of communications and communications
面试官灵魂拷问:为什么代码规范要求 SQL 语句不要过多的 join?
ELFK部署
:: ffff:192.168.31.101 what address is it?
redis6主从复制及集群
Binder communication process and servicemanager creation process
Could not set property 'ID' of 'class xx' with value 'XX' argument type mismatch solution
Self built shooting range 2022
华为推送服务内容,阅读笔记
The development of speech recognition app with uni app is simple and fast.
随机推荐
Multi person cooperation project to see how many lines of code each person has written
Can and can FD
Usage, installation and use of TortoiseSVN
Shuttle INKWELL & ink components
Primary code audit [no dolls (modification)] assessment
MySQL if else use case use
PHP character capture notes 2020-09-14
Laravel框架运行报错:No application encryption key has been specified
Go string operation
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
jasypt配置文件加密|快速入门|实战
leetcode 10. Regular expression matching regular expression matching (difficult)
laravel-dompdf导出pdf,中文乱码问题解决
Parsing XML using Dom4j
个人组件 - 消息提示
Datapipeline was selected into the 2022 digital intelligence atlas and database development report of China Academy of communications and communications
记录一下在深度学习-一些bug处理
go map
With 4 years of working experience, you can't tell five ways of communication between multithreads. Dare you believe it?
Record in-depth learning - some bug handling