调试米尔开发板记录
gpio调试:
ls /sys/class/gpio/
echo 2 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio2/direction
cat /sys/class/gpio/gpio2/direction
echo "0" > /sys/class/gpio/gpio2/value
echo "1" > /sys/class/gpio/gpio2/value
echo 48 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio48/direction
cat /sys/class/gpio/gpio48/value
echo 48 > /sys/class/gpio/export
echo 49 > /sys/class/gpio/export
echo 50 > /sys/class/gpio/export
echo 51 > /sys/class/gpio/export
echo 52 > /sys/class/gpio/export
echo 53 > /sys/class/gpio/export
echo 110 > /sys/class/gpio/export
echo 112 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio49/direction
echo "in" > /sys/class/gpio/gpio48/direction
echo "in" > /sys/class/gpio/gpio50/direction
echo "in" > /sys/class/gpio/gpio51/direction
echo "in" > /sys/class/gpio/gpio52/direction
echo "in" > /sys/class/gpio/gpio53/direction
echo "in" > /sys/class/gpio/gpio110/direction
echo "in" > /sys/class/gpio/gpio112/direction
cat /sys/class/gpio/gpio49/value
网口:
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
route add default gw 192.168.1.1
关wifi
make menuconfig
Networking support → Wireless 下打开cfg80211选项支持:
Device Drivers → Network device support → Wireless LAN下打开BCM 43XX SDIO 设备驱动支持:
选择下方的<Save>选项保存,重新清理编译,<Load>刚刚的保存方案,make Image保存即可
I. echo 0 > /sys/class/pwm/pwmchip3/export /*设置PWM4输出,调出pwm0目录下设备节点,用于以下配置 */
II. echo 1 >/sys/class/pwm/pwmchip3/pwm0/enable/*设置PWM4使能 */
III. echo 1000000 >/sys/class/pwm/pwmchip3/pwm0/period/*设置PWM4一个周期的持续时间,单位为ns,即1K Hz */
IV. echo 500000 >/sys/class/pwm/pwmchip3/pwm0/duty_cycle/*设置一个周期中的”ON”时间,单位为ns,即占空比=duty_cycle/period=50% */
485测试:
rs485_read -d /dev/ttymxc2 -b 115200 -e 1
rs485_write -d /dev/ttymxc2 -b 115200 -e 1
gpio:
echo 27 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio27/direction
echo "1" > /sys/class/gpio/gpio27/value //rs4853发送
echo "0" > /sys/class/gpio/gpio27/value //rs4853接收
spi调试:
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
spi mode: 1
bits per word: 8
max speed: 200000 Hz (200 KHz)
82
FF FF FF FF FF FF
rx:91 rx:C4 rx:00 rx:00 rx:FF rx:FF
rx:3D rx:7F data :15743
PWM调试:
echo 0 > /sys/class/pwm/pwmchip0/export
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period
echo 5000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
echo 0 > /sys/class/pwm/pwmchip1/export
echo 1 > /sys/class/pwm/pwmchip1/pwm0/enable
echo 10000 > /sys/class/pwm/pwmchip1/pwm0/period
echo 5000 > /sys/class/pwm/pwmchip1/pwm0/duty_cycle