diff --git a/IMX6ULL/doc_pic/09_UART/05_Linux串口应用编程.md b/IMX6ULL/doc_pic/09_UART/05_Linux串口应用编程.md index e215879..313630b 100644 --- a/IMX6ULL/doc_pic/09_UART/05_Linux串口应用编程.md +++ b/IMX6ULL/doc_pic/09_UART/05_Linux串口应用编程.md @@ -97,7 +97,15 @@ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gn -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o serial_send_recv serial_send_recv.c + +2. 板子上 +/mnt/serial_send_recv /dev/ttymxc5 +``` @@ -113,7 +121,17 @@ export PATH=$PATH:/home/book/100ask_stm32mp157_pro-sdk/ToolChain/arm-buildroot-l -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o serial_send_recv serial_send_recv.c + +2. 板子上 +/mnt/serial_send_recv /dev/ttySTM3 +``` + + @@ -211,7 +229,17 @@ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gn -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o gps_read gps_read.c + +2. 板子上 +/mnt/gps_read /dev/ttymxc5 +``` + + @@ -227,7 +255,17 @@ export PATH=$PATH:/home/book/100ask_stm32mp157_pro-sdk/ToolChain/arm-buildroot-l -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o gps_read gps_read.c + +2. 板子上 +/mnt/gps_read /dev/ttySTM3 +``` + + diff --git a/IMX6ULL/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png b/IMX6ULL/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png new file mode 100644 index 0000000..c418ab9 Binary files /dev/null and b/IMX6ULL/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png differ diff --git a/IMX6ULL/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png b/IMX6ULL/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png new file mode 100644 index 0000000..46d4a90 Binary files /dev/null and b/IMX6ULL/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png differ diff --git a/IMX6ULL/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png b/IMX6ULL/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png new file mode 100644 index 0000000..b88789b Binary files /dev/null and b/IMX6ULL/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png differ diff --git a/IMX6ULL/source/09_UART/01_app_send_recv/serial_send_recv.c b/IMX6ULL/source/09_UART/01_app_send_recv/serial_send_recv.c new file mode 100644 index 0000000..0e9bd29 --- /dev/null +++ b/IMX6ULL/source/09_UART/01_app_send_recv/serial_send_recv.c @@ -0,0 +1,177 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* set_opt(fd,115200,8,'N',1) */ +int set_opt(int fd,int nSpeed, int nBits, char nEvent, int nStop) +{ + struct termios newtio,oldtio; + + if ( tcgetattr( fd,&oldtio) != 0) { + perror("SetupSerial 1"); + return -1; + } + + bzero( &newtio, sizeof( newtio ) ); + newtio.c_cflag |= CLOCAL | CREAD; + newtio.c_cflag &= ~CSIZE; + + newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /*Input*/ + newtio.c_oflag &= ~OPOST; /*Output*/ + + switch( nBits ) + { + case 7: + newtio.c_cflag |= CS7; + break; + case 8: + newtio.c_cflag |= CS8; + break; + } + + switch( nEvent ) + { + case 'O': + newtio.c_cflag |= PARENB; + newtio.c_cflag |= PARODD; + newtio.c_iflag |= (INPCK | ISTRIP); + break; + case 'E': + newtio.c_iflag |= (INPCK | ISTRIP); + newtio.c_cflag |= PARENB; + newtio.c_cflag &= ~PARODD; + break; + case 'N': + newtio.c_cflag &= ~PARENB; + break; + } + + switch( nSpeed ) + { + case 2400: + cfsetispeed(&newtio, B2400); + cfsetospeed(&newtio, B2400); + break; + case 4800: + cfsetispeed(&newtio, B4800); + cfsetospeed(&newtio, B4800); + break; + case 9600: + cfsetispeed(&newtio, B9600); + cfsetospeed(&newtio, B9600); + break; + case 115200: + cfsetispeed(&newtio, B115200); + cfsetospeed(&newtio, B115200); + break; + default: + cfsetispeed(&newtio, B9600); + cfsetospeed(&newtio, B9600); + break; + } + + if( nStop == 1 ) + newtio.c_cflag &= ~CSTOPB; + else if ( nStop == 2 ) + newtio.c_cflag |= CSTOPB; + + newtio.c_cc[VMIN] = 1; /* 读数据时的最小字节数: 没读到这些数据我就不返回! */ + newtio.c_cc[VTIME] = 0; /* 等待第1个数据的时间: + * 比如VMIN设为10表示至少读到10个数据才返回, + * 但是没有数据总不能一直等吧? 可以设置VTIME(单位是10秒) + * 假设VTIME=1,表示: + * 10秒内一个数据都没有的话就返回 + * 如果10秒内至少读到了1个字节,那就继续等待,完全读到VMIN个数据再返回 + */ + + tcflush(fd,TCIFLUSH); + + if((tcsetattr(fd,TCSANOW,&newtio))!=0) + { + perror("com set error"); + return -1; + } + //printf("set done!\n"); + return 0; +} + +int open_port(char *com) +{ + int fd; + //fd = open(com, O_RDWR|O_NOCTTY|O_NDELAY); + fd = open(com, O_RDWR|O_NOCTTY); + if (-1 == fd){ + return(-1); + } + + if(fcntl(fd, F_SETFL, 0)<0) /* 设置串口为阻塞状态*/ + { + printf("fcntl failed!\n"); + return -1; + } + + return fd; +} + + +/* + * ./serial_send_recv + */ +int main(int argc, char **argv) +{ + int fd; + int iRet; + char c; + + /* 1. open */ + + /* 2. setup + * 115200,8N1 + * RAW mode + * return data immediately + */ + + /* 3. write and read */ + + if (argc != 2) + { + printf("Usage: \n"); + printf("%s \n", argv[0]); + return -1; + } + + fd = open_port(argv[1]); + if (fd < 0) + { + printf("open %s err!\n", argv[1]); + return -1; + } + + iRet = set_opt(fd, 115200, 8, 'N', 1); + if (iRet) + { + printf("set port err!\n"); + return -1; + } + + printf("Enter a char: "); + while (1) + { + scanf("%c", &c); + iRet = write(fd, &c, 1); + iRet = read(fd, &c, 1); + if (iRet == 1) + printf("get: %02x %c\n", c, c); + else + printf("can not get data\n"); + } + + return 0; +} + diff --git a/IMX6ULL/source/09_UART/02_gps/gps_read.c b/IMX6ULL/source/09_UART/02_gps/gps_read.c new file mode 100644 index 0000000..684f6ec --- /dev/null +++ b/IMX6ULL/source/09_UART/02_gps/gps_read.c @@ -0,0 +1,257 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* set_opt(fd,115200,8,'N',1) */ +int set_opt(int fd,int nSpeed, int nBits, char nEvent, int nStop) +{ + struct termios newtio,oldtio; + + if ( tcgetattr( fd,&oldtio) != 0) { + perror("SetupSerial 1"); + return -1; + } + + bzero( &newtio, sizeof( newtio ) ); + newtio.c_cflag |= CLOCAL | CREAD; + newtio.c_cflag &= ~CSIZE; + + newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); /*Input*/ + newtio.c_oflag &= ~OPOST; /*Output*/ + + switch( nBits ) + { + case 7: + newtio.c_cflag |= CS7; + break; + case 8: + newtio.c_cflag |= CS8; + break; + } + + switch( nEvent ) + { + case 'O': + newtio.c_cflag |= PARENB; + newtio.c_cflag |= PARODD; + newtio.c_iflag |= (INPCK | ISTRIP); + break; + case 'E': + newtio.c_iflag |= (INPCK | ISTRIP); + newtio.c_cflag |= PARENB; + newtio.c_cflag &= ~PARODD; + break; + case 'N': + newtio.c_cflag &= ~PARENB; + break; + } + + switch( nSpeed ) + { + case 2400: + cfsetispeed(&newtio, B2400); + cfsetospeed(&newtio, B2400); + break; + case 4800: + cfsetispeed(&newtio, B4800); + cfsetospeed(&newtio, B4800); + break; + case 9600: + cfsetispeed(&newtio, B9600); + cfsetospeed(&newtio, B9600); + break; + case 115200: + cfsetispeed(&newtio, B115200); + cfsetospeed(&newtio, B115200); + break; + default: + cfsetispeed(&newtio, B9600); + cfsetospeed(&newtio, B9600); + break; + } + + if( nStop == 1 ) + newtio.c_cflag &= ~CSTOPB; + else if ( nStop == 2 ) + newtio.c_cflag |= CSTOPB; + + newtio.c_cc[VMIN] = 1; /* 读数据时的最小字节数: 没读到这些数据我就不返回! */ + newtio.c_cc[VTIME] = 0; /* 等待第1个数据的时间: + * 比如VMIN设为10表示至少读到10个数据才返回, + * 但是没有数据总不能一直等吧? 可以设置VTIME(单位是10秒) + * 假设VTIME=1,表示: + * 10秒内一个数据都没有的话就返回 + * 如果10秒内至少读到了1个字节,那就继续等待,完全读到VMIN个数据再返回 + */ + + tcflush(fd,TCIFLUSH); + + if((tcsetattr(fd,TCSANOW,&newtio))!=0) + { + perror("com set error"); + return -1; + } + //printf("set done!\n"); + return 0; +} + +int open_port(char *com) +{ + int fd; + //fd = open(com, O_RDWR|O_NOCTTY|O_NDELAY); + fd = open(com, O_RDWR|O_NOCTTY); + if (-1 == fd){ + return(-1); + } + + if(fcntl(fd, F_SETFL, 0)<0) /* 设置串口为阻塞状态*/ + { + printf("fcntl failed!\n"); + return -1; + } + + return fd; +} + + +int read_gps_raw_data(int fd, char *buf) +{ + int i = 0; + int iRet; + char c; + int start = 0; + + while (1) + { + iRet = read(fd, &c, 1); + if (iRet == 1) + { + if (c == '$') + start = 1; + if (start) + { + buf[i++] = c; + } + if (c == '\n' || c == '\r') + return 0; + } + else + { + return -1; + } + } +} + +/* eg. $GPGGA,082559.00,4005.22599,N,11632.58234,E,1,04,3.08,14.6,M,-5.6,M,,*76" */ +int parse_gps_raw_data(char *buf, char *time, char *lat, char *ns, char *lng, char *ew) +{ + char tmp[10]; + + if (buf[0] != '$') + return -1; + else if (strncmp(buf+3, "GGA", 3) != 0) + return -1; + else if (strstr(buf, ",,,,,")) + { + printf("Place the GPS to open area\n"); + return -1; + } + else { + //printf("raw data: %s\n", buf); + sscanf(buf, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,]", tmp, time, lat, ns, lng, ew); + return 0; + } +} + + +/* + * ./serial_send_recv + */ +int main(int argc, char **argv) +{ + int fd; + int iRet; + char c; + char buf[1000]; + char time[100]; + char Lat[100]; + char ns[100]; + char Lng[100]; + char ew[100]; + + float fLat, fLng; + + /* 1. open */ + + /* 2. setup + * 115200,8N1 + * RAW mode + * return data immediately + */ + + /* 3. write and read */ + + if (argc != 2) + { + printf("Usage: \n"); + printf("%s \n", argv[0]); + return -1; + } + + fd = open_port(argv[1]); + if (fd < 0) + { + printf("open %s err!\n", argv[1]); + return -1; + } + + iRet = set_opt(fd, 9600, 8, 'N', 1); + if (iRet) + { + printf("set port err!\n"); + return -1; + } + + while (1) + { + /* eg. $GPGGA,082559.00,4005.22599,N,11632.58234,E,1,04,3.08,14.6,M,-5.6,M,,*76"*/ + /* read line */ + iRet = read_gps_raw_data(fd, buf); + + /* parse line */ + if (iRet == 0) + { + iRet = parse_gps_raw_data(buf, time, Lat, ns, Lng, ew); + } + + /* printf */ + if (iRet == 0) + { + printf("Time : %s\n", time); + printf("ns : %s\n", ns); + printf("ew : %s\n", ew); + printf("Lat : %s\n", Lat); + printf("Lng : %s\n", Lng); + + /* 纬度格式: ddmm.mmmm */ + sscanf(Lat+2, "%f", &fLat); + fLat = fLat / 60; + fLat += (Lat[0] - '0')*10 + (Lat[1] - '0'); + + /* 经度格式: dddmm.mmmm */ + sscanf(Lng+3, "%f", &fLng); + fLng = fLng / 60; + fLng += (Lng[0] - '0')*100 + (Lng[1] - '0')*10 + (Lng[2] - '0'); + printf("Lng,Lat: %.06f,%.06f\n", fLng, fLat); + } + } + + return 0; +} + diff --git a/README.md b/README.md index deed72a..0f9eea8 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,13 @@ git clone https://e.coding.net/weidongshan/linux/doc_and_source_for_drivers.git 04_TTY驱动程序框架 ``` +* 2021.07.19 发布"UART子系统" + + ```shell + 5a_在STM32MP157上做串口实验的准备工作 + 05_Linux串口应用编程_回环 + 06_Linux串口应用编程_GPS + ``` ## 6. 联系方式 diff --git a/STM32MP157/doc_pic/09_UART/04_a_先修改STM32MP157的设备树以使用UART8.md b/STM32MP157/doc_pic/09_UART/04_a_先修改STM32MP157的设备树以使用UART8.md deleted file mode 100644 index f9dde2e..0000000 --- a/STM32MP157/doc_pic/09_UART/04_a_先修改STM32MP157的设备树以使用UART8.md +++ /dev/null @@ -1,63 +0,0 @@ -## 先修改STM32MP157的设备树以使用UART8 - - - -### 1. 只关注APP开发的话 - -把GIT仓库中这个dtb文件复制到开发板上去就可以: - -```shell -doc_and_source_for_drivers\STM32MP157\source\A7\09_UART\00_stm32mp157_devicetree_for_uart8\dtb - stm32mp157c-100ask-512d-lcd-v1.dtb -``` - - - -操作方法: - - * Ubuntu上:复制dtb文件到NFS目录: - - ```shell - $ cp stm32mp157c-100ask-512d-lcd-v1.dtb ~/nfs_rootfs/ - ``` - - * 开发板上挂载NFS文件系统 - - * vmware使用NAT(假设windowsIP为192.168.1.100) - - ```shell - [root@100ask:~]# mount -t nfs -o nolock,vers=3,port=2049,mountport=9999 - 192.168.1.100:/home/book/nfs_rootfs /mnt - ``` - - * vmware使用桥接,或者不使用vmware而是直接使用服务器:假设Ubuntu IP为192.168.1.137 - - ```shell - [root@100ask:~]# mount -t nfs -o nolock,vers=3 192.168.1.137:/home/book/nfs_rootfs /mnt - ``` - -* 更新设备树 - - ```shell - [root@100ask:~]# mount /dev/mmcblk2p2 /boot - [root@100ask:~]# cp /mnt/stm32mp157c-100ask-512d-lcd-v1.dtb /boot - [root@100ask:~]# sync - ``` - -* 重启开发板 - -* 在串口可以看到以下设备节点 - - ```shell - ls /dev/ttySTM* - /dev/ttySTM0 - /dev/ttySTM1 - /dev/ttySTM3 - ``` - - - - - -### 2. 从头修改设备树文件 - diff --git a/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.md b/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.md index e215879..313630b 100644 --- a/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.md +++ b/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.md @@ -97,7 +97,15 @@ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gn -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o serial_send_recv serial_send_recv.c + +2. 板子上 +/mnt/serial_send_recv /dev/ttymxc5 +``` @@ -113,7 +121,17 @@ export PATH=$PATH:/home/book/100ask_stm32mp157_pro-sdk/ToolChain/arm-buildroot-l -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o serial_send_recv serial_send_recv.c + +2. 板子上 +/mnt/serial_send_recv /dev/ttySTM3 +``` + + @@ -211,7 +229,17 @@ export PATH=$PATH:/home/book/100ask_imx6ull-sdk/ToolChain/arm-buildroot-linux-gn -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o gps_read gps_read.c + +2. 板子上 +/mnt/gps_read /dev/ttymxc5 +``` + + @@ -227,7 +255,17 @@ export PATH=$PATH:/home/book/100ask_stm32mp157_pro-sdk/ToolChain/arm-buildroot-l -编译、执行程序 +编译、执行程序: + +```shell +1. Ubuntu上 +arm-buildroot-linux-gnueabihf-gcc -o gps_read gps_read.c + +2. 板子上 +/mnt/gps_read /dev/ttySTM3 +``` + + diff --git a/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.tif b/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.tif new file mode 100644 index 0000000..269b22b Binary files /dev/null and b/STM32MP157/doc_pic/09_UART/05_Linux串口应用编程.tif differ diff --git a/STM32MP157/doc_pic/09_UART/05_a_在STM32MP157上做串口实验的准备工作.md b/STM32MP157/doc_pic/09_UART/05_a_在STM32MP157上做串口实验的准备工作.md new file mode 100644 index 0000000..6a17504 --- /dev/null +++ b/STM32MP157/doc_pic/09_UART/05_a_在STM32MP157上做串口实验的准备工作.md @@ -0,0 +1,196 @@ +## 在STM32MP157上做串口实验的准备工作 + +* 本节课程源码在GIT仓库里 + ```shell +doc_and_source_for_drivers\STM32MP157\source\A7\09_UART + 00_stm32mp157_devicetree_for_uart8 + ``` + + + +### 1. 出厂系统不支持扩展板上的UART + +![](../../../IMX6ULL/doc_pic/09_UART/pic/09_UART/18_gps_to_stm32mp157.png) + + + +### 2. 只关注APP开发的话 + +把GIT仓库中这个dtb文件复制到开发板上去就可以: + +```shell +doc_and_source_for_drivers\STM32MP157\source\A7\09_UART\00_stm32mp157_devicetree_for_uart8\dtb + stm32mp157c-100ask-512d-lcd-v1.dtb +``` + + + +操作方法: + + * Ubuntu上:复制dtb文件到NFS目录: + + ```shell + $ cp stm32mp157c-100ask-512d-lcd-v1.dtb ~/nfs_rootfs/ + ``` + + * 开发板上挂载NFS文件系统 + + * vmware使用NAT(假设windowsIP为193.168.1.100) + + ```shell + [root@100ask:~]# mount -t nfs -o nolock,vers=3,port=2049,mountport=9999 + 193.168.1.100:/home/book/nfs_rootfs /mnt + ``` + + * vmware使用桥接,或者不使用vmware而是直接使用服务器:假设Ubuntu IP为193.168.1.137 + + ```shell + [root@100ask:~]# mount -t nfs -o nolock,vers=3 193.168.1.137:/home/book/nfs_rootfs /mnt + ``` + +* 更新设备树 + + ```shell + [root@100ask:~]# mount /dev/mmcblk2p2 /boot + [root@100ask:~]# cp /mnt/stm32mp157c-100ask-512d-lcd-v1.dtb /boot + [root@100ask:~]# sync + ``` + +* 重启开发板 + +* 在串口可以看到以下设备节点 + + ```shell + ls /dev/ttySTM* + /dev/ttySTM0 + /dev/ttySTM1 + /dev/ttySTM3 + ``` + + + + + +### 3. 从头修改设备树文件 + +#### 3.1 确定硬件资源 + +观察STM32MP157的扩展板,背后写着: UART8_TX, UART8_RX,如下图: + +![image-20210719092503508](../../../IMX6ULL/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png) + + + +打开STM32MP157底板原理图,可知UART8_TX、UART8_RX使用引脚PE1、PE0,如下图: + +![image-20210719092726986](../../../IMX6ULL/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png) + + + +#### 3.2 使能设备树节点 + +在STM32MP157的内核设备树文件`arch/arm/boot/dts/stm32mp151.dtsi`中,已经设置了uart8节点: + +![image-20210719092138173](C:/Users/weidongshan/AppData/Roaming/Typora/typora-user-images/image-20210719092138173.png) + +我们需要使能这个节点,往下看。 + +#### 3.3 通过Pinctrl指定引脚 + +光使能UART8还不行,还需要为它选择引脚。 + +修改`arch/arm/boot/dts/stm32mp15xx-100ask.dtsi`,如下: + +```shell +&uart8 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&uart8_pins_mx>; + pinctrl-1 = <&uart8_sleep_pins_mx>; + status = "okay"; +}; +``` + + + +这些Pinctrl信息已经在`arm/boot/dts/stm32mp157-100ask-pinctrl.dtsi`中有了,无需我们添加: + +![image-20210719092949939](../../../IMX6ULL/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png) + + + +#### 3.4 指定设备别名 + +UART8对应的设备节点是哪个?它的驱动程序需要从"别名"里确定编号。 + +修改`arch/arm/boot/dts/stm32mp157c-100ask-512d-v1.dts`,如下: + +```shell + aliases { + ethernet0 = ðernet0; + serial0 = &uart4; //debug + serial1 = &usart6; //rs485 + serial2 = &usart1; //bluetooth + serial3 = &uart8; // extend board uart, /dev/ttySTM3 + }; +``` + + + +#### 3.5 编译、使用 + + * 设置工具链 + + ```shell + export ARCH=arm + export CROSS_COMPILE=arm-buildroot-linux-gnueabihf- + export PATH=$PATH:/home/book/100ask_stm32mp157_pro-sdk/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin + ``` + + * 编译设备树: + 在Ubuntu的STM32MP157内核目录下执行如下命令, + 得到设备树文件:`arch/arm/boot/dts/stm32mp157c-100ask-512d-lcd-v1.dtb` + + ```shell + make dtbs + ``` + + * 复制到NFS目录: + + ```shell + $ cp arch/arm/boot/dts/stm32mp157c-100ask-512d-lcd-v1.dtb ~/nfs_rootfs/ + ``` + + * 开发板上挂载NFS文件系统 + + * vmware使用NAT(假设windowsIP为193.168.1.100) + + ```shell + [root@100ask:~]# mount -t nfs -o nolock,vers=3,port=2049,mountport=9999 + 193.168.1.100:/home/book/nfs_rootfs /mnt + ``` + + * vmware使用桥接,或者不使用vmware而是直接使用服务器:假设Ubuntu IP为193.168.1.137 + + ```shell + [root@100ask:~]# mount -t nfs -o nolock,vers=3 193.168.1.137:/home/book/nfs_rootfs /mnt + ``` + +* 更新设备树 + + ```shell + [root@100ask:~]# mount /dev/mmcblk2p2 /boot + [root@100ask:~]# cp /mnt/stm32mp157c-100ask-512d-lcd-v1.dtb /boot + [root@100ask:~]# sync + ``` + +* 重启开发板 + +* 在串口可以看到以下设备节点 + + ```shell + ls /dev/ttySTM* + /dev/ttySTM0 + /dev/ttySTM1 + /dev/ttySTM3 + ``` + diff --git a/STM32MP157/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png b/STM32MP157/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png new file mode 100644 index 0000000..c418ab9 Binary files /dev/null and b/STM32MP157/doc_pic/09_UART/pic/09_UART/19_stm32mp157_extend_board_back.png differ diff --git a/STM32MP157/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png b/STM32MP157/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png new file mode 100644 index 0000000..46d4a90 Binary files /dev/null and b/STM32MP157/doc_pic/09_UART/pic/09_UART/20_stm32mp157_pins_of_uart8.png differ diff --git a/STM32MP157/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png b/STM32MP157/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png new file mode 100644 index 0000000..b88789b Binary files /dev/null and b/STM32MP157/doc_pic/09_UART/pic/09_UART/21_stm32mp157_uart8_pinctrl.png differ