yashsingh1/xdaforums huggingface dataset:
[Nexus 7 General] peterk-1:
If definitive answers to some of the issues raised here are wanted then I would recommend the Tegra 3 technical reference manual that can downloaded here http://d-h.st/MZg (it was available on the nVidia site until they were hacked and the link I've posted can be found here http://xdaforums.com/archive/index.php/t-1736813.html)

The USB section runs to 250+ pages much of which is devoted to low level programming but it starts (page 951) with readable text about what USB ports exist (1) and what can be added (2 more). There is then a fair bit about host/device mode, the usb Id pin and detection methods for compatible and incompatible chargers.

I found a few acronyms that were new but google found good explanations
[Nexus 7 General] littleguy77:
I agree this project is getting much more complex than I ever imagined. It's not the fault of the Nexus though. If you sit down and read the USB 2.0 battery charging spec, you realize how many things a single port with five pins must be able to do:

discern usb 1.1 and 2.0 devices

discern between a dedicated charger, a PC, and a peripheral attached

determine whether it should behave as host or peripheral

determine whether it is allowed to pull current from the device

discern how much current it is allowed to pull (microamps, 100mA, 500mA, 2.0A)

determine whether it should drive current to a peripheral

determine if the peripheral it's attached to has a weak battery

tell the charger/pc it's attached to that it has a weak battery

communicate up to 12 Mbps

protect itself from overvoltage, overcurrent, and ESD conditions

I don't mean to sound preachy, but with all these requirements and more, it's actually no surprise we're having this difficulty.

I'm thinking more and more that your microswitch idea is the way to go. The most idiot-proof, easiest solution for the average DIY is a quad-throw dual-position switch that simply switches the ID, D+, D-, and VBUS pins between the receptacle and the internal device. You either have stock behavior or you have an internal device, depending on switch state. The only thing you can't do is use both functionalities simultaneously. And you need to physically break the four traces somewhere on the nexus mobo/ribbon/daughterboard. In the end that may be the best solution given the complexity of everything.

---------- Post added at 02:11 PM ---------- Previous post was at 02:07 PM ----------

peterk that is an amazing resource. +10 thanks if I could. Will take a look tonight if possible. Might clear up everything.
[Nexus 7 General] xboxexpert:
I'm reverting to my Microswitch idea. Dock is already in the making so I'll get back to you once I have progress on that. Keep the thread alive with ideas if you wish.
[Nexus 7 General] littleguy77:
Cool, wise move I think. I've narrowed my choices down to the quad-throw microswitch w/ internal card, or nothing at all. Leaning toward the latter since I may build a dock, which would provide a third alternative.

xboxexpert, I think I have the same micro-b plug that you show in the first post. Would you mind taking a close-up shot of it, or describe the pin connections on the solder end? I could probe them out but I'm afraid I'll get something backwards.
[Nexus 7 General] xboxexpert:
Here you go;
[Nexus 7 General] iAppleDev:
Is that just the ID pin going to the a single switch. So its a switchable OTG. Nice work.
[Nexus 7 General] xboxexpert:
Yea pretty much the easiest mod you can do and it definitely will all fit internal if I were to get a slimmer USB MicroSD Adapter. Kingston makes a pretty slim one that will fit internal.
[Nexus 7 General] iAppleDev:
I found the one in this post fits best for me:) http://xdaforums.com/showthread.php?p=31576415
[Nexus 7 General] xboxexpert:
Nice just grab a microswitch dude and your golden. I pulled this off a PCB board I wasn't using and clipped the extra pins. I'm sure you can find one on www.mouser.com perhaps even smaller. I bet you can even do something like this. Open your mind I'm about to blow it.

Do you know how they have those MicroSD adapters for phones that click when you plugin the MicroSD then if you push it in again it clicks to eject. I wonder if you can utilize the "click" mechanism as the "switch" for OTG. So when it clicks in the OTG is enabled and when you click it to eject the OTG is disabled. This will enable you to just eject the microSD to enable charging.

P.S, looks like I have the same MicroSD adapter as you see attached.
[Nexus 7 General] littleguy77:
Really cool idea combining the ejector with the microswitch! And thanks greatly for the closeup pics.
[Nexus 7 General] forexamplejohn:
Hrm. Look at

/ProductDetail/ALPS/SCHA5B0200/?qs=sGAEpiMZZMuGq%2fv7cZsUqwqDtAl3tPtl prepend mouser dot com to this, XDA deems me too newb to linky.

