海思Hi3519V101使用串口1、2、3

第一步修改内核dts

修改文件:hisi-hi3519v101-hmp-demb.dts

路径:/home/year/hisi/Hi3519V101_SDK_V1.0.5.0/osdrv/opensource/kernel/linux-3.18.y/arch/arm/boot/dts

搜索uart0,在下方添加


&uart0 {
	status = "okay";
};
&uart1 {
	status = "okay";
};
&uart2 {
	status = "okay";
};
&uart3 {
	status = "okay";
};

编译内核:

make ARCH=arm CROSS_COMPILE=arm-hisiv500-linux- uImage

生成内核:/home/year/hisi/Hi3519V101_SDK_V1.0.5.0/osdrv/opensource/kernel/linux-3.18.y/arch/arm/boot/uImage

更新后查看节点:

~ # ls /dev/ttyAMA
ttyAMA0  ttyAMA1  ttyAMA2  ttyAMA3
~ # ls /dev/ttyAMA

然后设置管脚复用:

	switch (uart_x)
		{
			case 1:
				system("himm 0x1204008c 0x1 >> /dev/null");	//Uart1_RXD
				system("himm 0x12040094 0x1 >> /dev/null");	//Uart1_TXD
				break;
			case 2:
				system("himm 0x12040098 0x1 >> /dev/null");	//Uart2_RXD
				system("himm 0x1204009c 0x1 >> /dev/null");	//Uart2_TXD
				break;
			case 3:
				system("himm 0x12040088 0x2 >> /dev/null");	//Uart3_RXD
				system("himm 0x12040090 0x2 >> /dev/null");	//Uart3_TXD
				break;
			case 4:
				system("himm 0x120400a0 0x2 >> /dev/null");	//Uart4_RXD
				system("himm 0x120400a4 0x2 >> /dev/null");	//Uart4_TXD
				break;
		}

 

你可能感兴趣的:(海思开发)