Disable console output on UART1 (ttyFIQ0)


#1

I have a Teensy microcontroller wired to UART1, so I want to disable console output on /dev/ttyFIQ0. I have changed the kernel boot parameters console and androidboot.console to ttyAMA3, but I still get console output on UART1 during the boot sequence, and also all dmesg output still goes there. Console input seems gone though. Where to disable console output? Thanks.


#2

I suggest to remove chosen node from the device tree (linux/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts).


#3

Thanks for your quick reply. When I removed it, I still got the boot messages until the moment when the system would not continue to boot and rebooted into fastboot.

As the value of stdout-path in that node was already serial6:115200:n8 (and serial6 is an alias for uart6) I wouldn’t even expect this to have any influence, as I’m looking to disable stdout on serial1 aka uart1. Changing the value into anything other serialN other than 6 does also not seem to have any effect.


#4

Actually, kirin serial6/uart6 is routed to the UART1 of the 96boards Low-Speed connector. If you remove it from the dts chosen node and from command line, Linux will not use it for output. However you will still have output from the bootloaders… I assume you have to rebuild the bootloaders to avoid early output on UART1. btw, why not using UART0 ?


#5

Thanks, I’ll try again. I tried UART0 in a prototype but I couldn’t get it working, probably because it has flow control. Is that easy to disable? I guess I could add flow control to the Teensy Serial too, might look into that as well.


#6

Yes, If you are programming in C you just have to clear flow control flags form termios (CRTSCTS).
http://man7.org/linux/man-pages/man3/termios.3.html
https://en.wikibooks.org/wiki/Serial_Programming/termios

example:

struct termios ti;
int fd, i;
fd = open(dev, O_RDWR | O_NOCTTY);
tcgetattr(fd, &ti)
cfmakeraw(&ti);
ti.c_cflag &= ~CRTSCTS;  # clear hw flow control
tcsetattr(fd, TCSANOW, &ti)
...

#7

Our (Android) app is in C# but we used Java to access the Teensy over USB serial. Now we have shrunk down the prototype with no space left to connect HiKey & Teensy over USB so I routed some RXTX lines on the mezzanine which has the Teensy soldered down to it.


#8

Teensy? That’s just a breakout board for an atmega32u4. Atmega32u4 has a usb port integrated. You could just wire that straight into the usb pins on the HS connector.


#9

Yes a Teensy 3 in fact but that would have been a possibility too indeed. Using its UARTs for what we’re trying to accomplish seemed more practical.

I’ve got time for one more PCB revision so I can’t try too many new things and have to keep some options open, so I’ll try to add some jumpers to be able select either UART0 or 1 and then deal with the issues in software. There seems to be a way out :slight_smile:


#10

I can now succesfully disable the console, but the problem now is the FIQ debugger, which also outputs on UART1. I can also disable the FIQ debugger by removing it from the dts, but then the complete /dev/ttyFIQ0 is gone, too. Is there something I can do to get this port or an equivalent /dev/ttyXXX back that connects to UART1?

update:

ok so I now disabled FIQ in defconfig (CONFIG_HISI_FIQ_DEBUGGER=n) and I got a /dev/ttyAMA6 back. But for some reason I cannot send/receive data from it the way I was used to when I had ttyFIQ0. I guess I’m still missing some configuration for it, somewhere?


#11

I can now succesfully disable the console, but the problem now is the
FIQ debugger, which also outputs on UART1. I can also disable the FIQ
debugger by removing it from the dts, but then the complete
/dev/ttyFIQ0 is gone, too. Is there something I can do to get this
port or an equivalent /dev/ttyXXX back that connects to UART1?

IIRC /dev/ttyFIQ0 is basically a wrapper around the UART polling IO
(similar to /dev/ttyNMI0). Basically there should be something in the DT
describing a console+polling I/O and doing something special to
prevent a full UART driver from being hooked up. Assuming you can find
that you probably just need to copy in something from the other serial
ports.


#12

yeah so once i disabled FIQ, I got ttyAMA6 back. When I send some stuff with echo “somestuff” > /dev/ttyAMA6 I do get a bunch of newlines showing up in my Teensy serial console, so it is kind of working, just requiring some additional configuration. Sending stuff back from Teensy to Hikey also is working a little bit. I have a simple program runing on the Teensy that just echos a number each second. When I try to read that using cat /dev/ttyAMA6 I get a few lines of numbers at once, but then it’s over.