,and the associated datasheet.

If I'm reading this right, it's the push/push click type, but crucially, it already integrates a switch that's closed when a card is inserted, and open when not. So, we'd have have the otg detect pin short to ground pin w/ card in, eject card to exit OTG mode and charge.

Aspect of this that really matters to me is, can a custom recovery such as TWRP/CWM read OTG drives? Mainly running out of space on the nex7 8gb not because of media - I don't store any locally - but from backups . If I can't store and restore backups on an internal OTG drive, then some of the appeal goes away.
[Nexus 7 General] littleguy77:
Nice find.
[Nexus 7 General] erica_renee:
twrp 2.2.2.0 uses usb otg for backup/ restore and Can install from it.. I have done so many times.. But you MUST use extreme caution to never unplug the card without the device being off.. The only way i have been able to keep from having data corrupt .

Boot into android Plug in otg with sd card .. boot to recovery backup flash and so on . then shut down and remove the sd card.. Only use that sd card for twrp... I have tried storing ti backup on same card and it gets corrupt . Go figure..

AWESOME WORK GUYS.. i actually was going to order some the above and the usb micro plug to make a very slim ota external storage..

my question is .. using the above sd card adapter You still MUST !!!!! UNMOUNT STORAGE before you can change from storage and charging. OK The question is .can some type of logic timed switch be used and programmed to unmount then trigger the drive to be released .. Kinda like pushing the eject button on a dvd reader on a pc.. If its reading or writing it will not eject until its unmounted ..

Or am i asking for WAY TO MUCH..
[Nexus 7 General] littleguy77:
It may be possible, but we are a long way from that sort of thing. We're still trying to get a simple configuration that provides basic functionality.
[Nexus 7 General] xboxexpert:
You cant trigger the mechanics of the switch. I've ordered 5 from Mouser to play around with but the thing now would be the conversion of pins. This in theory will work just fine to insert and remove but we need the portion that converts the 8 microsd pins to 4 USB pins.
[Nexus 7 General] erica_renee:
Ok i did not explain this very well.. That does the hardware side and wiring as well as the switch from charge to data pin..There needs to be some type of cache on the sd card. when the switch flips the logic will shut off data transmission and the systems otg service so to speak. the cached data will Stop corrupt sd card.

This would be some type of logic chip between the mechanical switch and the software in the device that senses the change on the sense pin..

I can remember stuff like this in a automation class i tool Many many years ago.. I have forgot most of what i learned but it seems like its something that should be easily doable with todays hardware mod tools...

Maybe im dreaming But i do know a usb doc has to use this type of caching . Or maybe something i do not know about..

Sorry to try and complicate this.. Just a though that popped in my head after almost wrecking several sd cards from forgetting to un mount them.. GRRRR on my part ..

thanks for hearing my thoughts . Erica Renee
[Nexus 7 General] nst6563:
@ Erica_renee

I've been using a slim otg modded usb flash drive for a while now and haven't once had it corrupt from unplugging without unmounting first. Maybe I'm just lucky. It's a sandisk micro-drive. Here's a picture of it

I simply removed the outter shell of it, wired up the micro-usb connector and glued it to the flash drive. I thought about cleaning up the wires a bit more so I could also insert it back into a computer, but I only use it for the N7 anyway and haven't gotten around to it. The drive itself is a 16GB Staples brand flash drive, yet when you crack it open the chip says Sandisk. Not bad for picking it up for $9 on sale.

If you have system tuner you may be able to adjust the sdcard cache for the external drive to something smaller in an effort to have it flush faster and with not as much data. With mine I've simply waited until the light quit blinking.
[Nexus 7 General] DerekC:
Could have totally missed it but would there be a way to wire the power from the mirco usb to the pogo pins so that you can charge and use the usb OTG. I'm really bad at this stuff but this thread make me want to buy a N7 and start soldering.
[Nexus 7 General] marakji:
:cyclops:

please correct me as am trying to understand whats going on here

If our goal is to mount a storage to this device using the method of OTG cable i was thinking about

solder something straight from the Pin of the entrancef of the OTG cable. going to the storage in between on the power line to the storage we build a resistance board, that regulate the power that goes to the storage to 5v 2 A this way will never loose power on the storage.

and when the charger is hooked the resistance board will route the current to go back to the board.

