Hi3516EV200 uses UART1 Notes
UART1 is needed in business, and the corresponding serial port can be seen by using the command ls/dev/ttyAMA*. However, an error is reported with cat/dev/ttyAMA1 as follows:
~ # ls /dev/ttyAMA* -l crw------- 1 root root 204, 64 Jan 1 00:00 /dev/ttyAMA0 crw-r--r-- 1 root root 204, 65 Jan 1 00:00 /dev/ttyAMA1 ~ # cat /dev/ttyAMA1 cat: can't open '/dev/ttyAMA1': No such device or address ~ #
It's like there's no such device, but it's clearly visible on it. First check the configuration of IO multiplexing pins.
Two pins, 10 and 9, are used in the schematic diagram, as shown in the figure:
Looking at the configuration register, the corresponding document is:
xxxV200R001C01SPC010_ReleaseDoc\zh\00.hardware\chip\Hi3516EV200\Hi3516EV200_PINOUT_CN.xlsx
With devmem, registers can be operated directly. The instructions are as follows:
devmem 0x112C0070 32 0x00001002 #Select UART1_RXD devmem 0x112C0074 32 0x00001002 #Select UART1_TXD
Try cat/dev/ttyAMA1 again or report an error. Next, restart the device to see if there is any information related to the serial port printed when starting. Neither did I see any useful information.
Now we can only check the driver. Where is the driver? Try it on the Internet and see this article:
Haisi HI35XX Serial Port Debugging It has the following contents:
I tested and used Heise HI3520 DV400 device, which has three serial ports. The official SDK only enables UART0, that is, debugging serial port. If you want to use UART1 or UART2, users need to set it manually. The most direct way is to change the status of the corresponding uart in the device tree to status = okay. The serial port driver that Heis actually loaded is PL011. menuconfig checks whether ARM AMBA PL011 serial port support and Support for console on AMBA serial port in Device Drivers > Character Devices > Serial Drivers have options. Recompile the kernel and burn it in. Under / dev, you can see if there is any serial device ttyAMA0~2.
The description here is very close to my phenomena. Go and configure the kernel.
Look, the two options are preceded by *, which means they have been compiled into the kernel, that is to say, they are not the problem.
Next, try the stty command, which reads as follows:
~ # stty -F /dev/ttyAMA0 -a speed 115200 baud;stty: /dev/ttyAMA0 line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke ~ # stty -F /dev/ttyAMA1 -a stty: can't open '/dev/ttyAMA1': No such device or address ~ #
Look at proc again.
~ # cat /proc/tty/driver/ttyAMA serinfo:1.0 driver revision: 0: uart:PL011 rev2 mmio:0x12040000 irq:20 tx:16796 rx:513 RTS|CTS|DTR|DSR|CD|RI ~ #
The above information, only serial 0, no serial 1. Now I want to find out where several serial ports are specified.
A blog said: vi arch/arm/boot/dts/hi3516cv300.dtsi found uart1 and changed state to'okay'
According to the principle, hi3516ev200.dtsi is found in the folder in the kernel, and it looks like this:
How is disabled? It's clear that uart0 can be used. In retrospect, when looking for hi3516ev200.dtsi just now, there is also a hi3516ev200-demb.dts beside it. Open it and have a look, as shown in the figure:
It seems that this is where the status of uart1 is changed to okay and the kernel is recompiled.
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage
The compilation here is very fast (about 1 minute), because the previous compilation, this modification is very little.
Then reburt the flash and restart the system. Just try cat/dev/ttyAMA1.
However, it should not work, but also according to the above configuration of serial pin reuse, the configuration pin reuse instructions add boot start, and then you can.