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.

TM4C129ENCPDT: How to turn an android tablet into USB human interface device

Part Number: TM4C129ENCPDT

An android tablet is the combination of high end human interface devices, such as speaker, microphone, display and a touch input.

I have a project where I want to use the Tiva MCU as the core and an android tablet will be connected to MCU via USB. The MCU will be the USB host and the tablet will be enumerated as 4 USB devices: speaker, microphone, display, and input. The tablet will be powered by the host. The idea is to take advantage of the tablet hardware so that the development can be focused on the function(not the UI part) only .

Is this a viable path? How much the Tivaware has supported for this? What is involved in android APP development in terms of USB handling?

Thanks!

  • Hello Tianlei,

    To be wholly honest here, I am not really certain if this is viable at all. I don't have enough understanding about Android to really say.

    If by attaching to USB you can access those features as HID devices, then it should be, but I am not sure how to make the Android tablet spike out those features as HID devices which a host device can attach to and enumerate. If what you are wanting to do worked by default, then you plug in your tablet to a Windows PC, multiple devices should enumerate and PC should be able to use them but that is not how it works from my experiences.

    So you'd need to figure out the Android side for one.

    As far as from TivaWare, if the Android works as a standard HID device then we can support audio. Display & touch input would not be covered under usblib, but some display is handled by grlib. But grlib typically interfaces with an LCD direct either with EPI or SPI. Not with USB. So you'd have to handle adding a USB layer there.

    Overall, this would be very difficult to do. I don't think our offering is really set up to support such an application based on how you have laid it out. But I am not sure of alternative suggestions to make either because it is unclear how to tap into Android speaking/display/touch inputs via USB.

  • Thanks Ralph! Your input helped me understand what I can do on TI's side. Maybe I can keep this thread open for a while so people with related experience can feed.

  • If you want an HMI, you'd probably be better off actually using one depending on what your exact requirements are. You can get off the shelf HMIs with a wide range of characteristics using relatively simple protocols. You can use ethernet but CANOpen and RS-232/485 Modbus RTU are readily available.

    Using a tablet may be trading purchase cost for development time (and might not buy you cost savings depending upon your needs). And if you need a rugged display it's probably not going to be a tablet.

    Robert

  • Monsieur Adsett,

    Should not this poster be commended for his imaginative, resourceful & (potentially) disruptive, "Probe for an advantaged solution?"    While "weaknesses" exist w/in poster's idea - it does include "powerful, built-in 'Features, Functions & Benefits' - unavailable elsewhere!"   

    Usually - when evaluating such a, "Break from the (same old)" it proves wise to, "seriously weigh" the proposal's "pros & cons."    The degree to which the poster has progressed in this "weighing" is unknown.

    While supportive of the poster in general - my young staff "recoils" from poster's, "I have a project where I want to use the Tiva MCU as the core and an android tablet will be connected to MCU via USB."   Should it be mentioned that even a, "50 (USD) tablet" includes an ARM MCU - many times more powerful than (any vendor's) ARM Cortex M4?   

    So - what to do?    (beyond generate a, "Full & Proper" Pro/Con Analysis.)   Might there exist some "inspired Hybrid method" - which maintains (and exploits) the tablet's enhanced core - yet accepts "direction" from a lesser MCU?

    Is this path not superior - while aligning w/poster's stated goal?    (but for the core-reversal horror...)

  • cb1, you really want me to rant don't you? Maybe when I need a break.

    Robert

  • Monsieur ... moi?    Seriously?    Might the (early) stages of virus confinement yield, "Stir-Crazy" tendency?

  • OK, since cb1 asked so nicely I will amplify on my original statement.

    First cb1 has a point about the idea of looking for alternatives is a good idea.

    Now as to why I think you probably won't find it advantageous:

    There are multiple kinds of HMIs from simple switch, dial and lights to full touch screen running a "proper" operating system. there are in addition SCADA interfaces that are more upper level computer systems with high level remote control and trend and data analysis. Now since we are talking a USB HID slave connection I think I can fairly eliminate these higher systems although there is a subset of these (the display of remote data and tend analysis) that a pad could do well provided you can supply sufficient security. This would not be using a USB interface though.

    HMIs vary on multiple fashions. Resolution and size of the display (and whether the display is graphical), whether it has a touchscreen, what physical and logical communications they support. You can get an HMI that is text only, non-touchscreen, room temperature and only supports Modbus RS-485. You can also get an HMI that supports multiple CAN, Ethernet and serial ports running Linux (including Qt) with a graphical touchscreen, buttons and multiple camera inputs that is hardened to work in an outdoor vehicle environment. The price varies accordingly.

    There is one characteristic of HMIs that is near universal (and for good reason). The HMI is almost always the 'master' on its communication port. The reason for this is to reduce the communication complexity on the controller. The controller is a real-time system, often with limited resources (which is why modbus RTU is still very popular). Other than communications the HMI does not suffer these restraint. They must, of necessity, have the resources to manage the display and input. This means that they must have relatively powerful processors and significant amounts of memory, particularly for the higher end versions. A pad acting as a USB slave reverses this and places an extra demand on the controller do not only to the task for which it is intended but also it now has to mange the HMI interface. Now this could be reversed but basically by imposing another proprietary protocol on top of the native USB HID protocol but you've just added to your development burden.

    So I'd place the HMI advantages as

    • It already works
    • You can get a wide variety of variants, all of which will support the same protocol. This not only makes replacement of broken HMIs easy it makes it possible to replace and existing HMI setup with one of lower cost or of greater capabilities.
    • Development of the interface is separate from the control. I've literally gone from a new HMI and development system to a working HMI in a few days. Beauty be damned :). If you are capable of doing good graphics and interface design then there are HMIs that will allow that.
    • Communications protocols are widely available for implementation on your micro (Modbus-RTU is well documented)
    • HMIs avail that are hardened against temperature and other environmental characteristics, including IP65 front faces.
    • Physical mounting is designed into HMI enclosures

    Disadvantages

    • May be higher cost for equivalent graphics

    The cases where I can see a tablet being useful are

    • Your time is free and unlimited
    • It's a research project where you are trying to prove that it's possible

    You would usually add the case of the volume being so high that the cost saving per unit of the tablet outweighs the development cost. I think that in this case though the advantage leans to a full custom rather than a hacked pad.

    Robert

    Stir crazy enough?

  • "Stir Crazy Sufficiency?"

    Never a doubt - proves that the "killer virus" can survive (even thrive) in your "Canadian Tundra environment!"    Caring young staff asks, "For how long have you presented w/these symptoms?"   Their scan of "Google Maps" reveals a, "Faith Healer" - just a few (snow/ice covered) blocks - from your "WFH" outpost.   Staff further asks, "Do you own a shovel?"  (Hapless post-person's (snow-banked) path proves (massively) blood-stained ... )

    Crack staff "promises" to return tomorrow - (maybe) - they will present their, "Business/Financial-Sense Case" - even to this sparsely populated (31 meager views) court-room...   (notably the original poster has, "Jumped Ship" ... must have learned of Bob's (fine) sailing...)

  • Bonjour Monsieur,   (beloved, now departed HS teacher would be SO proud)

    Young staff strongly believes that, "Further Enrichment" of the original poster's thread makes little (i.e. no) sense!

    • poster's "How To" request has been (properly) upended to (more fundamentally) "Should such an approach be (even) considered?"
    • original poster - despite (earlier) inviting comment, "People with related experience can feed" - has "gone silent!"

    Staff proposes a new thread - under a "Far more reflective of content" name: 

    "The Critical Nature of, "EARLY-ON DECISIONS" upon MCU-Based Design/Development."

    Hopefully you agree - if so - we will "import"

    • staff's "baiting post" of Tue, Mar 24 2020 6:53 PM  (worked - did it not?)
    • your insightful/excellent (yet oft misguided) post of Wed, Mar 25 2020 7:19 PM 

    as preamble - prior to our latest silky yet, "knife-edged, dead-on, inspired Staff content..."

  • So the first question I'd ask, because I don't know the answer, is: 

    Can the Android tablet act as a USB device?

    Remember, you want the Tiva to be the USB Host. This implies the Android must be the Device.

    If the tablet cannot act as a USB device, then you can't do what you want.

  • Guys, thanks for the active discussion these days. The company shutting down due to the pandemic delayed my response.

    I am looking for solutions to add better HID to our existing network based intercom system. The intercom devices have Tiva MCU as their core, and the HID for now are simple buttons (for input), LED matrix display(text output), speaker(audio output) and microphone(audio input).

    Since Tiva supports USB, and Tivaware support for USB is also available, I came up with this idea that we may be able to use a android device to handle all the HID tasks and leave the Tiva MCU to handle the intercom logic only. The benefits are obvious: no need to design the hardware, low cost for hardware, and potential rich user experience.

    I was think it might just be a matter of APP development on android - APP running on Android, dealing with user interaction (input and display) and acoustic audio(speaker and microphone).

    So the question comes down to what Andy said - is it possible to develop a Android APP that makes it act as USB device? 

  • My friend,

    Have you not (also) fallen into the "Self-Limiting TRAP" - so often evident here?

    Fundamental (First Order) Issues (missed here) likely should be:

    • Why limit the Tablet to "Android?"
    • And why (only) USB input?    Tablet & cell-phone "Microphone Inputs" have been exploited!
    • Why Tiva?   Especially as it presents "NKA" (No Known Advantage) in this role.

    Broader investigative paths may (often) "Shine a more focused & penetrating light" - far better equipped to satisfy poster's stated desire, "to take advantage of the tablet hardware."

    Inflicting "Early-On Limits" upon one's own design/development is not famed as a, "Roadmap to Success!"

    (Staff will no longer "enrich" this thread - a "Follow on one" - emphasizing "Issue/Problem Solving" is being completed as we type...)

  • Tianlei Zhang said:
    Guys, thanks for the active discussion these days. The company shutting down due to the pandemic delayed my response.

    Take care.

    Tianlei Zhang said:
    I am looking for solutions to add better HID to our existing network based intercom system.

    Network based? That's an important addition to your specification.

    Tianlei Zhang said:
    potential rich user experience.

    I think you need to define what this interface is to provide that makes it demonstrably superior to what you use now. I would have thought anything more that a button or two on an intercom interface would be at best superfluous, at worst confusing.

    Having said that though. If, indeed, you have a network interface for the intercom then once you add the tablet you have eliminated the need for the TIVA device as far as I can tell. The pad can provide the audio in and out and the network interface is part of the pad as well. You can get POE powered pads commercially which may fit your spec.

    The really big problem I see though, is you seem to have a partial solution looking for a problem. Rather than a problem that needs a solution.

    Robert

  • Tianlei Zhang said:
    is it possible to develop a Android APP that makes it act as USB device? 

    There IS a simple answer to your question ..."Maybe!"    

    Several years past we developed a "Tablet based application" for a client, "Desperate to exhibit at a key Trade Show."   (Their newly developed "HMI" suffered a cascade of issues - thus was too risky to exhibit.    As I've noted (several times here) we succeeded only after a "full & proper, highly focused Tech investigation."

    Some key findings:  (which I'm able to share)

    • much depends upon the chosen Tablet - not all may be "teased" into such compliance
    • similarly - an MCU which provides (some) software bridge to (specifically) facilitate proves vital
    • a "receptive" Tablet will "expose & enable" the (most always) hidden "Developer options" menu - which (then) will allow "USB debugging" on "many" (but not all) Android devices.    (phones and tablets) 
    • unfortunately - we found each "Tablet to be somewhat unique" & the overall development process was highly demanding & repetitive.   Again - the choice of the (proper) Tablet & MCU proved (both) time & effort consuming - it was only through my staff's great/skilled effort that we (very) well satisfied this (continuing) client...

    Perhaps now the VITAL ROLE of "Early On Investigation & (resulting) Decision-Making" rings Loud & Clear!    (that broader, problem analyzing (rather than problem presenting) "Decision-Making" thread has (in less than one day) more than doubled the number of visits - achieved here...)    And Good that!

  • Thanks cb1_mobile, your input is helpful and important. 

    Also thanks to Robert. 

    It looks like Android is not a good path.