i haven't been in electronics class from more then 15 years so please correct me
[Nexus 7 General] forexamplejohn:
I bought some from mouser as well. Also bought a nex 7 w/ a broken screen from fleabay to mess with. This will get done.

As mentioned, yes we'd still need a microsd to usb method, but I plan on just using one of the duracell usb reader types, stripped. Don't think room will be an issue.
[Nexus 7 General] xboxexpert:
Got any place to buy replacement screens from yet?
[Nexus 7 General] forexamplejohn:
Not that I know of, no. I don't expect to find any for a decent price anytime soon either. From what I've seen, only the iphones have enough single model volume to make third party Chinese replacement screens affordable. That's one thing I liked about iphone, when I cracked my screen, for $30 I was able to replace it. Haven't broken one on an android yet, but looking at the prices...yikes.

So yeah, I didn't buy the broken N7 to repair it, but rather to provide backup parts in case I hose something while modding my non-broken n7. There are a couple sites one can get parts, but stock is low and prices are high. They're all scavenged.

*edit - check portatronics - $219 for a replacement LCD. lol. Anyone want to buy a $5 bill for $10?
[Nexus 7 General] xboxexpert:
I think if we can pinout HDMI broken screen units can be extremely valuable.
[Nexus 7 General] forexamplejohn:
as what, HTPC's? Most of the cracked ones still turn on/charge and everything else, but touch goes away. It's enough for testing things. One would still be able to see a USB device mount w/out needing to touch. Doubt HDMI can be output, LCD controllers are friggin hard things. For years people wanted to repurpose junked laptop lcd's as desktop lcd's, back when desktop lcd's were really pricey. Never happened.

Nex7 doesn't even do MHL...
[Nexus 7 General] xboxexpert:
I just may pickup a couple of these boards as well, to test.

https://www.sparkfun.com/products/10968
[Nexus 7 General] xboxexpert:
I figured a USB Hub and KB/Mouse could be pretty useful even if a touch screen didnt work, no?
[Nexus 7 General] forexamplejohn:
Ooh, anyone know a reason it would not work? Grabbing one as well. Can find a use for it somewhere..

Oh, true.
[Nexus 7 General] nari:
Very Cool!
[Nexus 7 General] forexamplejohn:
You know it's cool when a guy who registered in 2005 declares it w/ his 4th post in 7 years
[Nexus 7 General] xboxexpert:
That made me smile...and I thanked you.
[Nexus 7 General] armyboy11b:
Congrats on ur 9th post since 2005 :)
[Nexus 7 General] Kalavere:
I've just read the eight pages, I've yet to receive my Nexus (should be here some time today), but root and a custom ROM to match my Galaxy Nexus is definitely in order. This is a very exciting project, keep up the excellent work. :victory:
[Nexus 7 General] xboxexpert:
Just to keep everyone on their toes. Attached are the pics of the push/click microSD adapter.

What we are now trying to accomplish is internally setting this up. I ordered a microSD reb mount connector that will allow a ground to be present once the memory card is inserted. This will allow me to utilize the points for SWITCH and enable disable OTG mode. I also ordered a 5v step-up board to test another theory I would like to put in place, in short, not utilizing OTG mode at all.
[Nexus 7 General] xboxexpert:
You know you can set your preferences for this site to view like 50 posts per page. I have that settings setup and this thread is only two pages for me.
[Nexus 7 General] Kalavere:
Aye I know, I find it's easy to get lost in a sea of posts when it's set to so many per page.
[Nexus 7 General] ozzy666:
hope u will complete it soon! good luck!
[Nexus 7 General] xboxexpert:
I hope so too. Could you edit your post and remove the big pictures from my original post so it doesn't kill users who view.
[Nexus 7 General] 640k:
I think I'm lost on the internal part of this equation. What's the plan for accomplishing this feat? Cut a slit in the back cover? Make it so the back cover has to be removed to use the SD card? Just curious on the thought process.
[Nexus 7 General] Kalavere:
I think that's just a possibility. It's not something I am interested in, I am however interested in the possibility of hooking up a hidden 32gb SD card that permanently sits under the back cover.
[Nexus 7 General] xboxexpert:
I have not yet worked out exactly how I would be mounting it but these microSD connectors are extremely slim so I would think a small slit would be perfect and this either mounted directly on the back or internally. I noticed that the HDMI version of this device that was showed by the presenters had a HDMI port somewhat where the internally speakers are now housed...I was thinking of cutting a portion of the speaker and mounting there. I'll let you know when I'm ready the next few days I will be unavailable.
[Nexus 7 General] BikerBoy030:
This is exactly what I want to do:)

