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.

U-Boot Redirecting console

Guru 20755 points

Other Parts Discussed in Thread: OMAP-L138, AM1808


Hello,

I am using OMAP-L138 board with psp 3.21.0.04 in which  U-boot console is by default directed to UART2 , and I am tring to rediect console, I tried 2 options but both do not work as I expected: 

1)
I tried to change it so that the console from serial UART2 to UART1. What I did is changing in 

include/configs/da850evm.h:
#define CONFIG_SYS_NS16550_COM1 DAVINCI_UART1_BASE
but I then see nothing in UART1 output. I know that uart1 works, becuase if I try to send characters through it it all works well.
Could it be that UART1 is set to different baudrate (not 115200) as I expect ? Maybe it got to do with the UBL which configure UART2 as console ?

2)
I also tried to redirect console to ethernet by doing the following after phy initialization in uboot
run_command("setenv stdout nc; setenv stdin nc");
I did not forget to define ncip: ncip = 192.168.3.10
I then see that only if the ethernet cable is connected to the pc (which ip is ncip) then u-boot executes bootcmd and the kernel starts to run. I am also able to see prints with netconsole with this ethernet connection.
BUT If the ethernet cable is not connected then the kernel does not start running. I dont know where the u-boot stoped (becuase there is no connection for the printings), but I have led which indicate that the u-boot did not execute the bootcmd.

It is also worth noting that the UBL i'm using is from older psp 3.20.00.11. (I upgraded the u-boot and kernel but did not try to upgrade the UBL)
Any Advice is welcomed,
Ran
  • You need to change a few things in your board file, board/davinci/da8xxevm/da850evm.c. See uart_pins, DAVINCI_LPSC_UART2 and davinci_uart2_ctrl_regs->pwremu_mgmt. You might need to add UART1 definitions to arch/arm/include/asm/arch-davinci/hardware.h.

  • Hi Norman, I've already done all this but it does not work as I expected: 1. when I load my new version and start running it with "go" command, It works , but: 2. if I flash the new version and run it, I see no print in UART1. Might it be that the order of things I do is not correct ? Maybe I do the redirect before the doing the pinmux / pwm ? Regards, Ran
  • I also checked the order of the initilizations: I see in board.c that board_init where all pinmux, pwm initlization is done, is before serial_init, board_init. I still dont understand why when loading the new version in tftp all works, but with flashing it does not work. Ran
  • Not sure it it's safe to launch a modified version of u-boot from the u-boot itself. I am surprised it works. Since it does work, I would guess that the first u-boot is initializing something that the UBL is not. I can't think of what that could be.

    Looking at board/davinci/da8xxevm/da850evm.c, substituting uart1 for uart2 should cover most changes. I think the pinmux should be

    static const struct pinmux_config uart_pins[] = {
        { pinmux(0), 4, 4 }, /* UART1_RTS <-- This will conflict with NOR and MMC options. */
        { pinmux(0), 4, 5 }, /* UART1_CTS */
        { pinmux(4), 2, 6 }, /* UART1_RXD */
        { pinmux(4), 2, 7 }  /* UART1_TXD */
    };

    MIght be better not to use RTS and CTS.

  • I am also planning to change the u-boot console UART to UART1.

    As a first step i tried to load the existing u-boot.bin that comes with psp03.20.00.14 to memory and run using "go" command.

    But it stopped after printing the below lines:

    U-Boot 2009.01 (Sep 17 2009 - 17:41:56)

    U-Boot 2009.01 (Sep 17 2009 - 17:41:56)

    Note, I have not changed anything yet. This is the default u-boot.bin image. I was just trying to first setup a reliable way to test it before flash.

    Any help is highly appreciated.

  • I was mistaken, it is UART0 to which I try to redirect the console..

    About the modified version it is compiled and loaded to 0xc3080000 while the flashed version is compiled and loaded to 0xc1080000. there is no problem working this way as far as I know.
    when doing the following serialization then UART0 console works as needed (I see prints in terminal 115200):  

    1. UBL
    2. flashed U-boot compiled to use UART2 as console
    3. then loading and running  U-boot compiled to use UART0 as console

    when doing the following serialization, then there are no print in the terminal connected to UART0 (I tried 115200 and 9600, nothing in both)

    1. UBL
    2. flashed U-boot compiled to use UART0 as console (same as in 3. in the previous serialization)

    I have checked several times what are the changes between the version using UART0 as console and the other using UART2 as console.
    the only change I can notice and familiar with is in the following defintion 

    #define CONFIG_SYS_NS16550_COM1 DAVINCI_UART0_BASE    (for the U-boot using UART0 as console)
    instead of :
    #define CONFIG_SYS_NS16550_COM1 DAVINCI_UART2_BASE     (for the U-boot using UART2 as console)
    other definitions I'm using are:
    #define CONFIG_SYS_NS16550_CLK  clk_get(DAVINCI_UART2_CLKID)
    #define CONFIG_CONS_INDEX       1               /* use UART0 for console */
    #define CONFIG_BAUDRATE         115200          /* Default baud rate */
    #define CONFIG_SYS_BAUDRATE_TABLE       { 9600, 19200, 38400, 57600, 115200 }
    in board_init() I declare pinmux for the following UARTS in the following order:
    UART0
    UART1
    UART2
    * I am not declaring RTS, CTS pinmux only TX,RX.
    Could it be that there should be more timeout between board_init to serial_init for UART0 ?
    Regards,
    Ran

     

  • Hi Shameer,

    Are you using the custom board ? the u-boot.bin you are trying to use is appropriate for the custom board. I also think that it should be used only by flashing (to address 0xc1080000).

    You can try also to compile the u-boot package.

    I compiled it to load to addres 0xc3080000 and then I am using the following command:

    go 0xc3080044

    Best Regards,

    Ran

  • This won't solve the "go" vs "flashed" mystery. What is your network config options? It you don't have an RMII interface, the pinmux for EMAC will over write the pinmux for UART0.

  • I have an RMII interface, and as far as I know (and checked) there is no conflicts in the pinmux configuration. The UBL only initialize UART2, maybe that is the problem ?
  • I vaguely remember that I moved U-Boot' console without touching the UBL. But then it was quite a while ago. Looking more deeply into the U-Boot code, I think pwm and pinmux config in the board_init() function might occur too late. A lot of stuff in arch/arm/lib/board.c runs before board_init(). You might not get the U-Boot banner but you should get the U-Boot prompt. Have you tried inputing a few keys into UART0 to see if the U-Boot command prompt comes up? Getting UBL to init UART0 might be the fix. To init early in U-Boot, I am guessing you'd have to implement a board_early_init_f() function. I'm out of ideas.

  • Hi Ran,

    I compiled both u-boot psp03.20.00.13/psp03.20.00.14 packages and placed the u-boot.bin in the boot directory. This is a Zoom OMAP-L138 EVM board. Issued the following commands from u-boot console to test the newly built u-boot.bin, but still doesnt work.

    U-Boot >  tftp 0xc3080000 u-boot.bin
     Using  device
     TFTP from server 192.168.5.210; our IP address is 192.168.5.209
     Filename 'u-boot.bin'.
     Load address: 0xc3080000
     Loading: ##################################
     done
     Bytes transferred = 171500 (29dec hex)
    U-Boot >  go 0xc3080044
    ## Starting application at 0xC3080044 ...


    U-Boot 2009.01 (Sep 17 2009 - 17:41:56)

    It hangs here....

    Thanks,

    Shameer

  • did you compile \board\davinci\da8xxevm\config.mk with TEXT_BASE = 0xC3080000 ?

  • Many Thanks Ran, that was the missing link. It is working now. Now going for the UART mods.

  • Thanks Norman for the ideas, I will try them as soon as possible. changing the UBL is a bit less convenient. It is still a mystery to me why the modified version works when it is done after the flashed version and not when it run from flash. It could mean that there is maybe some register initialization which is done OK when the flashed version runs before the modified version run, or maybe some initialization is done soon enough for it to be ready when needed. I still don't see what it is because the code changes between versions is only in one definition in h. file (YYY_COM1). I will update if I get something.
  • I changed ubl to use uart0 (builder option debug_uart0 instead of debug_uart2). Now I do see the u-boot banner in uart0 but I dont see any print after the line "Nand: ...". I see in lib_arm\board.c that the console initialization is done right after the nand initialization. Is there an easier way to debug this issue maybe with jtag/code composer instead of flashing new version and hoping it will work ?

  • I am successful on changing the u-boot console to UART1 from UART2.

    Hardware: Logic OMAP L138 EVM board.

    U-boot version: u-boot-2009.11-psp03.20.00.14

    Summary of changes as below:

    +++ include/asm-arm/arch-davinci/hardware.h     (working copy)
    @@ -425,6 +425,7 @@
     #define DAVINCI_SYSCFG_SUSPSRC_I2C             (1 << 16)
     #define DAVINCI_SYSCFG_SUSPSRC_SPI0            (1 << 21)
     #define DAVINCI_SYSCFG_SUSPSRC_SPI1            (1 << 22)
    +#define DAVINCI_SYSCFG_SUSPSRC_UART1           (1 << 19)
     #define DAVINCI_SYSCFG_SUSPSRC_UART2           (1 << 20)


    +++ include/configs/da850evm.h  (working copy)
    @@ -63,7 +63,8 @@
     #define CONFIG_SYS_NS16550
     #define CONFIG_SYS_NS16550_SERIAL
     #define CONFIG_SYS_NS16550_REG_SIZE    -4      /* NS16550 register size */
    -#define CONFIG_SYS_NS16550_COM1        DAVINCI_UART2_BASE /* Base address of UART2 */
    +#define CONFIG_SYS_NS16550_COM1        DAVINCI_UART1_BASE /* Base address of UART2 */
     #define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)

    +++ board/davinci/da8xxevm/da850evm.c   (working copy)

    +const struct pinmux_config uart_pins[] = {
    +    { pinmux[0], 4, 4 }, /* UART1_RTS */
    +    { pinmux[0], 4, 5 }, /* UART1_CTS */
    +    { pinmux[4], 2, 6 }, /* UART1_RXD */
    +    { pinmux[4], 2, 7 }  /* UART1_TXD */
    +};
    ....
    +       lpsc_on(DAVINCI_LPSC_UART1);    /* console */

    +       writel(readl(&davinci_syscfg_regs->suspsrc) &
    +              ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
    +                DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
    +                DAVINCI_SYSCFG_SUSPSRC_UART1),
    +              &davinci_syscfg_regs->suspsrc);

    +*/
    +       writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
    +               DAVINCI_UART_PWREMU_MGMT_UTRST),
    +              &davinci_uart1_ctrl_regs->pwremu_mgmt);

    Changed the linux kernel console as well to UART1. But UBL is still on UART2.(Thats fine for me).

    Thanks for your support.

    Regards,

    Shameer

  • Hi Shameer

    Thanks for your information for changing u-boot serial port. You say you also changed the kernel console port (did you do it using the parameter passed via u-boot to the kernel?), but did you manage to redirect also all the serial port messages that appear after the init.d? These still appear on the default console, how can we also redirect them? My target is to be able to use the available serial ports for specific functions, so I need to remove every message from the available serial ports (u-boot, kernel, operating system).

    Best regards

    Fernando

  • Hi Fernando,

    If your intention is to disable the serial console login, please take a look at /etc/inittab file and comment out the below line.

    S:2345:respawn:/sbin/getty  115200 ttyS2

    Regards,

    Shameer

  • Dear Shammer,

    I use my custom board with AM1808. The UART1 also used for console. I made all changes to hardware.h and da850evm.h. The console output I can see in terminal, but then I type 'help' command and I see:

    Unknown command 'help' - try 'help'

    This is output of my custom board:

    AM1808 initialization passed!

    Booting TI User Boot Loader        

    UBL Version: 1.65       

     UBL Flashtype:

    SPI Starting SPI Memory Copy...

    Valid magicnum, 0x55424CBB, found at offset 0x00010000.  

     DONE þMMC:   davinci: 0oint at 0xC1080000.

    SF: Detected M25P64 with page size 256, total 8 MiB

     *** Warning - bad CRC, using default environment

    In:    serial

    Out:   serial

    Err:   serial

    ARM Clock : 456000000 Hz

     DDR Clock : 150000000 Hz

    SF: Detected M25P64 with page size 256, total 8 MiB Invalid MAC address read.

    Net:   Ethernet PHY: GENERIC @ 0x00 DaVinci-EMAC

    Hit any key to stop autoboot:  0

    Unknown command 'mmc' - try 'help'

    Unknown command 'sf' - try 'help'

    Unknown command 'sf' - try 'help'

    Unknown command 'bootm' - try 'help'

    U-Boot >