使用的是 git clone --depth=1 -b f1c100s-480272lcd-test https://github.com/Icenowy/linux.git
suniv.dtsi中
uart0_pins_a: uart0-pins-pe {
pins = "PE0", "PE1";
function = "uart0";
};
uart2_pins_a: uart2-pins-pe {
pins = "PE7", "PE8";
function = "uart2";
};
以及
uart0: serial@1c25000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25000 0x400>;
interrupts = <1>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART0>;
resets = <&ccu RST_BUS_UART0>;
status = "disabled";
};
uart1: serial@1c25400 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25400 0x400>;
interrupts = <2>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART1>;
resets = <&ccu RST_BUS_UART1>;
status = "disabled";
};
uart2: serial@1c25800 {
compatible = "snps,dw-apb-uart";
reg = <0x01c25800 0x400>;
interrupts = <3>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&ccu CLK_BUS_UART2>;
resets = <&ccu RST_BUS_UART2>;
status = "disabled";
};
suniv-f1c100s-licheepi-nano.dts中
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins_a>;
status = "okay";
};
&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins_a>;
status = "okay";
};
启动之后,在shell中,stty -F /dev/ttyS2 raw speed 115200 min 0 time 10 或者 echo "ASDADSADAD++++----*/098" > /dev/ttyS2
提示 /dev/ttyS2: Input/output error 或者 write error: Input/output error
查看F1C600的DS,看了7.4.6. UART Register Lis的uart2的寄存器地址,也没问题 是 0x01C25800.
离线
凭感觉, 应该不是 /dev/ttyS2, 而是 /dev/ttyS1
你先改成 ttyS1 试一试
感谢,对的,改成S1确实有波形,但是为什么呢? 是不是由于我在dts里面没有uart1,导致产生的设备节点UART0对应ttyS0,UART2对应了ttyS1?回头我测试下
另外我测试ch340g的时候有个问题很奇怪,echo 发送到ttyUSB0是没问题的,有波形,PC可以接收到,但是cat /dev/ttyUSB0 没有任何数据,PC已经发送了,而且硬件上也有波形。好奇怪
离线