Gesendet von meinem Nexus 7 mit Tapatalk 2
[Nexus 7 General] Mechanio:
If we can get it to work at all, whether you use it internally or externally will be your choice.

Mount it externally and you've basically got a modded OTG setup that solves the power problem, or you can cut a slot in the back to add the SD slot that many feel should have been in the device to begin with.

If you don't want to cut the back for aesthetic or warranty reasons, you can mount a swappable card slot inside and take the cover off every time you want to swap cards.

Mounting it internally, permanently, you only have to take the back off once to install the hack but you won't be able to swap cards in and out. So why bother mounting it internally? Right now you can buy an 8GB Nexus 7 for $200. You can pay another $50 for the 16GB model, or - if we get this figured out - you can buy ~$30 worth of parts, open the back once to install the hack, and turn your 8GB model into a 40GB model. Which would, in my opinion, TOTALLY ROCK. ;)
[Nexus 7 General] bigbop:
Would you be interested in taking a close look at the 24pin connector pads on the bottom of the main board by the RAM? That is where Asus originally plugged-in the daughter board of the original device Google used for the Nexus. That board has USB, micro-sd and micro HDMI ports. It would be great if someone in Asia, where that unit was sold could reverse engineer the daughter board.

Personally, I ordered a T101 camera to see if I can interface to the rear camera connector on my Nexus

In fact, I just noticed the 22pin connector in our photo. I'll have to do a little probing of that.
[Nexus 7 General] TheBigJ:
Just an idea, but could we not have a special Kernel version, that allows to set one of the unused pins to high or low?

With the help of a transistor we could than replace the physical switch and instead get a app/widget that allows for the internal change.
[Nexus 7 General] bigbop:
OH WOW!!:laugh: This appears to be the PDF of the Nexus 7 schematics!! Better grab the file before XDA gets a takedown notice......

If you examine the block diagram of the 1st page, the HDMI and SD card interfaces have hash marks across them. They were present in the original ME370T so these are most likely the Nexus 7 drawings.

The rear camera is present and is shown as an OV5650 on page 31.

Interestingly enough, I just ordered the 5MP autofocus camera module from a TF-101 from eBay and with these schematics, I might actually be able to interface it to my N7. I wonder if the kernel driver is already there.

Page 40 talks about removing the FM radio audio interface - so the radio might just be there, just the parts to connect the output to the audio DSP are missing?

Unfortunately, page 15 with the SDcard info has that area X'ed out & page 46 with the HDMI info is missing.:crying:

The 22pin CON1 connector is ahown on page28 as are the 4 docking pins. Too bad - the docking pins are L&R audio, +5v & gnd.

There were originally 99 pages according to the block diagram but the pdf only has 44 pages.

On page 24 of the PDF, that 24pin J1 connector I talked about previously by the RAM is shown - it's a JTAG and SERIAL IO connector!

Serial:

Pin 2 - Tx,

Pin 4 - Rx

JTAG:

7 - TCK

9 - TDI

11 - TDO

13 - TMS

15 - TRST#

17 - RTCK

19 - RESOUT#

8 - Hot RST

Thanks for the file - info posted yesterday by wired57 and today's dropbox posting by nst6563

Cheers
[Nexus 7 General] nst6563:
That's the most complete info I could get from that side. It was in Chinese, and I lumbered through to download it. Maybe there's a more complete version floating around out there.
[Nexus 7 General] bigbop:
How did you download it?

I logged in to Baidu and was able to d/l other docs, but not that one.

