This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6422: How to use main uart1 as R5 debug serial

Part Number: AM6422

Tool/software:

Hi TI experts,

Below are my debug environment,

Hardware: customized board based on AM6422

Software: A53 runs rt linux based on SDK 09.02

                R5 runs RTOS based on MCU SDK 09.02

When I used uboot2021 to bootup, I can get the R5 debug logs on MAIN UART1.

When I used uboot2023 to bootup, I can not get R5 debug logs on MAIN UART1. But I'm sure that R5 is running, because I can see the R5 debug logs under the /sys/kernel/debug/remoteproc/remoteproc0/trace0.

The both version of uboot all keeps below configures in dts,

/* main_uart1 is reserved for firmware usage */
&main_uart1 {
	status = "reserved";
};

Both version of uboot disabled the TISCI debug trace. In uboot2021, disabled the TISCI trace debug with not define ENABLE_TRACE in board-cfg.c. In uboot2023, disabled the TISCI trace in board-cfg.yaml with trace_dst_enables : 0x00 .

And the linux kernel dts,

&main_uart1 {
	status = "disabled";

	pinctrl-names = "default";
	pinctrl-0 = <&main_uart1_pins_default>;

	rs485-rts-active-low;
	rs485-rx-during-tx;
	rs485-rts-delay = <1 0>;
	linux,rs485-enabled-at-boot-time;
};

The R5 .syscfg about MAIN UART1 is like below,

I don't know why the uboot2021 works, but uboot2023 does not work. Please help to give some suggestions, thank you!

BR

