"); //-->
UART即通用异步收发器,是一种支持全双工串行通信协议的接口。在i.MX6ULL处理器平台上,该处理器原生支持多达8路的UART接口,提供了丰富的串行通信能力。
针对ELF 1开发板,实际引出了4路UART接口供开发者使用,具体包括UART1、UART2、UART3以及UART7。其中UART1用于调试,UART2、UART3用于连接RS485收发芯片,UART7连接TTL转RS232芯片。
接下来,我们将针对上述几个UART接口逐一进行详细的配置说明。本次源码适配工作是在NXP i.MX6ULL EVK评估板的Linux内核源码(特定版本:Linux-imx_4.1.15)基础上进行的,以确保UART接口能够正确无误的在ELF 1开发板上工作。
一、 准备工作
elf@ubuntu:~/work$ tar jvxf linux-imx-imx_4.1.15_2.0.0_ga.tar.bz2 elf@ubuntu:~/work$ cd linux-imx-imx_4.1.15_2.0.0_ga/ elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ ls
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ cp arch/arm/configs/imx_v7_mfg_defconfig arch/arm/configs/imx6ull_elf1_defconfig
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ cp arch/arm/boot/dts/imx6ull-14x14-evk.dts arch/arm/boot/dts/imx6ull-elf1-emmc.dts
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ vi arch/arm/boot/dts/Makefile
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ vim build.sh
#!/bin/bash export CPUS=`grep -c processor /proc/cpuinfo` source /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi make distclean make imx6ull_elf1_defconfig make -j${CPUS} rm -rf ./.tmp make modules_install INSTALL_MOD_PATH=./.tmp/rootfs/ cd .tmp/rootfs/ tar -jcvf modules.tar.bz2 *
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ chmod 777 build.sh
MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX
pinctrl_uart3: uart3grp { fsl,pins = < MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX 0x1b0b1 MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX 0x1b0b1 >; };
MX6UL_PAD_LCD_DATA17__UART7_DCE_RX MX6UL_PAD_LCD_DATA16__UART7_DCE_TX
pinctrl_uart7: uart7grp { fsl,pins = < MX6UL_PAD_LCD_DATA17__UART7_DCE_RX 0x1b0b1 MX6UL_PAD_LCD_DATA16__UART7_DCE_TX 0x1b0b1 >; };
&uart1 { pinctrl-names = “default”; pinctrl-0 = <&pinctrl_uart1>; status = “okay”; }
&uart2 { pinctrl-names = “default”; pinctrl-0 = <&pinctrl_uart2>; /* fsl,uart-has-rtscts; */ /* for DTE mode,add below change */ /* fsl,dte-mode; */ /* pinctrl-0 = <&pinctrl_uart2dte>; */ status = “okay”; }
&uart3 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart3>; status = "okay"; }; &uart7 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart7>; status = "okay"; };
. /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ make dtbs
elf@ubuntu:~/work/linux-imx-imx_4.1.15_2.0.0_ga$ scp arch/arm/boot/dts/imx6ull-elf\1-emmc.dtb root@172.16.0.175:/run/media/mmcblk1p1/
root@ELF1:~# elf1_cmd_serialport ttymxc1 & root@ELF1:~# elf1_cmd_serialport ttymxc2 -o -b 9600 -t aabbccddeeff 1
root@ELF1:~# elf1_cmd_serialport ttymxc6 -o -b 9600 -t aabbccddeeff 1
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。