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.

How to make android phone communicate with TM4C123G by usb

Android suppoerts usb host mode higher than level sdk 3.1,Now  i want to use android as usb host,then commucate with TM4C123G which acts as a device by a usb line,but android phone always can not find the device,can i make it,who can help me ?  I do not konw how to do.

  • It depends what sort of USB device you have made the TM4C123G. This choice is determined via the code, there are a few examples provide with Tivaware. You need to make sure Android not only supports USB host mode, but also supports the device you have turned your TM4C123G into.

    If not already familiar with USB enumeration, endpoints, interfaces etc., then I'd recommend you do a bunch of reading on USB. This is a pretty good place to start - http://www.beyondlogic.org/usbnutshell/usb3.shtml

    Glenn.

  • As Glenn says the USB enumeration depends on the type of USB device you want to present the TM4C123G as.  We have examples for being a USB mass storage device.  These may work directly with an Android host but are not tested.

    I know some folks have made the older LM3S devices a USB host to the android system where the android is the device.  

    Yes, it should be possible to make the TM4C123G a host or device and connect it to an Android system.  The details of the connection are not something we currently have examples and support for.  You will need to develop USB drivers for the class of device you want to be or the class of device you want to host.

    Dexter

  • Glenn,Thanks for your replay,My problems are as followings:

    I wrote a program in my android phone,which is used to find the device attached to it.But when i attach the  TM4C123G to the android phone by a mini_usb to mini_usb line,my phone find no device,is the android phone can not recongized the  TM4C123G board or something else.

    My phone is lenovo s890 ,android version is 4.1.1,which i set it as usb host mode in my code.

    the  TM4C123G is loaded in a program named usb_dev_bulk provided by TIVA,PC can communicate with it by this program.

    Can you tell me why ,is the phone can recognize the  TM4C123G?? or anything else???

  • Dexter Thank you

    My problem is as my  reply to Glenn,you mean that i should develop a drivers in my  TM4C123G board to make the android phone recognize the TM4C123G board????

    My english is not good,pardon me!!!  thank you very much!

  • You really need to understand how USB works before you can progress, there is no other way forward. The link I provided is a good place to start. 

    Additionally, you also need to know what type of USB devices your Android phone supports. The example you used (usb_dev_bulk) may not be a device your Android phone's USB host supports....this is a question best asked at an Android support forum.

    Glenn.

  • Ok,thank you very much.I understand something!!!!

  • Glenn is correct i think a deeper understanding of USB is required.  

    USB devices enumerate as different classes which require drivers.  PC hosts generally support a very wide variety of devices.  Embedded hosts such as Android phones only support a small number of device classes.

    You need to find out what kind of devices your phone can support.  Then find an example from our package for the Tiva that most closely matches that device class. Then modify the example to present itself to the phone as a USB device that the phone understands how to communicate with.

    Dexter

  • Thank you very much,what you hava said is just the thing i am working on, So difficult!!!

  • I would also like to have Android connectivity with TIVA controllers. As the popularity of Android is day by day increasing, I think developers of example programs at TI  should start  thinking for such USB connectivity examples. 

  • You could use a FT232R ( from FTDI ) connected with your TIVA, they have already developed the Android J2xx Library for their chips. Just Plug and Play!

  • Laureano Rodriguez said:

    You could use a FT232R ( from FTDI ) connected with your TIVA, they have already developed the Android J2xx Library for their chips. Just Plug and Play!

    This is sincerely the best way. It makes it possible to use any MCU, easy to use and pretty solid. You avoid using real USB with the Tiva, which is much harder than using the UART.
    Also, not all MCUs have USB so you are limited (all Tivas have).

    Now, if you really need a USB device then this won't work. If you really need USB device could you please clarify which is your end goal?

  • Laureano Rodriguez said:
    You could use a FT232R ( from FTDI ) connected with your TIVA, they have already developed the Android J2xx Library for their chips. Just Plug and Play

     FT232 is a simple UART emulator, so it can be recognized by Linux under Androids as other uart class devices can be recognized. So A simple serial class device can be it is recognized by Androids. Again if you cheat with controller loading FT USB numbers Androids recognize but not sure it work.

     To be sure I think a mouse or keyboard can be the most common HID standard class every system has drivers for. Many example of HID class are present on TIVAWare examples folder so try this first.

  • Laureano Rodriguez said:
    You could use a FT232R ( from FTDI ) connected with your TIVA

    Thanks for this - but it's unclear if you have actually tried - and succeeded - w/this implementation.  (Or - are simply relaying a, "hoped for" capability...)

    Surely there's a need - and opportunity - yet the absence of, "hard facts" (i.e. first hand - user reporting of success) is troubling...  If you've implemented this - and achieved some success w/this vendor's MCUs - might you share some detail here?

  • cb1- said:
    Surely there's a need - and opportunity - yet the absence of, "hard facts" (i.e. first hand - user reporting of success) is troubling...  If you've implemented this - and achieved some success w/this vendor's MCUs - might you share some detail here?

     Tomorrow I try connect a peripheral (a mouse) then I try a mouse example from tivaware and I connect both to my Android phone to see what happen, I am not so expert on Android and after I bought I never got time to learn how to use more than as usual phone.

     I saw my student enabling root mode access to underlying Linux platform and telnet onto it, this can be useful to run "lsusb" and see what is enumerated on interface too.

  • Good that - Roberto.  Many Apps may  be extended/improved via Android extension.

    Poster reporting was sufficiently vague to bring successful (real) usage into question.

    Will be great if you can experiment & report - thanks much...

  • Roberto Romano said:
    I saw my student enabling root mode access to underlying Linux platform and telnet onto it, this can be useful to run "lsusb" and see what is enumerated on interface too.

    Without taking root on your Android, you may run USB host on it using standard APIs.
    android.hardware.usb package provides APIs like libusb - generic host driver.
    http://developer.android.com/guide/topics/connectivity/usb/host.html

    UsbManager.getDeviceList() lists up all USB devices currently attached.

    You’ll find MissileLauncher example useful as the starting point of Android USB-host app development.
    /sdk/samples/android-20/legacy/USB/MissileLauncher

    In this thread, I wrote the outline of modification, to connect to StellarisWare usb_dev_bulk example.
    http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/324922.aspx

    Tsuneo

  • Tsuneo Chinzei said:
    Without taking root on your Android, you may run USB host on it using standard APIs.

     Hi Tsuneo, in first happy to see you again here and than a lot for all useful information about how to use.

     First attempt to connect something to USB port failed, I got cablles from EKC-LM4F232 and I discovered USB host cable has a different connector from normal device I was thinking OTG too.

     So this socket fit in Tiva Device Launchpad socket but not in debug nor on Phone... DAMN!!!!

    http://en.wikipedia.org/wiki/USB from bottom of page compatibility table plug are of type micro-A micro-B, receptacle are micro-AB and micro-A (the one mounted by my phone) so I have to search if a cable exist mating micro-A plug with standard USB-A female...

  • Ah, most of Android phone, including Google Nexus series - reference design, have micro-B USB receptacle, which works as an OTG port. To connect a device to your Android, you’ll need a specific cable, micro-B plug to standard A receptacle. This combination is out of USB standard. But I believe you’ll get it easily in your PC/phone store nearby.

    Tsuneo