xixiguohx

  • Hi,

    If the question is more on why the UART1 logs do not come on the COM PORT Terminal then I would suggest you to look at the correct UART which you would use.

    Please refer: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1276094/faq-sk-am62-purpose-of-different-uarts

    If you are referring the correct COM PORT, then I would let another expert look into this and comment further. The MCU PLUS SDK side of things look okay to me.

    Please allow the other expert some time to comment on this query.

    Thanks for your patience.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    Thank you!

    Because I need to debug both on A53 and R5, so I keep UART0 for A53 debug and want to use UART1 for R5 debug. I think I used the correct UART, because these work with uboot2021, I don't know why it does not work on uboot2023.

    Thanks for help asking other experts, looking forward for their reply.

    BR

    xixiguo

     

  • Hi Xixiguo,

    What are the exact software difference in both of your use case with U-Boot 2021 and U-Boot 2023? only the 3 U-Boot binaries are different but the reset of software, such as Linux and RTOS binaries are all the same?

  • Hi Bin,

    Yes, only the 3 U-boot binaries are different. The Linux and RTOS binaries are all the same, and I used power down to restart the board.

    BR

    xixiguo

  • Hi xixiguo,

    I cannot think of any reason which would cause the problem. Can you please check the padconfig registers of the UART1 TXD/RXD pins in both cases if they are still the same?

  • Hi Bin,

    In the kernel dts, we have disabled the pins mode configure, and disabled MAIN_UART1 like bellow,

        main_uart1_pins_default: main-uart1-pins-default {
    		pinctrl-single,pins = <
    			/* AM64X_IOPAD(0x024c, PIN_OUTPUT, 7) /* (E16) UART1_485_DIR GPIO1.59*/
                /* AM64X_IOPAD(0x0240, PIN_INPUT, 0)  /* (E15) UART1_RXD */
    			/* AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */
                /* AM64X_IOPAD(0x017c, PIN_INPUT, 7)  /* (T1) UART1_485_Error GPIO1.7*/
    		>;
    	};
    	
    &main_uart1 {
    	status = "disabled";
    
    	pinctrl-names = "default";
    	pinctrl-0 = <&main_uart1_pins_default>;
    
    	rs485-rts-active-low;
    	rs485-rx-during-tx;
    	rs485-rts-delay = <1 0>;
    	linux,rs485-enabled-at-boot-time;
    };
    

    So I think the R5 firmware take care of the MAIN UART1 pins configure in example.syscfg like bellow,

    And I think it's correct, because uboot2021 works with these configures.

    I'm really confused too. And I checked after the system started, the 0xF4240 and 0xF4244 values are,

    root:~# devmem2 0xF4240
    /dev/mem opened.
    Memory mapped at address 0xffff8dc98000.
    Read at address  0x000F4240 (0xffff8dc98240): 0x00050000
    root:~# devmem2 0xF4244
    /dev/mem opened.
    Memory mapped at address 0xffff7f7a2000.
    Read at address  0x000F4244 (0xffff7f7a2244): 0x00010000

    Using uboot2021 or uboot2023 to bootup, the registers values are the same as above.

    Is there any difference in uboot2021 and uboot2023 about the status = "reserved"

    BR

    xixiguo

  • The devicetree handling for status property has always been the same.

  • Hi Bin,

    I'm sorry for the late reply due to the May Day holiday. I'm pretty sure that's because of the u-boot, but don't know the exactly where caused this. 

    BR

    xixiguo

  • Hi Xixiguo,

    No worries. Hope you had a great holiday break.

    In theory, as long as the UART is initialized and the pin padconfig are programmed properly (which your devmem2 output should they are on your board), any program from any core could transmit characters to the UART port. I cannot think go any reason why different U-Boot would affect the MCU R5 program.

    I am looping in our IPC expert for any input.

  • Hello Xixiguo,

    How are the R5F cores being initialized? With Linux remoteproc driver during kernel boot? With u-boot rproc driver? during SBL boot, if you're using that instead of SPL boot?

    Could I get you to post the trace logs you see for the core in working and non-working usecases? If this is a resource conflict where Linux or uboot is grabbing ownership of the UART1 before the R5F can request ownership, I usually see the R5F code get stuck during driver initialization in the main.c file. So it is pretty easy to drop a bunch of print statements in the R5F firmware and see how far the R5F code gets.

    Regards,

    Nick

  • Hi Nick,

    The R5F core is initialized with Linux remoteproc driver during kernel boot.

    Of course, I have sent you the logs by private messages, thank you!

    BR

    xixiguo

  • Hello Xixiguo,

    Ok, so based on your logs it seems like the R5F RTOS drivers are getting loaded without any resource conflicts showing up. So it tentatively seems like no resource conflicts. I assume that on your UART terminal you see the same output as the Linux trace log. That also shows us that the R5F cores are actually loaded and running, and not just stalled out somewhere.

    Bin already validated that the pinmuxing looks fine.

    Those are the immediately obvious things I would want to check...

    The next thing that would occur to me would be to verify the devicetree file settings that are actually getting applied on the board. I know that MCU+ R5F will complain if Linux has already grabbed ownership of a peripheral, but I am not sure what Linux would do if a Linux driver tried to grab a peripheral that was already owned by an MCU+ core. Let us know if you need guidance on how to check that.

    Regards,

    Nick

  • Hi Nick,

    Yes, please help to give the guidance to check if a Linux driver tried to grab a peripheral that was already owned by an MCU+ core.

    Below is the tty info on my board,

    root@xxx:~# dmesg | grep -i uart
    root@xxx:~# ls -l /sys/class/tty/
    lrwxrwxrwx    1 root     root             0 Dec 10 21:54 console -> ../../devices/virtual/tty/console
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptmx -> ../../devices/virtual/tty/ptmx
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp0 -> ../../devices/virtual/tty/ptyp0
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp1 -> ../../devices/virtual/tty/ptyp1
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp2 -> ../../devices/virtual/tty/ptyp2
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp3 -> ../../devices/virtual/tty/ptyp3
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp4 -> ../../devices/virtual/tty/ptyp4
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp5 -> ../../devices/virtual/tty/ptyp5
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp6 -> ../../devices/virtual/tty/ptyp6
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp7 -> ../../devices/virtual/tty/ptyp7
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp8 -> ../../devices/virtual/tty/ptyp8
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptyp9 -> ../../devices/virtual/tty/ptyp9
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptypa -> ../../devices/virtual/tty/ptypa
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptypb -> ../../devices/virtual/tty/ptypb
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptypc -> ../../devices/virtual/tty/ptypc
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptypd -> ../../devices/virtual/tty/ptypd
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptype -> ../../devices/virtual/tty/ptype
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ptypf -> ../../devices/virtual/tty/ptypf
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty -> ../../devices/virtual/tty/tty
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty0 -> ../../devices/virtual/tty/tty0
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty1 -> ../../devices/virtual/tty/tty1
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty10 -> ../../devices/virtual/tty/tty10
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty11 -> ../../devices/virtual/tty/tty11
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty12 -> ../../devices/virtual/tty/tty12
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty13 -> ../../devices/virtual/tty/tty13
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty14 -> ../../devices/virtual/tty/tty14
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty15 -> ../../devices/virtual/tty/tty15
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty16 -> ../../devices/virtual/tty/tty16
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty17 -> ../../devices/virtual/tty/tty17
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty18 -> ../../devices/virtual/tty/tty18
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty19 -> ../../devices/virtual/tty/tty19
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty2 -> ../../devices/virtual/tty/tty2
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty20 -> ../../devices/virtual/tty/tty20
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty21 -> ../../devices/virtual/tty/tty21
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty22 -> ../../devices/virtual/tty/tty22
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty23 -> ../../devices/virtual/tty/tty23
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty24 -> ../../devices/virtual/tty/tty24
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty25 -> ../../devices/virtual/tty/tty25
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty26 -> ../../devices/virtual/tty/tty26
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty27 -> ../../devices/virtual/tty/tty27
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty28 -> ../../devices/virtual/tty/tty28
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty29 -> ../../devices/virtual/tty/tty29
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty3 -> ../../devices/virtual/tty/tty3
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty30 -> ../../devices/virtual/tty/tty30
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty31 -> ../../devices/virtual/tty/tty31
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty32 -> ../../devices/virtual/tty/tty32
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty33 -> ../../devices/virtual/tty/tty33
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty34 -> ../../devices/virtual/tty/tty34
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty35 -> ../../devices/virtual/tty/tty35
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty36 -> ../../devices/virtual/tty/tty36
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty37 -> ../../devices/virtual/tty/tty37
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty38 -> ../../devices/virtual/tty/tty38
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty39 -> ../../devices/virtual/tty/tty39
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty4 -> ../../devices/virtual/tty/tty4
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty40 -> ../../devices/virtual/tty/tty40
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty41 -> ../../devices/virtual/tty/tty41
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty42 -> ../../devices/virtual/tty/tty42
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty43 -> ../../devices/virtual/tty/tty43
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty44 -> ../../devices/virtual/tty/tty44
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty45 -> ../../devices/virtual/tty/tty45
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty46 -> ../../devices/virtual/tty/tty46
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty47 -> ../../devices/virtual/tty/tty47
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty48 -> ../../devices/virtual/tty/tty48
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty49 -> ../../devices/virtual/tty/tty49
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty5 -> ../../devices/virtual/tty/tty5
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty50 -> ../../devices/virtual/tty/tty50
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty51 -> ../../devices/virtual/tty/tty51
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty52 -> ../../devices/virtual/tty/tty52
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty53 -> ../../devices/virtual/tty/tty53
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty54 -> ../../devices/virtual/tty/tty54
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty55 -> ../../devices/virtual/tty/tty55
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty56 -> ../../devices/virtual/tty/tty56
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty57 -> ../../devices/virtual/tty/tty57
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty58 -> ../../devices/virtual/tty/tty58
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty59 -> ../../devices/virtual/tty/tty59
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty6 -> ../../devices/virtual/tty/tty6
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty60 -> ../../devices/virtual/tty/tty60
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty61 -> ../../devices/virtual/tty/tty61
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty62 -> ../../devices/virtual/tty/tty62
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty63 -> ../../devices/virtual/tty/tty63
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty7 -> ../../devices/virtual/tty/tty7
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty8 -> ../../devices/virtual/tty/tty8
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 tty9 -> ../../devices/virtual/tty/tty9
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyS0 -> ../../devices/platform/bus@f4000/2820000.serial/tty/ttyS0
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyS1 -> ../../devices/platform/serial8250/tty/ttyS1
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyS2 -> ../../devices/platform/bus@f4000/2800000.serial/tty/ttyS2
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyS3 -> ../../devices/platform/serial8250/tty/ttyS3
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp0 -> ../../devices/virtual/tty/ttyp0
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp1 -> ../../devices/virtual/tty/ttyp1
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp2 -> ../../devices/virtual/tty/ttyp2
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp3 -> ../../devices/virtual/tty/ttyp3
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp4 -> ../../devices/virtual/tty/ttyp4
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp5 -> ../../devices/virtual/tty/ttyp5
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp6 -> ../../devices/virtual/tty/ttyp6
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp7 -> ../../devices/virtual/tty/ttyp7
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp8 -> ../../devices/virtual/tty/ttyp8
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttyp9 -> ../../devices/virtual/tty/ttyp9
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttypa -> ../../devices/virtual/tty/ttypa
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttypb -> ../../devices/virtual/tty/ttypb
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttypc -> ../../devices/virtual/tty/ttypc
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttypd -> ../../devices/virtual/tty/ttypd
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttype -> ../../devices/virtual/tty/ttype
    lrwxrwxrwx    1 root     root             0 Dec 10 21:55 ttypf -> ../../devices/virtual/tty/ttypf
    root@xxx:/sys/firmware/devicetree/base/bus@f4000/serial@2810000# cat status 
    reserved

    BR

    xixiguo

  • Hi Xixiguo,

    I don't expect Linux would be a problem, since you said the only software change is the u-boot binaries. But anyway, please attach the full Linux boot log with uboot2023.

  • Hi Bin,

    I have sent the logs to you by private message, thank you!

    BR

    xixiguo

  • Hi Xixiguo,

    Thanks for providing the logs. I didn't see anything obviously wrong which could lead to this main uart1 problem, but the log shows you use U-Boot 2023.10, which is not a supported version by Processor SDK. Can you please use U-Boot 2023.04 which is provided in SDK9.02 to see if the problem still happens?

  • Hi Bin,

    I will try it, but it will take sometime to do the transplant based on our board. Later when I finish it, I will let you know here, thank you!

    BR

    xixiguo