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.

AM5728: Changing console UART

Part Number: AM5728
Other Parts Discussed in Thread: DRA742

Hello,

I am trying to change the default debug console on the AM5728 from UART3 to UART8. I have followed some of the forums that are already on here, but am still having issues with getting the uboot and Linux kernel to boot up the board. I have detailed below the links that I have been following and the code changes that I have made. Please let me know If I am missing something. Thank you!

Links I have been referencing:

https://e2e.ti.com/support/processors/f/791/t/560432 

https://e2e.ti.com/support/processors/f/791/t/485474?AM5728-debug-console 

https://e2e.ti.com/support/processors/f/791/t/556788 

https://e2e.ti.com/support/processors/f/791/t/666062?Linux-AM3351-Changing-debug-UART

Downloaded sdk:

~/ti-processor-sdk-linux-am57xx-evm-06.02.00.81 

Code Changes I made:

Changes in /ti-processor-sdk-linux-am57xx-evm-06.02.00.81/board-support/u-boot-2019.01+gitAUTOINC+a141f7abfd-ga141f7abfd/arch/arm/dts/am57xx-beagle-x15-common.dtsi 


Line 25: Changed uart3 to uart8

chosen {
  stdout-path = &uart8;
 };

Line 395: Changed uart3 to uart8
&uart8 {
	status = "okay";
	interrupts-extended = <&crossbar_mpu GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
			      <&dra7_pmx_core 0x3f8>;
};

Changes in /ti-processor-sdk-linux-am57xx-evm-06.02.00.81/board-support/u-boot-2019.01+gitAUTOINC+a141f7abfd-ga141f7abfd/arch/arm/dts/am57xx-sbc-am57x.dts

Line 25: Commented out UART3 pins and added uart8 pins found in technical reference manual

