因为我在网上找到一个贴子,也是说用tcgetattr()无法读取/dev/ttyS1的属性,他说他找到原因了,是这样的:
The problem was that my BIOS was not aware of my serial ports, I just enabled them.
PS:不是说Linux的中断全部是自己重写的,根本不使用BIOS中断么?那跟BIOS是否识别串口有啥关系?
今天检查了一下,内核配置的时候是配的最多两个串口,使用两个串口:
Device Driver
--> Character devices
--> Serial Drivers
--> [2] Maximum number of 8250/16550 serial ports
--> [2] Number of 8250/16550 serial ports to register at runtime
但问题还是一样。我将ttyS1的Tx脚用GPIO控制,设置成GPIO输出,但不管我控制输出0还是1,那个引脚都是高电平