Wybox using shell scripts to detect if the IO port is normal

Source: Internet
Author: User

1. Modify the Mt7620a.dts file to define GPIO pin multiplexing as universal Gpio

/dts-v1/;/include/"Mt7620a.dtsi"/{compatible="Ralink,mt7620a-eval-board","Ralink,mt7620a-soc"; Model="Ralink mt7620a + mt7610e Evaluation Board"; [Email protected]10000000{gpio1: [email protected]638{Status="Okay";        }; Gpio2: [Email protected]660{Status="Okay";        }; Gpio3: [Email protected]688{Status="Okay";                        }; [Email protected] {Status="Okay"; [Email protected]0{#address-cells = <1>; #size-cells = <1>; Compatible="en25q64"; Reg= <0 0>; Linux,modalias="M25P80","en25q64"; SPI-max-frequency = <10000000>; [Email protected]0{Label="U-boot"; Reg= <0x0 0x30000>; Read-Only ;                }; [Email protected]30000{Label="u-boot-env"; Reg= <0x30000 0x10000>; Read-Only ;                }; Factory: [Email protected]40000{Label="Factory"; Reg= <0x40000 0x10000>; Read-Only ;                }; [Email protected]50000{Label="firmware"; Reg= <0x50000 0x1fb0000>;            };        };    };    }; Pinctrl {state_default:pinctrl0 {gpio {ralink,group="I²c","uartf","WDT","PA","Mdio",                 "RGMII1","PCIe","SPI REFCLK","ephy","ND_SD","Rgmii2","wled"; Ralink,function="Gpio";        };    };        }; [Email protected]10100000{MTD-mac-address = <&factory0x4>; Ralink,port-map ="LLLLW";    }; Gpio-keys-polled {compatible="Gpio-keys"; #address-cells = <1>; #size-cells = <0>; Poll-interval = < ->; S2 {Label="S2"; Gpios= <&gpio01 1>; Linux,code= <0x100>;        }; S3 {Label="S3"; Gpios= <&gpio02 1>; Linux,code= <0x101>;    }; };};

2, such as the drop shell script in the/root folder, named Test, followed by the following, you can set the Gpio0 ~ gpio72 to output, the output is low level.

#!/bin/SHCD/sys/class/Gpio forIinch 0`seq  the` Do        Echo$i >/sys/class/gpio/ExportEchoOut >./gpio$i/Direction #EchoOut >/sys/devices/10000000. palmbus/10000600. gpio/gpio/gpio$i/directionEcho 0>./gpio$i/value Done
[Email protected]:~# [email protected]:chmod777  Test[email protected]:~#. /test

3, can get the following pin can be used normally (hook):

Problem:

1, do not know Gpio7 is occupied by what, will appear the following questions

2, other can create Gpio io do not know why, manual typing command line does not respond, but the direct execution of the script command is effective.

Reference:

Http://blog.sina.com.cn/s/blog_9d074aae01012ytf.html

Wybox using shell scripts to detect if the IO port is normal

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.