写在最上面
华清远见教育集团
15年专注高档IT培训
做良心教育,做专业教育,做受人敬爱的职业教育
创客大学官网:
华清远见创客大学嵌入式课程链接:
华清远见创客大学物联网课程链接:
正文
回想一下之前用windows下的并口助手,接收和发送对底层开发板子的数据流。硬件层面上,下位机通发送数据linux内核中的串口驱动,通过USB转并口linux内核中的串口驱动,实现了USB插口到通用并口的转换;软件层面上,须要并口驱动CH341PL2303,和USB驱动。之后能够通过并口助手(应用程序)来实现与下位机的交互。
在嵌入式系统上,内核是经剪裁过的,须要linux内核对这两种驱动程序的选装或则移植。
USB驱动的移植
添加USB设备树信息
-
root@linux:~# cd linux-3.14-fs4412/
-
root@linux:linux-3.14-fs4412# vim arch/arm/boot/dts/exynos4412-fs4412.dts
-
usbphy: usbphy@125B0000 {
-
#address-cells = ;
-
#size-cells = ;
-
compatible = "samsung,exynos4x12-usb2phy";
-
reg = <0x125B0000 0x100>;
-
ranges;
-
clocks = <&clock 2>, <&clock 305>;
-
clock-names = "xusbxti", "otg";
-
usbphy-sys {
-
reg = <0x10020704 0x8 0x1001021c 0x4>;
-
};
-
};
-
-
ehci@12580000 {
-
status = "okay";
-
usbphy = ;
-
};
-
-
usb3503@08 {
-
compatible = "smsc,usb3503";
-
reg = <0x08 0x4>;
-
connect-gpios = <&gpm3 3 1>;
-
intn-gpios = <&gpx2 3 1>;
-
reset-gpios = <&gpm2 4 1>;
-
initial-mode = <1>;
-
};
编译内核,cp到tftp根目录下
-
root@linux:linux-3.14-fs4412# make dtbs
-
scripts/kconfig/conf --silentoldconfig Kconfig
-
DTC arch/arm/boot/dts/exynos4412-fs4412.dtb
-
root@linux:linux-3.14-fs4412# cp arch/arm/boot/dts/exynos4412-fs4412.dtb /tftpboot/
验证
重启启动开发板,将U盘插入USB口,可系统辨识到设备节点
-
[root@farsight ]# ls /dev/sda
-
/dev/sda
配置内核的并口驱动:CH341PL2303
步入内核源码目录linux视频教程,配置内核
root@linux:linux-3.14-fs4412# make menuconfig
-
-
-
Symbol: USB_SERIAL_PL2303 [=y]
-
Type : tristate
-
Prompt: USB Prolific 2303 Single Port Serial Driver
-
Location:
-
-> Device Drivers
-
-> USB support (USB_SUPPORT [=y])
-
(1) -> USB Serial Converter support (USB_SERIAL [=y])
-
Defined at drivers/usb/serial/Kconfig:510
-
Depends on: USB_SUPPORT [=y] && USB [=y] && USB_SERIAL [=y]
-
-
-
Symbol: USB_SERIAL_CH341 [=y]
-
Type : tristate
-
Prompt: USB Winchiphead CH341 Single Port Serial Driver
-
Location:
-
-> Device Drivers
-
-> USB support (USB_SUPPORT [=y])
-
(1) -> USB Serial Converter support (USB_SERIAL [=y])
-
Defined at drivers/usb/serial/Kconfig:99
-
Depends on: USB_SUPPORT [=y] && USB [=y] && USB_SERIAL [=y]
root@linux:linux-3.14-fs4412# make uImage
步入目录查看编译的状态
-
root@linux:linux-3.14-fs4412# cd drivers/usb/serial/
-
root@linux:serial# ls *.o
-
built-in.o bus.o ch341.o generic.o pl2303.o usb-serial.o usbserial.o
cp到tftp根目录下
root@linux:linux-3.14-fs4412# cp arch/arm/boot/uImage /tftpboot/
验证
重启启动开发板,将M0的USB并口插入到A9的USB并口上红旗linux安装,查看设备节点信息
-
[root@farsight ]# ls /dev/ttyUSB0
-
/dev/ttyUSB0
本文原创地址://gulass.cn/hqyjjyjtnzzg.html编辑:刘遄,审核员:暂无