最近AM5728的主机板的系统已经跑起来了,现在需要开启UART1来接受外设备串口发送过来的数据(也就是主机板上的ttyS0)
在求助之前参照了论坛里面的其他帖子,对设备树做了一下修改(内核编译配置使用的是JN-mini5728_defconfig文件):
uboot源码目录下的dra7.dtsi中的uart1修改为:
uart1: serial@4806a000 {
compatible = "ti,omap4-uart";
reg = <0x4806a000 0x100>;
reg-shift = <2>;
interrupts-extended = <&crossbar_mpu GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
ti,hwmods = "uart1";
clock-frequency = <48000000>;
status = "okay";
dmas = <&sdma 49>, <&sdma 50>;
dma-names = "tx", "rx";
};
uboot源码目录下的am57xx-beagle-x15.dts添加了
&uart1 {
status = "okay";
};
然后在linux内核源码下的dra7.dtsi中的uart1修改为:
uart1: serial@4806a000 {
compatible = "ti,dra742-uart", "ti,omap4-uart";
reg = <0x4806a000 0x100>;
interrupts-extended = <&crossbar_mpu GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
ti,hwmods = "uart1";
clock-frequency = <48000000>;
status = "okay";
dmas = <&edma_xbar 49 0>, <&edma_xbar 50 0>;
dma-names = "tx", "rx";
};
然后在linux内核源码下的am57xx-beagle-x15-common.dtsi添加
&uart1 {
status = "okay";
};
然后在linux内核源码下的JN-mini5728-common.dtsi添加
&uart1 {
status = "okay";
};
然后编译uboot:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- JN-mini5728_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
编译linux镜像:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- JN-mini5728_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- JN-mini5728.dtb
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage -j4
然后把:
arch/arm/boot/dts/JN-mini5728.dtb arch/arm/boot/zImage
MLO u-boot.img
拷贝到SD卡中,然后启动主板:
root@am57xx-evm:/dev# cd /proc/tty/driver
root@am57xx-evm:/proc/tty/driver# ls -l -r–r–r– 1 root root 0 Mar 29 22:30 serial
root@am57xx-evm:/proc/tty/driver# cat serial serinfo:1.0 driver revision:
0: uart:unknown port:00000000 irq:0
1: uart:unknown port:00000000 irq:0
2: uart:8250 mmio:0x48020000 irq:299 tx:9519 rx:115 RTS|DTR|DSR
3: uart:unknown port:00000000 irq:0
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0
8: uart:unknown port:00000000 irq:0
9: uart:unknown port:00000000 irq:0
root@am57xx-evm:/proc/tty/driver#
发现只有2串口是被初始化过的,0串口没有被初始化,2串口为控制台串口
所以请问一下,需要系统启动后完成0串口的初始化,需要修改那些文件??? 或者是编译操作过程哪里有问题?
(我的确还没有修改串口管教映射的文件,但是这个理应不会影响串口的初始化及其驱动加载)
oot@am57xx-evm:/dev# echo test > ttyS2
test
(串口2是可以收发的)
root@am57xx-evm:/dev# echo test > ttyS0
-sh: echo: write error: Input/output error
(串口0就报错了)
root@am57xx-evm:/dev#
请问一下工程师们,开启一个串口进行数据收发需要那些步骤的操作,官方有没有具体的参考文档。
Shine:
回复 yongqing wang:
在dts中配置一下uart1 Pinmux.
processors.wiki.ti.com/…/Processor_SDK_Linux_Training:_Introduction_to_Device_Driver_Development
user5050224:
回复 yongqing wang:
谢谢这位网友的分享,很有帮助