07-20-2020 12:04 PM
NOTE: This is a repost as my previous attempt to post the same question was flagged as SPAM.
Within Vivado, "UART0 Baud Rate" and "UART1 Baud Rate" are both set to 115,200 and I am able to select from a full list of standard baud rates. Looking at my exported XSA, I can find the lines where the baud rate is configured within "topdesign.hwh":
... 8243 <PARAMETER NAME="PCW_GP1_NUM_READ_THREADS" VALUE="4"/> 8244 <PARAMETER NAME="PCW_UART0_BAUD_RATE" VALUE="115200"/> 8245 <PARAMETER NAME="PCW_UART1_BAUD_RATE" VALUE="115200"/> 8246 <PARAMETER NAME="PCW_EN_4K_TIMER" VALUE="0"/> ...
When I build the system, u-boot is correctly configured as 115200, but the device tree, Linux kernel, and Linux user space (i.e. getty) are all configured for 38400.
I can do a "petalinux-config" and navigate to "Subsystem AUTO Hardware Settings--->Serial Settings--->System stdin/stdout baudrate for ps7_uart_1" where I can select a baud rate. However, only 38400 is available. No other options are given.
Looking at the auto generated "project-spec/configs/config" for 2020.1 only 38400 is listed.
47 # 48 # Serial Settings 49 # 50 # CONFIG_SUBSYSTEM_FSBL_SERIAL_PS7_UART_0_SELECT is not set 51 CONFIG_SUBSYSTEM_FSBL_SERIAL_PS7_UART_1_SELECT=y 52 # CONFIG_SUBSYSTEM_FSBL_SERIAL_AXI_UARTLITE_0_SELECT is not set 53 # CONFIG_SUBSYSTEM_FSBL_SERIAL_AXI_UARTLITE_1_SELECT is not set 54 # CONFIG_SUBSYSTEM_FSBL_SERIAL_AXI_UARTLITE_2_SELECT is not set 55 # CONFIG_SUBSYSTEM_FSBL_SERIAL_MANUAL_SELECT is not set 56 # CONFIG_SUBSYSTEM_SERIAL_PS7_UART_0_SELECT is not set 57 CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_SELECT=y 58 # CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_0_SELECT is not set 59 # CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_1_SELECT is not set 60 # CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_2_SELECT is not set 61 # CONFIG_SUBSYSTEM_SERIAL_MANUAL_SELECT is not set 62 CONFIG_SUBSYSTEM_SERIAL_PS7_UART_0_BAUDRATE_38400=y 63 CONFIG_SUBSYSTEM_SERIAL_PS7_UART_1_BAUDRATE_38400=y 64 CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_0_BAUDRATE_38400=y 65 CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_1_BAUDRATE_38400=y 66 CONFIG_SUBSYSTEM_SERIAL_AXI_UARTLITE_2_BAUDRATE_38400=y 67 CONFIG_SUBSYSTEM_SERIAL_FSBL_IP_NAME="ps7_uart_1" 68 CONFIG_SUBSYSTEM_SERIAL_IP_NAME="ps7_uart_1"
As this file is autogenerated, I am not able to edit it.
How do I change the default baudrate in Petalinux 2020.1? This works correctly in 2018.3 (baud rate is 115200 and I can select different baudrates when executing "petalinux-config").
Any help is greatly appreciated,
07-20-2020 04:39 PM
Yea, I see the same thing in my 2020.1 build, except that mine is stuck at 9600 and no options to change. Definitely seem like a bug.
I updated an older project that has a uartlite and somehow the baudrate got changed to 9600. I noticed this in the hwh and though it was quite the coincidence. So I set the baudrate of my uartlite to 115200 in vivado and rebuilt. After importing my xsa to petalinux now my consoles are all 115200.
Try changing your uartlite to 115200. Of course if you need 38400 then you will have to program that after booting or maybe patching the fsbl.
07-21-2020 04:37 AM
Interesting. My implementation uses THREE uartlites, one at 9600, one at 38400, and one at 115200. Unsure if it is a coincidence, but the 38400 uartlite is last in the file. I did a bit of digging and believe "components/misc/config/hw-description/hw-description.tcl" within the petalinux installation directory is the responsible script for generating "Kconfig.syshw" used as part of the petalinux configuration. The method "plnx_gen_conf_serial" was changed between 2019.2 and 2020.1.
I agree this looks like a bug in the generation of Kconfig.sysw.
07-21-2020 05:06 AM
I did a bit of debugging and am now very confident this is a bug within "hw-description.tcl".
Using line numbers from 2020.1, line 519 is a loop for each possible type of serial port. Line 529 is a loop within the previous loop for each instance of that type of serial port. This code is building a list of serial ports to populate in the "Kconfig.syshw" file. The serial port information is appended to a variable "retserials" on line 562.
The issue is pretty basic mistake. On lines 547-552, the variable "baudrates" is set. However, "baudrates" isn't stored within "retserials" on a per port basis similar to other serial data. It is overwritten each time through the loop. It is then used on line 611. Since the baudrate list isn't stored with the serial information, the last baud rate wins and is the ONLY one allowed to be configured.
The code walkthrough matches the behavior that both I and jrhtech observe.
How do we elevate this up to someone at Xilinx?
07-21-2020 06:31 AM
Attached patch stores the baudrates in a dictionary based on the serial port name and references the dictionary when generating the Kconfig.syshw text. It works for me, but may not correctly cover all cases.
Apply to "<project>/build/misc/config/hw-description/hw-description.tcl" for a temporary fix and to test. Apply to "<2020.1 install dir>/components/misc/config/hw-description/hw-description.tcl" for a more permanent fix.
NOTE: I tested by removing "build/misc/config/Kconfig.syshw" and running "petalinux-config --get-hw-description <xsa-dir>".
Hopefully someone from Xilinx can forward this to the proper developer.