simultaneous USB-OTG and charging


Question

I'm trying to charge my Nexus 7 2013 while using USB-OTG.



I built the widely described Y-cable that does USB passthrough, grounds the sense pin (yellow lead) through a 100 k resistor, and connects red and black to a charger. Charging worked, but the tablet wouldn't recognize OTG devices.



The tablet does recognize OTG devices through a Samsung OTG adapter (EPL-AU10WEGXAR). So I thought, hey, downstream of the adapter let's just put a USB-A male-female 4-lead extension cable, and tap into its red and black to add a charger.



But even without a charger, the extension cable breaks OTG. Even though it works when inserted between a thumbdrive and a PC. It's just four conductors. The tablet should have no way of detecting it!



Works: tablet - Samsung adapter - OTG-device.



Fails: tablet - Samsung adapter - extension-cable - OTG-device.



How might I debug this, or otherwise make progress towards simultaneous OTG and charging?


Answer

There are two different questions here




Fails: tablet - Samsung adapter - extension-cable - OTG-device..... (But) it works when inserted between a thumbdrive and a PC





  • Android devices support USB host mode ( connecting a USB keyboard or mouse ) as well as USB peripheral mode ( example you can plug it into a PC, so the PC can access the phone's storage)


  • USB OTG cable facilitates the connected device to work in host mode


  • PCs always run in host mode




Source: What is the difference between USB On-The-Go (OTG) and USB Host Mode?



So when you connect using an extension cable to a PC, there is no issue in detection by PC which is always in host mode.



Now, coming to the bit of why extension cable breaks OTG



From an electrical perspective, which is well explained here




To avoid potential conflicts regarding which device is host and which is peripheral, the assignment of which device is A or B is determined by the orientation of the OTG cable. This cable determines whether the signaling pin of the port it is plugged into is left floating or is pulled to ground. The device with the signaling pin pulled to ground is designated the A-Device, or default host, and the device with the floating signaling pin is designated the B-Device, or default peripheral.




By adding a USB-A male-female 4-lead extension cable to the OTG cable, you are not extending this port detection mechanism to the other end. Hence it fails detect connected device



Ii is better to shop for a longer 3 metre OTG cable instead of attempting to increase the length as experimented




Charging worked, but the tablet wouldn't recognize OTG devices




As explained in Powering a Nexus 7 tablet through the USB port while simultaneously connecting a USB device :




.... While you can purchase various kind of “OTG” Y-cables, which purportedly will allow you to use an external device (or even connect to a USB hub so you can use multiple devices) while at the same time allowing a charger/power supply to be connected, this doesn’t work with a stock Nexus 7.




(Emphasis supplied)



This is a kernel limitation and you can override that by rooting and flashing a custom kernel as explained in the linked article






Additional reading:




  1. USB on the go standards


  2. From SE Electronics: Can an Android tablet serve as USB Host and be charged simultaneously through a single port?



Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes