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 USB Console and OMAP-L137/L138

Other Parts Discussed in Thread: DA8XX, OMAPL138, OMAP-L138, AM1808

Hello.  I would like to enable U-Boot to use USB (usbtty) instead of the serial port.  I've followed the instructions in U-Boot's README for enabling usbtty; however, I can't get the version of U-Boot supplied with the 137 and 138 to compile when I enable "CONFIG_USB_TTY" 

Has anyone been successful in enabling USB console input/output with U-Boot on either the 137 and/or 138?  Any help would be appreciated.

 

Thanks.

  • JT,

    Please provide the error you are getting when enabling CONFIG_USB_TTY.

    I would suggest you to use denx latet uboot tree to verify this. You can follow the steps as given below,

    Please follow the steps below to enable USBtty in uboot.

    • Enable MUSB_UDC at board config file such as, include/configs/davinci_dm365evm.h for dm 365

    /* #define CONFIG_MUSB_HCD */
    #define CONFIG_MUSB_UDC 1

     

    • Compile and flash the board with new uboot.
    • Power up the board
    • $ setenv usbtty cdc_acm
    • $ setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty
    • Now connect the cable to Linux Host
    • Use minicom on Linux host over /dev/ttyACM0

    Regards,
    ajay

  • Ajay,

    Thanks for the helpful reply.

    Per your instructions, I downloaded the latest version of u-boot from denx.  I was using the version of uboot supplied with the L138 board.  So, to be clear, has the L138-specific patches been applied to the current u-boot source tree (I can only assume this).  I had to add the following to da850evm.h to get a clean build when enabling usbtty:

    #define CONFIG_USB_DA8XX     // added to resolve "USB Lowlevel not defined" error in usb.h
    #define CONFIG_MUSB_UDC     // added per Ajay
    #define CONFIG_USB_DEVICE  // added per uboot's README
    #define CONFIG_USB_TTY          // added per uboot's README

    #define CONFIG_SYS_CONSOLE_IS_IN_ENV // added per uboot's README

    FYI, unti I added "CONFIG_USB_DA8XX" to da850evm.h, I was getting the following error at compile time: "USB Lowlevel not defined".

     The header file in "include/configs/da850evm.h" from the latest uboot source tree does not contain any USB-specific #defines, as the uboot supplied with the L138 board support package.

     At this point, I have an error-free build.  I need to test it out on the L138 board.

     

    Thanks.

     

  • The latest uboot source tree appears to "support" the #define CONFIG_MUSB_UDC.  However, in the version of Uboot provided with the 138 EVM, it is not present.  Here are some of the errors I'm seeing when trying to enable USBTTY (uboot supplied with 138):

    uboot-03.20.00.06/drivers/serial/usbtty.c:840: undefined reference to `udc_endpoint_write'

    uboot-03.20.00.06/drivers/serial/usbtty.c:983: undefined reference to `udc_irq'

    uboot-03.20.00.06/drivers/serial/usbtty.c:721: undefined reference to `udc_setup_ep'

     uboot-03.20.00.06/drivers/serial/usbtty.c:548: undefined reference to `udc_init'

    So, here is the issue:

    1) I can enable and build usbtty support using the current UBoot source tree; however, I'm unable to get SPI and Ethernet working;

    2) With uboot supplied with 138 EVM, I'm able to rebuild the image and burn onto the EVM, but not enable usbtty

  • JT,

    The latest denx uboot tree has all the required USB configs in include/configs/da830evm.h  and not yet available at include/configs/da850evm.h. We would require to copy

    all the USb configs (below) from da830evm.h to da850evm.h.

    -------------------------------------

    /*
     * USB configuration
     */
    #define CONFIG_USB_DA8XX        /* Platform hookup to MUSB controller */
    #define CONFIG_MUSB_UDC

    #ifdef CONFIG_USB_DA8XX

    #ifdef CONFIG_MUSB_HCD          /* include support for usb host */
    #define CONFIG_CMD_USB          /* include support for usb cmd */

    #define CONFIG_USB_STORAGE      /* MSC class support */
    #define CONFIG_CMD_STORAGE      /* inclue support for usb-storage cmd */
    #define CONFIG_CMD_FAT          /* inclue support for FAT/storage */
    #define CONFIG_DOS_PARTITION    /* inclue support for FAT/storage */

    #ifdef CONFIG_USB_KEYBOARD      /* HID class support */
    #define CONFIG_SYS_USB_EVENT_POLL
    #define CONFIG_PREBOOT "usb start"
    #endif /* CONFIG_USB_KEYBOARD */

    #endif /* CONFIG_MUSB_HCD */

    #ifdef CONFIG_MUSB_UDC
    /* USB device configuration */
    #define CONFIG_USB_DEVICE               1
    #define CONFIG_USB_TTY                  1
    #define CONFIG_SYS_CONSOLE_IS_IN_ENV    1
    /* Change these to suit your needs */
    #define CONFIG_USBD_VENDORID            0x0451
    #define CONFIG_USBD_PRODUCTID           0x5678
    #define CONFIG_USBD_MANUFACTURER        "Texas Instruments"
    #define CONFIG_USBD_PRODUCT_NAME        "DA830EVM"
    #endif /* CONFIG_MUSB_UDC */

    #endif /* CONFIG_USB_DA8XX */

    ----------------------------------------------------------

    I think the uboot supplied with EVM is older version and thus doesn;t have all the necessary features/fixes.

    Can you provide the details of uboot version supplied with EVM ? and also check if there are any new version of TI supported uboot available.

    Regards,
    Ajay

     

  • I just submitted below patch to denx list to add this support on DA850. You can use this instead.

    http://lists.denx.de/pipermail/u-boot/2010-August/075760.html

    Regards,
    Ajay

  • Ajay,

    I obtained the Davinci PSP 03.20.00.12 Release, which appears to be the latest release.  I'm using the uboot per the PSP release notes, per the following table:

    U-Boot 2009.11 http://arago-project.org/git/projects/?p=u-boot-omapl1.git;a=summary bb3bcfa2426cc6a0aecec7270e3ee67ca843a125 v2009.11_DAVINCIPSP_03.20.00.12

    When I try to enable #define CONFIG_MUSB_UDC in include/configs/da850evm.h (uboot version v2009.11_DAVINCIPSP_03.20.00.12), I get the followoing compile error:

    usbtty.c:125: error: 'EP0_MAX_PACKET_SIZE' undeclared here (not in a function)
    usbtty.c:218: error: 'UDC_INT_ENDPOINT' undeclared here (not in a function)
    usbtty.c:221: error: 'UDC_INT_PACKET_SIZE' undeclared here (not in a function)
    usbtty.c:244: error: 'UDC_OUT_ENDPOINT' undeclared here (not in a function)
    usbtty.c:248: error: 'UDC_BULK_PACKET_SIZE' undeclared here (not in a function)
    usbtty.c:255: error: 'UDC_IN_ENDPOINT' undeclared here (not in a function)
    usbtty.c:327: error: 'UDC_OUT_PACKET_SIZE' undeclared here (not in a function)
    usbtty.c:337: error: 'UDC_IN_PACKET_SIZE' undeclared here (not in a function)
    usbtty.c: In function 'usbtty_tstc':
    usbtty.c:398: warning: implicit declaration of function 'udc_unset_nak'
    usbtty.c: In function 'usbtty_getc':
    usbtty.c:423: warning: implicit declaration of function 'udc_set_nak'
    usbtty.c: In function 'drv_usbtty_init':
    usbtty.c:552: warning: implicit declaration of function 'udc_init'
    usbtty.c:557: warning: implicit declaration of function 'udc_startup_events'
    usbtty.c:558: warning: implicit declaration of function 'udc_connect'
    usbtty.c: In function 'usbtty_init_instances':
    usbtty.c:679: warning: implicit declaration of function 'udc_setup_ep'
    usbtty.c: In function 'write_buffer':
    usbtty.c:844: warning: implicit declaration of function 'udc_endpoint_write'
    usbtty.c: In function 'usbtty_poll':
    usbtty.c:987: warning: implicit declaration of function 'udc_irq'

    When I use the latest denx source release, I can get a clean compile when enabling #define CONFIG_MUSB_UDC.   However, I'm unable to get the ethernet and SPI flash to work properly.  I have used the same SPI Flash and and Ethernet settings as defined in include/configs/da850evm.h per the uboot version v2009.11_DAVINCIPSP_03.20.00.12.

    There have obviosly been major changes made to uboot since v2009.11_DAVINCIPSP_03.20.00.12; however, this version seems to work the best (out of the box) with the OMAPL138 EVM.  I have no issues using the latest version; however, I'm in a quandry, as version v2009.11_DAVINCIPSP_03.20.00.12 works LESS USBTTY enabled and the latest version allows USBTTY to be compiled, but does not recognize SPI or ethernet.

    Suggestions are much appreciated.

    Regards,
    jt

     

  • After some additional though/analysis, I noticed the latest (2010.06) u-boot source code contains the musb_udc.c.  I therefore updated the uboot usb code for version v2009.11_DAVINCIPSP_03.20.00.12.  I'm now able to build u-boot, v2009.11_DAVINCIPSP_03.20.00.12, with USBTTY enabled.

    When I set the stdin and stdout to usbtty, on the Linux host (Red Hat Enterprise 4) using the "cu" utility I can see the u-boot prompt.  However, I'm unable to interact with the OMAP-L138 via USB.  On the Linux Host, I see /dev/ttyACM0 and I can successfully connect to the device.

    I've tried minicom, but I get no output.  

    Any suggestions?

    Thanks,

    JT

  • >>When I set the stdin and stdout to usbtty, on the Linux host (Red Hat Enterprise 4) using the "cu" utility I can see the u-boot prompt

    You need to set stdin,stdout to usbtty on EVM side. Please follow the steps provided earlier.

    Regards,

    Ajay

  • Ajay said:

    >>When I set the stdin and stdout to usbtty, on the Linux host (Red Hat Enterprise 4) using the "cu" utility I can see the u-boot prompt

    You need to set stdin,stdout to usbtty on EVM side. Please follow the steps provided earlier.

    Regards,

    Ajay

    Ajay,

     

    Sorry, my last post was not clear.  I did set stdin and stdout to usbtty on the EVM.  In fact, I see the u-boot prompt on the RedHat box after I enter the stdin/stdout to usbtty on the EVM.  However, I'm unable to issue any commands vi CU and/or minicom; I only see the u-boot prompt only.  It's as if either the EVM is not responding and/or "cu" is not receiving any response.

  • I've tested various scenarios...

    When I set just stdout to usbtty, and leave stdin to go over UART, I'm able to see all "output" go to the host, over USB, via minicom.  For example, I would enter commands via TeraTerm and receive the output via minicom, whose device is /dev/ttyUSB0.

    So, apparently, stdin appears to be the problem.  The EVM board apparently doesn't seem to receive the data via USB for usbtty stdin.

    Also, on the EVM, I've got setenv usbtty gserial.  I then used modprobe for the EVM board on the Linux host.  The linux host seemed to more reliably recognize the EVM when "setenv usbtty" is set to gserial vs cdc_acm.

    I've tried setting usbtty environment variable to "cdc_acm" but I get the same issue--there is only the "u-boot" prompt returned from the EVM upon changing stdout/stdin to usbtty.  The EVM does not appear to receive data via stdin over usbtty.

  • JT,

    Please enable MUSB_DEBUG at drivers/usb/musb/musb_udc.c file and post the logs to denx uboot list for further debugging.

     

    -------

    /* #define MUSB_DEBUG */

    --------

    Regards,
    Ajay

  • I'm running into the same problem as JT mentioned and I was wondering if this issue was ever resolved?  I enabled MUSB_DEBUG and nothing changed.

     

    I grabbed release 2010.12 of u-boot from denx and had to port forward some changes from the DaVinci PSP 3.20.00.14 version of u-boot to build for the da850.  Once I did that I was able to configure for USB and get a clean compile.  Once I switched over to usbtty though I was unable to interact.  Like JT if I only switched stdout over things worked a bit better.  I could enter input to the serial console, and see the output on the usb console.  The output on the usb console looked a bit garbled though.  I've included a sample below

     

    DA850-evm > printenv

    00

      rate=115200

                 boinitrd ip=dhcp

    bootdelay=3

    bootfile="uImage"

    stdout=usbtty

    oinitrd ip=dhcp

    bootdelay=3

    bootfile="uImage"

    stdout=usbtty

    usbtty=cdc_acm

    ver=U-Boot 2010.12 (Feb 09 2011 - 06:50:44)

    EDA850-evm > size: 214/65532 bytes

    DA850-evm >

  • *Bump*

    Any progress on this?  Patches from 3.20.00.xx PSP for u-boot don't seem to have been merged into the mainline u-boot tree so building that for the AM1808 eval kit (da850_omapl138_evm_config) is problematic, and the usb console option doesn't exist for the version of u-boot provided with the dev kit.

    It's a requirement for me so I'll have to decide which direction I want to start patching if this hasn't already been addressed.

  • Seth,

    MUSB support in uboot for AM1xx is already merged and available at http://git.denx.de/?p=u-boot.git;a=summary

    You can browse the code at drivers/usb/musb/da8xx.c

    Regards,

    Ajay

  • Ajay, I think you misunderstand what I am asking.

     

    This is what I was talking about in previous posts.  I know the usb console drivers appear in mainline, complete with the da8xx driver but clearly some changes were not pushed as I cannot build for a da850_omapl138_evm_config... the config does not exist.  So what else is missing is missing on mainline?  I had made a quick stab and making the required changes to build for the config I need but the usb console still wasn't working 100% correctly.  I was unsure if this was issues with the usb driver or simply that I missed something when reviewing TI's patch list, or if there was some incompatibility I was just unaware of.

     

    In TI's provided version of u-boot the config exists and without enabling usb device support builds and runs well on the evm.  However, when attempting to follow the instructions provided above u-boot fails to build.  JT did good job of pointing out all the errors (both for compiling TI's u-boot, and mainline's usb tty behavior) in some of his original posts.

     

    So neither version of u-boot (TI or denx) is an ideal solution.  Since this has apparently been a problem for some time I thought there was a chance some work had been done to improve this and I didn't want to repeat the effort.  Based on your response nothing has been done.  TI has not and is not planning to push out a new version with some updates support for usbtty.  TI has not and is not planning on pushing back patches to get the da850 config building and running on the mainline.  Are those two assumptions correct?

  • Seth,

    Denx tree has usb configs changes only for Da830 and I had submitted a patch for Da850, refer below link,

    http://patchwork.ozlabs.org/patch/71817/

    I didn't see this patch getting merged. looks like it got missed from maintainer.

    Regards,

    Ajay

     

  • Thanks for the response Ajay.  More than just the usb config change you reference haven't made it back.  I'm guessing you just can't confirm an effort or lack there of on the rest.  I'll just go do the work myself.

  • Because TI's uboot  03.20.00.12 has many patch, so I download uboot 2010.12 release, and merge some driver into uboot 03.20.00.12, now I can build uboot correctly without error.

    1)use TI's uboot  03.20.00.12 as base code, add some new drivers from uboot 2010.12.

       copy all files from  uboot 2010.12  drivers\serial, drivers\spi,  drivers\usb,  include sub-directory

    2)add or replace some include file from uboot 2010.12.

    uboot/include/ubi_uboot.h

    uboot/include/usb/ehci-fsl.h

    uboot/include/usb/musb_udc.h

    uboot/include/usb/spr_udc.h

    uboot/include/usb.h

    uboot/include/usbdescriptors.h

    uboot/include/usbdevice.h

      3)modify Makefile of drivers\serial, drivers\spi, drivers\usb\gadget, drivers\usb\host, drivers\usb\musb, drivers\usb\phy.

    $(call cmd_link_o_target, $(OBJS))

         changed to 

    $(AR) $(ARFLAGS) $@ $(OBJS)

     

    LIB := $(obj)xxx.o

        changed to:

    LIB := $(obj)xxx.a

     

     

    now clean, config and build it.

     

    Our board will be ready next month, We will test uboot on it.

     

     

  • Hi Ajay,

    I have the same need for using the console to AM1808 USB because the custom hardware will not have a serial port.  First I am trying to get it to work with the reference board from LogicPD, however, it doesn't seem to be connecting.  I added the suggested options to the u-boot configuration and compile plus the lines from the Da830 patch.  Then I change the u-boot environment as follows:

    • $ setenv usbtty cdc_acm
    • $ setenv stdout usbtty; setenv stdin usbtty; setenv stderr usbtty

    The serial console stops working at that point, but when I plug in the device to the linux host, nothing pops up or appears for the usb device.  There is no ttyACM device listed in /dev. 

    My board:

    am1808 evaluation board from logicPD

    My host:

    Ubuntu 11.10

    u-boot-2010.12-psp03.21.00.04.sdk (from am180x sdk 5.02.00.00)

    Sam

  • Update:

    OK, I got things half way working, but I had to "modprobe usbserial vendor=..." on the host.  Now I can connect to /dev/ttyUSB0, but I still don't see ttyACM0.  The problem now is that I can see the stdout on usbtty, but as soon as I switch stdin to usbtty, I can't type anything.  Has anyone found a solution to this?

  • Samuel,  I gave up after Ajay's last response.  I was pretty thoroughly disappointed in the lack of support for something that supposedly worked and just did my own thing instead.  I used the bootloader and usb-serial port examples from the SitaraWare TI released (now called StarterWare) to make my own usb loader to support upgrades.  It wasn't very hard and if you don't need all the functionality u-boot provides I'd recommend it.

    I have to admit that I didn't try blue sky's suggestion of backporting the newer USB drivers from the u-boot mainline into the old 03.20.00.12 version of the PSP.  You could always try that as well.

    Good luck,

    Seth

  • Thanks for the update Seth.  It looks like Ajay is MIA.  I am not quite ready to roll my own bootloader just yet.  There are too many features of uboot that I need such as fatload and self updating.

    I did make a few more discoveries.  I was able to step into uboot code with the jtag and when I did, the linux host sees the device as ttyACM0 rather than ttyUSB0.  So, maybe a timing issue?  I also found that in usbtty_getc there is a loop that gets stuck.  I will spend a bit more time with it, but if I don't get anywhere, I might just go with stdout for now.  At least I will be able to see the boot status.

    Sam

  • Good luck Samuel.  If you get it going I'd love to know what is needed.  I've got to focus on other areas now of my product now but I'd love the option of returning to uboot in the future as it does provide much more feature rich interface than what I threw quickly together.

    Seth

  • Samual,

    Can you check the value of register at offset 0x04 CTRLR.INT (D3 bit). This bit should be set to '1' to read interrupt status from mentor core register.

    Regards,
    Ajay

  • Ajay,

    It looks like that register is set to 0.  I included a screenshot just to make sure I am looking at the right register.  I tried changing it to 1 with CCS, but the change is not accepted.  It also causes the ttyACM0 device to disappear from my host machine.

  • can you try below change in uboot itself.

    diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
    index 40bfe44..e7b14cc 100644
    --- a/drivers/usb/musb/da8xx.c
    +++ b/drivers/usb/musb/da8xx.c
    @@ -97,7 +97,7 @@ static void phy_off(void)
      */
     int musb_platform_init(void)
     {
    -       u32  revision;
    +       u32  revision, ctrlr;

            /* enable psc for usb2.0 */
            lpsc_on(33);
    @@ -118,6 +118,10 @@ int musb_platform_init(void)
            if (revision == 0)
                    return -1;

    +       /* Disable PDR interrupts in control regs at 0x01E00004 */
    +       ctrlr = readl(&da8xx_usb_regs->control);
    +       writel(ctrlr | (1 << 3), &da8xx_usb_regs->control);
    +
            /* Disable all interrupts */
            writel((DA8XX_USB_USBINT_MASK | DA8XX_USB_TXINT_MASK |
                    DA8XX_USB_RXINT_MASK), &da8xx_usb_regs->intmsk_set);

  • Ajay,

    That seems to be the ticket. (almost) I had to add a udelay(5000) like the one in davinci.c.  There seems to be a couple of limitations that I can work around for now.

    1. This setup only seems to work when I run things through the jtag and CCS.  Maybe some sort of timing thing?

    2. I can't seem to 'setenv stdin usbtty' and save it.  It only works if I set the stdin to usbtty afterboot, which I do in the bootcmd.

    Even with these limitations, there seems to be enough here that I can continue development with linux on a custom board.  Thanks Ajay.

    Sam

  • Sam,

    Good to hear that did the trick but there seems to be still something missing. Putting delay after soft reset is expected and should be done OR put a loop to check the reset bit to clear which would indicate that reset has completed successfully.

    ajay

  • Hi,can you tell me how to solve the problem of booting the uImage by USB in u-boot?Dose it need DSP to help to load?I really need the source code that support the USB function in u-boot,can you send it to my e-mail(hb1986@gmail.com)? Thanks a lot.

  • You can refer the source code at http://git.denx.de/?p=u-boot.git;a=history;f=drivers/usb/musb;hb=dbb87bbd8eff11cf974caa2b5cc397aea444bc5a

    Ajay

  • Hi Han,

    I compiled the usbtty it is working only with MUSB_DEBUG enabled.

    It seems like timing problem. 

    Another problem is reconnecting the usb cable. The usb address isnt the same and it fails with error.

    Have you solved the usb serial problem?

    Thanks

    eyal

  • I never solved the problem for u-boot.  Instead I wrote my own bootloader.  Heavily based on the one in TI's starterware package.  It looks for an application in flash and if no valid app is found it enumerates USB as a serial device.  There was an example that did that in the starterware as well so it was relatively trivial to mash both examples together and add a few other features I needed.  I now load that custom bootloader and my custom application rather than UBL and U-Boot.

    Sorry if that isn't much help,

    Seth

  • Thank you for your reply.

    I need to transfer a data over the USB in u-boot.

    I configured the -boot for gserial, when I put delay it works well now.

    Eyal

  • Where was this "delay" inserted?  I think I am having the same problem with dropped characters.

  • Hi Brian,

    I made the changes as following:

    u-boot..xx\drivers\usb\musb_udc.c line 96: udelay(900) /* eyalm - added because timing problems */;

    Enjoy,

    Eyal

  • First off, thank you for your help.

    Secondly, it didn't work.  You didn't provide context for the one
    line change, but my best guess is that the udelay(900);
    was to be inserted into the macro SET_EPO_STATE(s)
    just before the closing } while (0);

    My line 96 was a blank line outside of the macro.

    Ideas? 

  • make sure you added "\"  at the end of while (0);

    and I compiled the usbtty with MUSB_DEBUG enabled and configured it for gserial.

    This my code:

    #define SET_EP0_STATE(s) \
    do { \
    if ((0 <= (s)) && (SET_ADDRESS >= (s))) { \
    if ((s) != ep0_state) { \
    if ((debug_setup) && (debug_level > 1)) \
    serial_printf("INFO : Changing state " \
    "from %s to %s in %s at " \
    "line %d\n", \
    ep0_state_strings[ep0_state],\
    ep0_state_strings[s], \
    __PRETTY_FUNCTION__, \
    __LINE__); \
    ep0_state = s; \
    } \
    } else { \
    if (debug_level > 0) \
    serial_printf("Error at %s %d with setting " \
    "state %d is invalid\n", \
    __PRETTY_FUNCTION__, __LINE__, s); \
    } \
    } while (0); \
    udelay(900) /* eyalm - added because timing problems */;

    Eyal