&dra7_pmx_core {
	uart8_pins_default: uart8_pins_default {
		pinctrl-single,pins = <
			/*DRA7XX_CORE_IOPAD(0x3648, PIN_INPUT_SLEW | MUX_MODE0)*/	/* uart3_rxd */
			/*DRA7XX_CORE_IOPAD(0x364c, PIN_INPUT_SLEW | MUX_MODE0)*/	/* uart3_txd */

			DRA7XX_CORE_IOPAD(0x37d0, PIN_INPUT_SLEW | MUX_MODE2)	/* uart8_rxd */
			DRA7XX_CORE_IOPAD(0x37d4, PIN_INPUT_SLEW | MUX_MODE2)	/* uart8_txd */
		>;
	}; 

Line 82: Changed uart3 to uart8

&uart8 {
	status = "okay";
	interrupts-extended = <&crossbar_mpu GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
			      <&dra7_pmx_core 0x3f8>;

	pinctrl-names = "default";
	pinctrl-0 = <&uart8_pins_default>;
};

Changes in /ti-processor-sdk-linux-am57xx-evm-06.02.00.81/board-support/u-boot-2019.01+gitAUTOINC+a141f7abfd-ga141f7abfd/arch/arm/dts/am57xx-idk-common.dts


Line 17: 
Changed the chosen path from uart3 to uart8

chosen {
		stdout-path = &uart8;
	};

Line 421: Commented out DCAN1 which uses the same pins as uart8

/*&dcan1 {
	status = "okay";
	pinctrl-names = "default", "sleep", "active";
	pinctrl-0 = <&dcan1_pins_sleep>;
	pinctrl-1 = <&dcan1_pins_sleep>;
	pinctrl-2 = <&dcan1_pins_default>;
};*/

Note: The following is only for uboot, I am trying to atleast get the uboot running first, right now I am seeing nothing on the console, it is a custom board, and we have verified that the serial terminal works with other boards.

Please let me know if there are other questions or clarifications

  • Hi Tia,

    what is the dts (dtb) file that you are loading onto your device? I see that you are modifying files related to the BeagleBone-X15 as well as the IDK, however only one of the related/derived final dtb files will get loaded onto the device, so something is wrong here with the approach.

    Also typically there is no need to redefine things like basic module properties such as interrupts in your higher-level dts(i) file. See what is already defined in U-Boot's arch/arm/dts/dra7.dtsi which is indirectly included into any of the AM57xx dtb builds, and you'll see there is a definition for uart8 already there, also with the proper interrupts and other properties.

    All you usually need to do in your top-level dts file (not dtsi file) to get the UART activated for U-Boot to use is

    • Make sure the module is set to status = enabled
    • Make sure proper pinmux is assigned
    • Make sure it's assigned for console use via stdout-path

    If you want to use it for Linux you probably also need to update the CONFIG_BOOTARGS definitions as it is used on AM57xx to allow for a smooth hand-over into Linux.

    It may be beneficial starting with the top-level dts file to understand the include hierarchy for that file in detail.

    Regards, Andreas

  • Thank you for getting back to me.

    The device tree that I am loading is am572x-idk.dts. I went to this file, and went ahead and only changed things in the include files that were included in this file. I made the following changes:

    I first looked at the am57xx_evm_defconfig to make sure the default device tree was correct. 

    CONFIG_DEFAULT_DEVICE_TREE="am572x-idk"

    moving forward I am only changing things in the include files of this device tree

    File: am57xx-idk-common.dtsi

    Changed the chosen path from uart3 to uart 8

    chosen {
    		stdout-path = &uart8;
    	};

    Then I added the following code into the same file:

    &dra7_pmx_core {
    	uart8_pins_default: uart8_pins_default {
    		pinctrl-single,pins = <
    			DRA7XX_CORE_IOPAD(0x37d4, PIN_OUTPUT_PULLUP | MUX_MODE2) /* uart8_tx */
    			DRA7XX_CORE_IOPAD(0x37d0, PIN_INPUT_PULLUP | MUX_MODE2) /* uart8_rx */
    		>;
    	};
    
    };
    
    &uart8{
    	pinctrl-names="default";
    	pinctrl-0=<&uart8_pins_default>;
    	status = "okay";
    };

    I didn't change anything, simply added the code snippet above. 

    In CONFIG_BOOTARGS I changed the console from ttyS2 to ttyS7 for uart8

    I am still not seeing anything booting up on the console, any ideas what it could be? 

  • Hi Tia,

    It probably doesn't work because uart8 is not clocked by default (you could easily confirm this with JTAG).

    Can you execute the below search query on your U-Boot tree, looking for the clock configuration/enable register for uart3. You would need to introduce something just like that for uart8 in the omap5/dra7-specifc files and structures that search yields.

    $ git grep -C 10 cm_l4per_uart3_clkctrl

    As a quick and dirty hack (for testing!) you could probably just update/replace the base address used for uart3 to the one needed for uart8 in the dra7xx_prcm structure defined here:

    arch/arm/mach-omap2/omap5/prcm-regs.c:  .cm_l4per_uart3_clkctrl                 = 0x4a009850,

    as per TRM the address for CM_L4PER2_UART8_CLKCTRL would be 0x4A00 98E0.

    Can you experiment with that and report back.

    Regards, Andreas

  • Hi Andreas,

    So I went ahead and changed the base address as you suggested, 

    File: /ti-processor-sdk-linux-am57xx-evm-06.02.00.81/board-support/u-boot-2019.01+gitAUTOINC+a141f7abfd-ga141f7abfd/arch/arm/mach-omap2/omap5/prcm-regs.

    .cm_l4per_uart3_clkctrl			= 0x4a0098E0,

     

    I still don't see anything on the console. In dra7.dtsi under the uart8 node it says compatible with dra742 and omap4-uart, however this change I made is in the omap5 uart, do you think that could make a difference?

  • Hi Tia,

    Tia Basak said:
    I still don't see anything on the console. In dra7.dtsi under the uart8 node it says compatible with dra742 and omap4-uart, however this change I made is in the omap5 uart, do you think that could make a difference?

    You need to update this structure here:

    struct prcm_regs const dra7xx_prcm = {
            /* cm1.ckgen */
            .cm_clksel_core                         = 0x4a005100,
            .cm_clksel_abe                          = 0x4a005108,
            .cm_dll_ctrl                            = 0x4a005110,
            .cm_clkmode_dpll_core                   = 0x4a005120,
    <...snip...>
            .cm_l4per_uart3_clkctrl                 = 0x4a009850,
    ...

    You see it is getting referenced by the AM57xx board file here, basically telling you this is the right structure to modify:

    $ git grep -C 10 dra7xx_prcm board/ti/am57xx/
    board/ti/am57xx/board.c-        if (board_is_am572x_idk() || board_is_am574x_idk())
    board/ti/am57xx/board.c-                *omap_vcores = &am572x_idk_volts;
    board/ti/am57xx/board.c-        else if (board_is_am571x_idk())
    board/ti/am57xx/board.c-                *omap_vcores = &am571x_idk_volts;
    board/ti/am57xx/board.c-        else
    board/ti/am57xx/board.c-                *omap_vcores = &beagle_x15_volts;
    board/ti/am57xx/board.c-}
    board/ti/am57xx/board.c-
    board/ti/am57xx/board.c-void hw_data_init(void)
    board/ti/am57xx/board.c-{
    board/ti/am57xx/board.c:        *prcm = &dra7xx_prcm;
    board/ti/am57xx/board.c-        if (is_dra72x())
    board/ti/am57xx/board.c-                *dplls_data = &dra72x_dplls;
    board/ti/am57xx/board.c-        else if (is_dra76x())
    board/ti/am57xx/board.c-                *dplls_data = &dra76x_dplls;
    board/ti/am57xx/board.c-        else
    board/ti/am57xx/board.c-                *dplls_data = &dra7xx_dplls;
    board/ti/am57xx/board.c-        *ctrl = &dra7xx_ctrl;
    board/ti/am57xx/board.c-}
    board/ti/am57xx/board.c-
    board/ti/am57xx/board.c-bool am571x_idk_needs_lcd(void)
    

    If you still can't get it to work please use JTAG to do some basic debugging, maybe your system hangs/doesn't work for reasons not even related to UART...

    Regards, Andreas

  • Hi,

    I am currently working on getting the JTAG working, and I can provide more debug information. In the meanwhile, I wanted to ask a question, I was in the menuconfig, and noticed that when you go to Device Drivers -> Serial drivers, the following screen pops up.

    When I try to change the UART used for console to 8, it says invalid number, the highest value that I can seem to change it to is 6. Will that be an issue, if I am trying to change the debug console to UART 8? If this is not relevant please let me know.

  • Hi Tia,

    Tia Basak said:
    When I try to change the UART used for console to 8, it says invalid number, the highest value that I can seem to change it to is 6.

    This mechanism (the underlying parameter is CONFIG_CONS_INDEX) is not used on AM57xx devices so you can ignore that. The UART gets selected via DTS entry.

    Also on AM57xx devices the pin mux is actually not controlled via DTS, but through a board file containing pinmux data, see board/ti/am57xx/mux_data.h. Can you have a look at this file and see how the different structures are being used (depending on the board that is detected). You can re-generate this pinmux structure using the pinmux tool available at: http://www.ti.com/tool/PINMUXTOOL  Make sure the relevant configurations for UART8 are in place.

    Regards, Andreas

  • Hello, 

    So using the pinmux tool, I was able to change dcan1, which is what uart8 is muxed to, to the correct mode. The correct mode for pins G19 and G20 is muxmode 2. I still see nothing in the console, is this correct? I changed the following:

    const struct pad_conf_entry core_padconf_array_essential_x15[] = {
    

    const struct pad_conf_entry core_padconf_array_essential_am572x_idk[] = {

  • Why are you changing two different structures?
    If you look at the board-specific code only one of them is used.
    Try instrumenting that if(){} statements with printf() to see which statement you are actually executing...

    a0797059@jiji:~/git/u-boot (ti-u-boot-2019.01-next-dev)
    $ git grep -B 5 -A 35 core_padconf_array_essential_am572x_idk board/ti/am57xx/board.c
    board/ti/am57xx/board.c-        const struct iodelay_cfg_entry *iod, *delta_iod;
    board/ti/am57xx/board.c-        int pconf_sz, iod_sz, delta_iod_sz = 0;
    board/ti/am57xx/board.c-        int ret;
    board/ti/am57xx/board.c-
    board/ti/am57xx/board.c-        if (board_is_am572x_idk()) {
    board/ti/am57xx/board.c:                pconf = core_padconf_array_essential_am572x_idk;
    board/ti/am57xx/board.c:                pconf_sz = ARRAY_SIZE(core_padconf_array_essential_am572x_idk);
    board/ti/am57xx/board.c-                iod = iodelay_cfg_array_am572x_idk;
    board/ti/am57xx/board.c-                iod_sz = ARRAY_SIZE(iodelay_cfg_array_am572x_idk);
    board/ti/am57xx/board.c-        } else if (board_is_am574x_idk()) {
    board/ti/am57xx/board.c-                pconf = core_padconf_array_essential_am574x_idk;
    board/ti/am57xx/board.c-                pconf_sz = ARRAY_SIZE(core_padconf_array_essential_am574x_idk);
    board/ti/am57xx/board.c-                iod = iodelay_cfg_array_am574x_idk;
    board/ti/am57xx/board.c-                iod_sz = ARRAY_SIZE(iodelay_cfg_array_am574x_idk);
    board/ti/am57xx/board.c-        } else if (board_is_am571x_idk()) {
    board/ti/am57xx/board.c-                pconf = core_padconf_array_essential_am571x_idk;
    board/ti/am57xx/board.c-                pconf_sz = ARRAY_SIZE(core_padconf_array_essential_am571x_idk);
    board/ti/am57xx/board.c-                iod = iodelay_cfg_array_am571x_idk;
    board/ti/am57xx/board.c-                iod_sz = ARRAY_SIZE(iodelay_cfg_array_am571x_idk);
    board/ti/am57xx/board.c-        } else if (board_is_bbai()) {
    board/ti/am57xx/board.c-                pconf = core_padconf_array_essential_bbai;
    board/ti/am57xx/board.c-                pconf_sz = ARRAY_SIZE(core_padconf_array_essential_bbai);
    board/ti/am57xx/board.c-                iod = iodelay_cfg_array_bbai;
    board/ti/am57xx/board.c-                iod_sz = ARRAY_SIZE(iodelay_cfg_array_bbai);
    board/ti/am57xx/board.c-        } else {
    board/ti/am57xx/board.c-                /* Common for X15/GPEVM */
    board/ti/am57xx/board.c-                pconf = core_padconf_array_essential_x15;
    board/ti/am57xx/board.c-                pconf_sz = ARRAY_SIZE(core_padconf_array_essential_x15);
    board/ti/am57xx/board.c-                /* There never was an SR1.0 X15.. So.. */
    board/ti/am57xx/board.c-                if (omap_revision() == DRA752_ES1_1) {
    board/ti/am57xx/board.c-                        iod = iodelay_cfg_array_x15_sr1_1;
    board/ti/am57xx/board.c-                        iod_sz = ARRAY_SIZE(iodelay_cfg_array_x15_sr1_1);
    board/ti/am57xx/board.c-                } else {
    board/ti/am57xx/board.c-                        /* Since full production should switch to SR2.0  */
    board/ti/am57xx/board.c-                        iod = iodelay_cfg_array_x15_sr2_0;
    board/ti/am57xx/board.c-                        iod_sz = ARRAY_SIZE(iodelay_cfg_array_x15_sr2_0);
    board/ti/am57xx/board.c-                }
    board/ti/am57xx/board.c-        }
    board/ti/am57xx/board.c-
    board/ti/am57xx/board.c-        /* Setup I/O isolation */
    board/ti/am57xx/board.c-        ret = __recalibrate_iodelay_start();
    board/ti/am57xx/board.c-        if (ret)

    Regards, Andreas

  • Hello,

    I was able to resolve the u-boot issue by applying the patch that I have linked below. And adding the correct pinmux from above. I also removed all dcan1 nodes that are muxed to uart8.

    git patch:

    https://e2e.ti.com/support/processors/f/791/p/738108/2726354?cm_session=6c143d9a-ff95-4978-8824-9e795bb41c62&cm_type=link&cm_link=f5318652-e8e3-4c57-91f0-11de16c09fb4&utm_campaign=6c143d9a-ff95-4978-8824-9e795bb41c62&utm_medium=email&utm_source=contactmonkey&utm_content=sales%201%3a1&utm_term=RE%3a+Help+Booting+up+TI+Sitara+AM5728#2726354

    i am now having trouble with the linux kernel, trying to get that switch to uart8. So far I have changed the chosen path as I did in u-boot. any insight on what else I need? is there a clock that is missing?

    Thanks,

    Tia

  • Tia,

    nice, thanks for closing the loop and sharing your solution for U-Boot.

    As for the Kernel, when you look at the top-level DTS file for one of our AM57xx boards (/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi) that uses uart3 you also find this:

    &uart3 {
    	status = "okay";
    	interrupts-extended = <&crossbar_mpu GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>,
    			      <&dra7_pmx_core 0x3f8>;
    };

    Chances are you are missing an equivalent declaration for uart8.

    Regards, Andreas

  • Yes I did add those nodes, I started another thread that details all the changes. 

    https://e2e.ti.com/support/processors/f/791/t/884173

    Thanks,

    Tia