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.

TM4C123GH6PM: Not recognizing USB stick after I removed it using TIVA EK-TM4C123GXL

Part Number: TM4C123GH6PM

Hi,

I'm working on USB application to communicate with flash drive. I was able to recognize the flash drive and get to device ready after I turn on the Launchpad or press reset with the flash drive already connected. After disconnecting the flash drive, my code would branch to no device and that makes sense. The problem is, whenever I reconnect the flash drive to the USB after disconnecting, I'm still showing no device. I would have to press reset or cycle the power of the Launchpad for it to recognize the flash drive again and show device ready. Any suggestions on how to make this work without reset or cycling the power? Any thoughts on why the flash drive is not recognized when I reconnect it?

Thanks.

AJ 

  • Also, just to add, I am a bit confused about the schematic. For host config,, I need to short H18 and H19 and it works. But according to the schematic, regardless of where the slider is positioned, the ICDIVbus is always shorted to USBVbus, which means you get 5V there all the time. But this is not the case in the Launchpad, where you only get 5V when the slider is positioned to device. Is this a print error or am I missing something?

    Thanks again
    AJ
  • I've no direct experience with the external flash drive as you describe.         That admitted - perhaps a general, "KISS-based" problem-solving technique - will aid you (or others) in resolving.

    Often useful to, "Disassemble your reported issue into its constituent parts" - which best enables deep/isolated focus upon each.      These include:

    • careful examination (and logging) of the existing code path,  "Post Power Up" and/or "MCU Reset."     (to include Register Default settings)       It is clear that (something(s)) w/in this, "Post Reset" period enables your system to detect the flash drive.
    • careful examination (and logging) of your, "No Device code" - seeking the recognition of any/all differences between "No Device" and an MCU Reset.
    • it must be noted that your report, "Does not cover" (the equally important) mode of, "Insertion of the flash drive for the first time - after Power Up!"      (you note only "Power Up w/the flash device inserted!)

    As you note - it would appear that the "Removal of the Flash Drive" is not fully/properly:

    • being detected
    • handled/managed - such that a subsequent "Re-Connect Detection" is disabled

    The careful "logging" of all related variable and critical MCU Register settings/configurations - both during "proper" (recognized) insertion (existing insertion - in your case as presented)  and then during "failed" (unrecognized) insertion (which must be extended to include "Insertion AFTER Power Up") seems a, "Strong/Solid "KISS" directed path to resolution...

    [edit] ... this post was composed before the arrival of your just arrived (03:04) post - noting "schematic issues."      Still important is the "as of yet undescribed" result when the flash drive is inserted into a "Powered System - for the first time..."    (i.e. Not removed & then reinserted!)

  • Here is a snip from the schematic on page 21 of http://www.ti.com/lit/ug/spmu296/spmu296.pdf.

    The slide switch connects ICDI VBUS or +USB VBUS to +VBUS, but does not connect ICDI VBUS to +USB VBUS. It is a little confusing as we used a double pole double throw switch, but wired it as a single pole double throw function.

  • Hi cb1, Bob,

    Thanks for the response. According to some forums, for USB host to work, I need to short H19 and H18. Looking at the switch diagram, by shorting the two, regardless of what the position of the switch is, the 5V will always drop on USBVBUS unless H18 is located on the right of pin 2. Any thoughts on this one?

    Regards,
    AJ
  • I forgot to add, on the Launchpad, this isn't the case. The 5V only drops when the slider is set to device and 0V on USBVBUS when set to debug, which makes it look like H18 is located on the right of pin 2..
  • OK, I understand. You want to power +USB VBUS from ICDI VBUS by shorting H18 with H19. Since they are not labeled on the board, how did you identify H18 and H19?  To me it looks like they are this way:

  • Greetings Bob,

    In your opinion - possibly gleaned thru direct experience - can this board, "Detect the insertion of a USB Drive" - and subsequently, "Detect its removal" - and then "make ready" to (again) detect such USB Drive's insertion?    (all 3 conditions under sustained, "Power Up.")     It is my belief - that is the "real" question which should be resolved...

    As to H18 & H19 - the comment "Looks like they are this way" (might) suggest that poster has "reversed" his identification of those two.     Yet - as he proposes to "short" them - such reversal would (still) succeed - would it not?

  • Hi Bob, cb1,

    I found the locations of H18 and H19 on the first link below. The other links are other forums I looked at. I wanted to sort this out just to rule out that I might have shorted the wrong pins, which might be causing my problem. Or probably this is completely not related. Nevertheless, I want to be completely sure my hardware set up is correct. I shorted the middle and the right hole, that is according to the link below.
    e2e.ti.com/.../339350

    e2e.ti.com/.../364790
    e2e.ti.com/.../1278380

    Thanks.
    AJ
  • If you shorted the middle hole to the right hole, that shorts H23 to H19. That explains why you must have the switch in the "Device" position to connect ICDI VBUS to +USB VBUS.

  • Hi Bob,

    Actually, I get 5V on USBVBUS when in "device" position and 0V on USBVBUS when in "debug" position. My set up seems to work okay. But I feel uncomfortable of the fact that the schematic doesn't match what i'm seeing on my Launchpad. According to the suggested answer on the first link, he said short the two holes above R14. Seems to me like it's a print error on the schematic.

    Regards,
    AJ
  • I don't think the schematic is wrong. It is just that the board does not indicate the test points or pin 1 of the switch. I think I have the switch rotated in my understanding. Give me about 30 minutes and I will update the pictures above also showing the pin numbers of the switch.
  • OK, I have corrected the labels on my pictures. Does it make sense now?
  • Pardon again - if I may - we have ohm'ed out 3 such "123 basic LPads" and report these findings:    (with regard to Power Switch positions)

    • In Debug: "H23 shorts to H19."       (middle pin shorts to rightmost pin - right-side up - looking down on the board)
    • In Device: "H23 shorts to H18."     (middle pin shorts to leftmost pin - (same conditions as above))

    That middle pin (H23) receives the bulk of the switch action.    (we've tested such across 3 of the "EK-TM4C123 boards" (fresh from our virgin stock)

    Still though - there is no direct answer to the question:

    "Can this board recognize a flash drive's "insertion" when the board is powered up - and then recognize drive's "removal" - and later recognize (again) drive's insertion.?     In all such cases - board is UP and Powered - no use of Reset is employed."       Might this basic question be answered?       Thanks.

  • Hi Bob, I'm currently looking at your latest response but I don't see any picture.

    AJ
  • I updated the pictures in the previous responses to avoid someone looking at the wrong picture later.
  • cb1_mobile said:
    "Can this board recognize a flash drive's "insertion" when the board is powered up - and then recognize drive's "removal" - and later recognize (again) drive's insertion.?     In all such cases - board is UP and Powered - no use of Reset is employed."  

    CB1,

    I am not ignoring the question. I am pretty sure the answer is yes, but I need some time to prove it to myself. (This has been a busy day.)

  • Thanks Bob.

    Just to make sure we are on the same page, if I short H19 and H18 together(which is what the other forums say when configuring for USB host), that means that USBVBUS will have 5V regardless of the position of the switch?
  • AJ, CB1,

    I have verified that in the example: C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\usb_host_msc, the TM4C123 is able to detect that a USB stick was removed, and then detect that it is re-inserted without resetting the TM4C123 device.
  • Thanks Bob and cb1. I really appreciate you guys helping me sort this out. Just wanted to be really thorough to make sure I'm not missing anything. Next step is for me to go over my code once again. I'll see if I missed anything..
  • AJ_ee said:
    Just to make sure we are on the same page, if I short H19 and H18 together(which is what the other forums say when configuring for USB host), that means that USBVBUS will have 5V regardless of the position of the switch?

    Yes.

  • Hi Bob, cb1,

    Is that example you mentioned running in host mode and not OTG? I found this thread

    e2e.ti.com/.../2022594 H18 H19

    It might be the answer to my problem but I don't quite understand some of it like the part where poster mentioned about OTG pulsing.

    Sounds like the solution to my problem is to run in host mode and not OTG... Any thoughts?

    Regards
    AJ
  • Yes, the example I referenced is running in host mode.
  • One matter to consider though.. I got my code from the qs logger example that uses the DK-TM4C123.. The code is running OTG. I never tested this exact code because I don't have the DK eval board. I wonder if this would exhibit the same problem I am experiencing since it is running OTG. It's set up as OTG because it allows the user to transfer data to flash stick (host) or communicate with the PC via serial comm (device). I was hoping I could eventually do the same thing. But for now I just want sort out the flash stick.

    AJ
  • The DK-TM4C123GXL board has an electronic switch that allows the TM4C123 device to connect +5V to +USB_VBUS (the OTG connector). This allows the OTG micro A connector to be unpowered until the TM4C negotiates if it is supposed to supply the power or not.

  • Bob,

    It was not my attempt to "rush you."       Instead I noted several follow on posts by "AJ" - and feared that mine may be, "Lost in the forum traffic."     (And in many years here - exchanging w/Amit - I "know" the heavy demands the forum places upon vendor staff...)

    I believed that "AJ" had not yet identified the (more common) case of a flash drive being initially inserted, "post power up."     (as opposed to the rarer case - the flash drive inserted prior to power up.)

    All that said - as the Flash Drive does not source 5V - the exact circuit mechanism by which the "Flash Drive's presence" is detected by the MCU (still) escapes me.      (I'm unable to review the board's schematic - had hoped that "such detection mechanism" would receive "coverage" here.)        

    [edit] 20 Dec 08:03:   Now have accessed the LPad's schematic - Pg. 20 (top, center) reveals "J9 as the Flash Drive Socket" (left side of the pcb) and its pin 4 (ID) as the "likely source" of "Flash Drive's Presence!     (that socket pin is routed to User's PB0)       Simple "monitoring" of PB0 - w/and w/out Drive Inserted - should enable the recognition of such "Drive's Presence."      Yet I am "compelled to comment upon PB0's being allowed to "float" - which (likely) enforces the requirement of an "internal MCU pull (up or down) resistor" to prevent "PB0's read confusion."

    Lastly - no mention has yet been made of the USB socket labeled, "Device."      I assume that this "Device socket" powers & connects the Flash Drive via a suitable USB cable.     (and that cable must supply the relatively large, flash drive's mating (plug-in) connector - and then translate that to the far smaller, 5 pin USB connector resident upon the LPad.      

    Is such a cable a "standard?"     If so - might someone here suggest a "Cable Part Number?"    The cable may be described as USB "A" female to USB "B" micro Plug.      Firm/I have over 10 different USB cables & adapters - yet none enable a short connection between "USB Flash Drive and the LPad's micro B receptacle!"      Again - how is this connection challenge normally handled?

    If not "standard" - might "AJ's" difficulty be the result of a "failed cable hack?"     (which "swallowed" the Pin 4 (ID)'s presence signal)

    Thanks Bob for the detail and also for "exercising the LPad" so that a positive verification of  "Flash Drive's Presence" was achieved...   Very much appreciated.       (and hopefully exploited by users AJ & cb1...)

  • If I may - to add a "bit more fire" to this thread's flame - appears now a snip from 123's LPad, Pg. 20:

    Do note (both) R25 & R29 (in highlight).       Now J9 is the "Device USB receptacle" - and it must be noted that upon "all three" of our new/unused "123 LPads (EK-TM4C123)" - both resistors are ABSENT!

    Thus - if  PB0 is to signal the "Presence" of a USB Drive - the unmodified LPad appears to FAIL in that "Presence Detect" regard!          Note that the "instruction to add (insert) those 2 resistors" does appear w/in the LPad's manual - yet it suggests their use is "limited to adding OTG functionality."        (it seems reasonable that "Presence Detection" extends (beyond) OTG and OTG only - does it not?)

  • AJ_ee said:
    Hi Bob, cb1,

    Is that example you mentioned running in host mode and not OTG? I found this thread

    e2e.ti.com/.../2022594 H18 H19

    It might be the answer to my problem but I don't quite understand some of it like the part where poster mentioned about OTG pulsing.

    Sounds like the solution to my problem is to run in host mode and not OTG... Any thoughts?

    Regards
    AJ

    Finally, I was able to make it work by configuring as USB host and not OTG as mentioned in the link above. 

  • Good for you.   May we ask - have you added R25 (presence detect) and/or R29?      Both (absent) on 3/3 of our unused, '123 LPads.

    Schematic (1 or 2 (of my) posts up) documents such requirement...     And again - "Plague-Istors" should be "yanked" to prevent future mischief! 

  • Hi cb1,

    I copied this from the link I posted somewhere in the beginning of this forum,

    Here are the hardware changes I made

    1- Under the power switch there is three holes, you have to connect the ones above R14 and move the switch towards the device mode, you can use a wire but I did soldering for a fixed solution.
    2- Populate 0-ohm resistors on R25 and R29 that are next to the USB connector, in my case I did normal soldering and it was fine.
  • Good - schematic did demand the presence of both R25 & R29 (for drive detection) - your confirmation adds confidence. Mercî.