I have a PlutoSDR that I am using for a non-standard application. My use-case requires additional UART opened on the PS CPU of the Xilinx FPGA which will be used to enable external control of the PlutoSDR and code running within it over serial commands. I am using the expansion port of PlutoSDR to route-out signals from the CPU via EMIO. So far, I was not able to boot Linux or have uart0 working. By default, PlutoSDR uses uart1 for Linux terminal and uart0 is disabled and not used. My procedure for enabling UART0 is as follows:
1. Modify `system_bd.tcl` as follows to enable UART0 via EMIO:
# Add these two statements where all ports are defined create_bd_port -dir O uart0_tx create_bd_port -dir I uart0_rx # Add these two statements where configuration is set: ad_ip_parameter sys_ps7 CONFIG.PCW_UART0_PERIPHERAL_ENABLE 1 ad_ip_parameter sys_ps7 CONFIG.PCW_UART0_UART0_IO EMIO # Add these two statements where connections are made ad_connect uart0_rx sys_ps7/UART0_rx ad_connect uart0_tx sys_ps7/UART0_tx
2. Modify `system_constr.xdc` and `system_top.v` to route newly created `uart0_tx/uart0_rx` lines to K13/M12 pins of expansion header. Previous SPI, I2C and other peripherals were removed.
3. Modified both U-boot and Linux DeviceTrees with the following:
// Adding uart0 to Aliases
aliases: aliases {
ethernet0 = &gem0;
serial0 = &uart1;
serial1 = &uart0;
};
// Enabling uart0
&uart0 {
status="okay";
};
4. Re-build, flash (unlocked bootloader of course), validate that correct values are set for UART0 registers from U-Boot.
5. Attempt to boot Linux (ramboot, qspiboot, does not matter). And this is where it all falls apart. If I boot with default, settings, I get this log message and then no more response from UART:
e0000000.serial: ttyPS0 at MMIO 0xe0000000 (irq = 27, base_baud = 6249999) is a xuartps printk: console [ttyPS0] enabled printk: bootconsole [earlycon0] disabled
This is not what I would expect, since ttyPS0 should be on 0xe0001000, as is specified in devicetree. Probing the UART0 lines, I can see that TX line gets pulled up once FPGA bitstream loads and then spews out repeating garbage after the boot log is displayed. Looking at LED, I can see that boot proceeds forwards, except that I can not interact with the board over any UART.
My initial attempt was to change boot serial port to ttyPS1 via kernel command line, but that fails differently:
e0000000.serial: ttyPS0 at MMIO 0xe0000000 (irq = 27, base_baud = 6249999) is a xuartps xuartps e0001000.serial: uart_add_one_port() failed; err=-22
Now, board is hung, does not complete its boot up.
I have managed to narrow down, that as soon as I mark `UART0` as enabled in device tree, all problems start to appear. Has any one encountered something similar or have any information in regards to getting uart0 working on PlutoSDR? I am starting to go bald from this issue.
As additional troubleshooting/debugging steps, I tried:
1. Adding SPI pehipheral on PS CPU over EMIO to validate my changes and processes - SPI Works, but this is not what I need.
2. Adding UART over AXI bus - could not get it to work, system boots fine, but hangs as soon as I try to interact with the peripheral. This is probably a different quest tree I have to resolve to get it working.
3. Mucking around with device tree, changing serial port order, messing with boot params - always same result as described above.
4. Rolling back versions of xuartps driver to older ones - always fails, haven't found a working version.
5. Messing around with CONFIG_DEBUG_ZYNQ_UART<0/1> - no change, always the same failure.