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.

USB Host Example in tivaware 2.1.2.111 only partially works on EK-1294XL board

Other Parts Discussed in Thread: EK-TM4C1294XL, TPS2052, MAX3243

I've been looking at the usb_host_msc USB host example in TI\TivaWare_C_Series-2.1.2.111\examples\boards\ek-tm4c1294xl\usb_host_msc. I'm using IAR v7.30. The code builds fine. However despite the connected terminal displaying a welcome message and notification of USB stick connect & disconnects the rest of the system fails to respond to typed commands.

Here's more detail.

Using the EK-TM4C1294XL launchpad, the terminal prompt appears with the initial welcome message of 'HUSB Mass Storage Host program', followed by 'Type 'help' for help.' About 2% of the time I get the full command menu after the 'Type 'help' for help.' message. Whether I get the command menu or not, any command typed on the terminal is only echoed back from the board and not acted upon. Nor does it produce any other error message. It's definitely echoed from the launchpad and not a local terminal echo as you can see the time shifted return comms traffic on the RS232 bus.

When the USB stick connects, or disconnects, I always get the prompt change from 'NODEV>' to '/>', and the terminal message notifying of this is 100% reliable.

+5v volts is always present on the USB connector, and under control of TPS2052 & PD6. +5v is fed to the board by connecting the +5v to the commoned side of JP1 pins 2,4&6 and there's no jumper installed on JP1.

When the USB stick is connected, traffic appears on the USB bus which is a short (about 20bits) repetitive packet sequence (fixed header but varying back end) running at 12Mbs and repeating at 1Khz. I assume this is in sync with the tick rate of the application. A fairly new USB2.0 capable stick, and a USB stick that's about 10 years old produce exactly the same result. So does moving the whole thing to a brand new EK-TM4C1294XL board.

If I set breakpoints in the code USBHCDMain in usbhostenum.c is called repeatedly if the USB stick is inserted. So is USBHCDInitInternal in the same file.

USB0OTGModeIntHandler is called when the USB stick is inserted, or is already inserted on reset.

The problem seems similar to this thread:
e2e.ti.com/.../1676996
except the code here gets a bit further.

Any ideas why the command interface doesn't work?

  • Hello Pete,

    Instead of compiling the binary in IAR Studio, if you load the CCS Binary does it behave the same way?

    Regards
    Amit
  • As LM Flash likes the ICDI, I've just put the jumper links back into header X1 and enabled the ICDI MCU again, and also disconnected the external +5v supply and selected ICDI power on header JP1. So apart from the addition of a RS232 circuit its now completely standard.

    Then I erased the 1294, checked it, then programmed it with the CCS binary, checked it against the .BIN, and I get:
    1) A reset when the USB stick is inserted, I'm assuming this is a power glitch as the board is now running off the ICDI power.
    2) The same terminal performance as above except the command is no longer echoed back.

    I also loaded the original IAR .BIN that came with Tivaware and got the same.
    I'm going to check the RS232 circuit as that's new for this setup, and also common. I'm wondering why the difference in echoed, or not echoed commands.
    Amit, should the software automatically send out the command list to the terminal, or is that caused by another event?
  • Hello Pete,

    Can you please paste snapshot of what you are seeing on the console (and what you expect to see by editing the image) so that I can check it on my DK-TM4C129x with the ICDI?

    Regards
    Amit
  • The reason why the echo on the terminal comms disappears when using the .BIN versions is that for some reason a current source appears on the PA0 (UART0_RX) pin, pulling it high. It meant that the MAX3243 RS232 receiver output couldn't drive the PA0 pin low enough, through the 100R series resistor, to register in the MCU. The pull up does look like a current source and not resistive. I would guess the 12mA pull up is being enabled on PA0 for some reason. Shorting out the series resistor, the MAX3243 can't sink enough current to prove whether the code works or not. I'll modify the circuit to drive it harder, as it would seem the MCU won't be damaged by it.

    If I return to the compiled version that pull up disappears, the echo returns, but still the commands don't run.

    Amit, I'll see if I can get the .BIN to run and come back to you shortly. Looking like more than one problem at the moment.
  • Hi Amit,

     Using the non inverting output of the MAX3243 to drive a transistor open collector to PA0 makes the application work, but it only does the same as the compiled version again. So the terminal echo works again with the .BIN version but nothing further. As requested here's a screen image of the console. To generate it I did this:

    I removed the USB stick.

    Cleared the terminal screen

    Pressed reset on the EKTM4C1294XL. The application displays this:

    [00][1B][2J[1B][HUSB Mass Storage Host program
    Type 'help' for help.
    
    NODEV> 

    I type 'help' and get this:

    help

    echoed back. Then I insert the USB stick, and sometimes I get this back, sometimes not:

    Available commands
    ------------------
    help : Display list of commands
    h    : alias for help
    ?    : alias for help
    ls   : Display list of files
    chdir: Change directory
    cd   : alias for chdir
    pwd  : Show current working directory
    cat  : Show contents of a text file
    
    Mass storage device connected.
    /> 

    I then type 'help' again and get nothing but it echoed back. Removing the stick produces the notification, and it goes back to the NODEV prompt. Note that at the end (see in the attached pictures) when the NODEV prompt reappears there's 'help' already on it. I didn't type that one. Some pictures of the terminal, showing when the menu appears and when it does not. The commands I type and sequence of them is identical in both cases.

    USB Host with EKTM4C1294XL terminal pictures.zip

  • At a guess I think I've just seen Errata GPIO#09 as all of a sudden the MCU got quite hot. Putting the board back onto an external power supply again showed the current drain to be coming off the +5v rail. The 3v3 rail was fine. Searching on faults that all of a sudden would make the MCU hot I found Issue GPIO#09.
    It would seem there's a conflict here - I'm sure I've read somewhere that the usb_host_msc prefers to be powered up before the USB stick is inserted, and yet hot plugging (which is expected for USB) seems to provoke GPIO#09.

    The errata says, "PB0 (USB0ID) should be left floating and configured as a GPIO input". Is that correct - that you leave it as unconnected floating input?
  • Hello Pete,

    The USBVBUS and USBID need extra protection (ESD or RC in this case) to prevent IO LatchUp. On the DK-TM4C129X there is protection on the USBVBUS and USBID pins.

    Regards
    Amit
  • ESD protection now installed.
    In trying to figure out what was going on with the rest of the problem I noticed another anomaly - if I breakpoint on the C statement that prints the terminal text 'Mass storage device connected.' it doesn't breakpoint, yet it displays to the terminal.
    So I modded the text line to display 'Mass storage device cOnnected.' instead to make sure I had the correct line and I have, the terminal displays the modded version. In assembler, IAR v7.30 breakpointing has been rock solid, but I realise troubleshooting it is not TI's remit. Hopefully another forum user can shed light on that one.