06-22-2021 01:01 AM
We have a embedded Linux Zedboard requirement in which it has to communicate with a host program via UART (over USB). I am aware we have a UART-USB port (/dev/ttyACM0) already being used as a console for logs. I'm not sure if I can use this port to our needs (while losing the logging capability for debugging). Is there another UART port available in Zedboard as I can't see any other from the schematics? Never mind for now if it's just UART without USB (which I think can be remedied by an external UART-to-USB converters).
In case there aren't any other ports, and if I have to use /dev/ttyACM0 for our requirement, what is the way to free this up in Linux and move the console to other ports? Logging is important for me as this if for debugging. I'm thinking of SSH.
06-22-2021 02:39 AM
As you say, why don't you connect with the Zedboard via SSH? It is as easy as giving the Zedboard a static IP.
If you don't know how to do it:
Subsystem AUTO Hardware Settings --> Ethernet Settings --> [ ] Obtain IP address automatically (Unselect it).
Then choose the IP and modify your computer ethernet connection to be on the same network.
06-23-2021 06:00 AM
Okay, I found that Zynq has another UART which is uart0. If I can enable it in Linux I will use it instead of losing the existing console uart1.
I tried to enable uart0 in Vivado (I'm using Vivado and Petalinux 2020.1 Linux versions) using Zedboard presets, no other additions like MIO GPIO, and maybe removed some unused pins in Zynq PS IP (in Vivado block diagram) just to make it pass validation. It passed "validate design", generate output, create HDL wrapper, and generate bitstream. After getting the xsa, I used it in petalinux-config --get-hw-description command then petalinux-build, then generate the BOOT.bin. After putting the boot and EXT4 rootfs files to SD, I tested its boot.
During booting however, it always hangs up at around the kernel message saying "random: dd: uninitialized urandom read (512 bytes read)" after it mounted EXT4. This is consistently happening once I add uart0. How is this happening? I am attaching my kernel boot logs, and some dts files.
06-23-2021 06:22 AM
The Zynq-7000 PS has two UART: Uart0 and Uart1.
I don't have the zedboard details on my head, but typically one of them is routed to a UART-USB chip and appears as a USB port.
The other may be routed to a PMOD connector or pin header.
Bear in mind when you configure the PS, you have some freedom to choose the Uart pins:
You can even connect an uart to EMIO pins and route them to normal PL I/O pins.
when you create your FSBL there is an option to which uart to use for the default console. That applies to both bare metal and Linux (there is an additional setting in the petalinux settings as well)
06-23-2021 07:09 AM
Yes, this is what I did in Vivado - enable UART0 and assign it to MIO 14-15 (PmodE). Nothing is connected to any PmodE pin that's why I chose it since it's available. In Zedboard Linux, UART1 is already by default enabled, as this port acts as the console where you can see Linux logs and activity. During its boot (using my Vivado project with uart0 enabled) the log shows both uart has been enabled, then after a while the console log will freeze.
06-23-2021 07:26 AM
With Linux, the FSBL boots first, then hands over to u-boot that will launch the kernel, so there are three sw elements to look at to configure the console uart. And I'm not sure whether the PMU may also have access to it, although you may not care about it. And the baud rate also needs to be the same.
I'm not clear, do you want to boot Linux with a pure Uart on the Pmod instead of the one over USB?
06-23-2021 04:30 PM
The intention is to be able to use uart0 in Linux applications (once boot is over). The default uart - the one over USB - will remain as a console, and I'm not really planning any changes to its status.
06-24-2021 04:47 AM
Linux can see them, based from the logs below:
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0x(ptrval)
e0000000.serial: ttyPS1 at MMIO 0xe0000000 (irq = 24, base_baud = 3125000) is a xuartps
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 25, base_baud = 3125000) is a xuartps
SCSI subsystem initialized.................
But the logs stop coming later on, as if the system boot has frozen. The last message is about random dd initialization. I attached the logs I have.
06-24-2021 06:29 PM
Ok, so what I've found is that the zedboard Linux didn't hang up during the boot, it's the console uart that suddenly has a problem as it stopped sending logs (making it appear the system to be stuck). I enabled static IP and ethernet connection during petalinux-config, and so I can ssh to it which proves the system is not locked up. There is still other issues like why does this happen to uart1 but maybe it warrants a different question thread.