Something about: Required Caifu Zhi: 5 ??
[Nexus 7 General] nst6563:
I started with 11 and I think I ended up using 10. Not sure...the google translation made no sense either.
[Nexus 7 General] brooksyx:
I would love to see someone sell internal microsd card readers that we could attach to this. I would buy one even if it required some soldering.
[Nexus 7 General] xboxexpert:
Just got my 5v step up boards. I'm going to wire them in tonight and see if I can get 5v that works from the 4v that's there now.
[Nexus 7 General] xboxexpert:
5v step up works just fine but the d- and d+ are floating....trying to pin them out internally off the chip and catch them before they hit the points by the power adapter...
[Nexus 7 General] pokey9000:
More importantly, it looks like the same UART pins on the debug connector are routed to the headphone L/R pins as well... Also it's clear now that the dock pins are strictly power and analog audio out. And as people have already guessed, holding VOL UP on power on starts APX mode, as there are a couple of FETs that debounce and set the USB boot mode pin (NAND_RE#) when it's held.
[Nexus 7 General] xboxexpert:
At least this thread was good for something, lol...
[Nexus 7 General] bigbop:
If you look at the schematics for the device, there seems to be a reference to a separate charging connector that is not included in the final product. That might be the key to being able to charge while the unit is in otg mode.
[Nexus 7 General] NicoGa:
Or maybe a kernel mod can allow it ... which would mean that the switch is not necessary ?

http://mehrvarz.github.com/otg-power-nexus7.html

(i.e. this post: http://xdaforums.com/showthread.php?t=1866988&page=15)
[Nexus 7 General] xboxexpert:
If this seriously works. All I need to do is just wire up a 32GB USB Stick internally with switched OTG mode. I'm going to hit this hard tonight when I get home. I have exactly where I would mount my USB Adapter too and it WILL Fit since I've done it before.
[Nexus 7 General] karl0ss:
someone needs to build this into a case, with a microsd slot, and a charge port (maybe via the pogo's) THAT i would buy, esp linked with DirectoryBinder to move all my apps data to the usb/mircosd...kickstarter project??? :)
[Nexus 7 General] xboxexpert:
Already on it...Just need some good pictures of what I've got already. Soon enough.

-XE
[Nexus 7 General] nst6563:
I don't think the power is the hurdle anylonger...i think the only hurdle (which is a very minor one in my opinion) would be if you're going to plug it into a pc for something. I do it occasionally but not often. would almost need a dpdt switch to disconnect the internal usb.

come to think of it...if the charger's short the data pins then you'll have to use a modified cable that doesn't short the pins right - or modify the charger itself to not short the pins?
[Nexus 7 General] xboxexpert:
I'm extremely interested in creating a kickstarter program for a dock. I have the idea in my head and have already the means to make it happen. I wonder if the general public would as interested as I am to utilize the OTG technology which is already integrated into most devices. Feedback?
[Nexus 7 General] nst6563:
What functionality would you have for the dock? kb/mouse/game controller/sync/audio/charge/mass storage?

I'm not that familiar with kickstarter....time to hit google.
[Nexus 7 General] 640k:
Kick starter is used for small project funding by individuals or small organizations that otherwise would not have been able to fund prototypes/working models of a product or idea.
[Nexus 7 General] barthie:
i'm going to make myself look stupid here, but i have a question. i know ebough about electronics to be dangerous.

i've looked at some mhl adapters and i see some of them need to have a charger plugged in at the same time. i don't know if this is to solely power the adapter or to keep the devices battery from draining. if it is the latter, than the device is charging and using the data lines at the same time. if this is the case, could a similar circuit (not the mhl functionality, but to allow charging and data use at the same time) be built into an adapter to go between the device and the charger since that would be the only time this is an issue?
[Nexus 7 General] littleguy77:
Yes, an external dongle could be built. It's called an Accessory Charger Adapter according to official USB OTG specs. Look at some of my previous posts for the links. As far as I can tell, no one actually makes one however.
[Nexus 7 General] CHollman82:
Cash in hand, waiting to buy this, someone get it done!
[Nexus 7 General] Ozzie Sandoval:
I second that notion.
[Nexus 7 General] SwiftLegend:
I don't see how hard this could be. I mean a OTG adapters are pretty small already, it'd just require mounting it into the case. I have this which I would make into my own case if I had the means. I've also thought of the cheapo way of getting some velcro and attaching it to the back of my Treeglo case.
[Nexus 7 General] 640k:
Forget case, are the battery covers available for purchase? Could the cover be made to make contact with the USB pins without soldering? The cover would hold the assembly in place. That way the entire unit cold just be built in to the battery cover. Epoxy would work quite well.
[Nexus 7 General] brando56894:
The problem is that when the OTG cable is connected that the data lines are enabled and and fast charge isn't possible since two of the existing wires are being used to transfer data instead of power, so it's actually not that simple. I still think the micro-switch idea is the simplest solution.