Peter-Easton / android-debug-cable-howto

This is a simple how-to to create your own android kernel debugging cable using commercially available parts.
188 stars 19 forks source link

Experiment with female-to-female breakout boards #3

Open Peter-Easton opened 4 years ago

Peter-Easton commented 4 years ago

thestinger mentioned to me that unfortunately the PCB has a nasty tendency to have to dangle off the phone with all the weight of the cables added to it, and this will bend the PCB and cause it to break at its thinnest location: the plug going into the phone.

The E-Lab Bay guy sells female to female breakout boards and I managed to get a couple, which should allow me to connect the phone to the PCB with a USB-C to USB-C cable. Because USB-C to USB-C cables are included in the box with the Pixels this should hopefully work. I'm going to try to see if I can find a way to test this rig properly if I can figure out UART without needing to unlock my phone again and start over... if anyone has any idea on how to do that please let me know.

Peter-Easton commented 4 years ago

I couldn't figure out how to test it on anything else so I had to reset my phone to do it.

Looks like the Female to Female breakout boards work perfectly, provided you don't plug anything in upside-down. If the device is plugged in upside-down, it won't work because the serial wires will then be on the wrong side. Interestingly enough, Minicom won't complain about anything or show weird outputs, it'll simply stop working altogether until you get the connectors in the right way. This bamboozled me for several minutes until I tried turning the USB-C to USB-C cable upside-down and found that it worked.

This is a small annoyance but it'll be a relatively small price to pay.

Peter-Easton commented 4 years ago

As it turns out, E Lab Bay has discontinued the Female to Female boards that I used to use and replaced them with a version that has the sockets mounted on different sides of the PCB. This is version 2 of the PCB, which means I have to change the design again. I'm calling my new creation the Mk. III because this is the third time I've had to change the specification.

I'll update the tutorial with the new design shortly and probably post my .stl files in a bit.

samueldr commented 4 years ago

You may be interested in getting a user-contributed list of alternative parts that work.

This is the board I'm using successfully with a Pixel 2.

It may work better with shorter serial cables, I haven't investigated fully, but one cheap serial interface I tried it with failed to work, while another one, with short (<10cm) cables worked.

Using this breakout board as a basis, adb and rndis was verified to work, in addition to serial.

Peter-Easton commented 4 years ago

Hey, that's awesome! Certainly much cheaper than the supplier I've been with, I'll have to test those out sometime in the near future.

dsjlzh commented 4 years ago

It works! That's awesome! Thank @samueldr and @Peter-Easton very much.

pingwuu commented 3 years ago

It works! That's awesome! Thank @samueldr and @Peter-Easton very much.

HI @dsjlzh , I'm using same "Male to Female Type c Test PCB board" for Pixel 3,but only RX is worked for me, minicom can output phone's kernel output, but I can not input anything on console.

Which pins need to connected? thanks.

============== My PIN connect as below: USB2TTL GND <---> TypeC Adapter's A1. USB2TTL RXD <---> TypeC Adapter's A8 USB2TTL TXD <---> TypeC Adapter's B8

pingwuu commented 3 years ago

You may be interested in getting a user-contributed list of alternative parts that work.

This is the board I'm using successfully with a Pixel 2.

It may work better with shorter serial cables, I haven't investigated fully, but one cheap serial interface I tried it with failed to work, while another one, with short (<10cm) cables worked.

Using this breakout board as a basis, adb and rndis was verified to work, in addition to serial.

Hi @samueldr , which PINs need connected? I have connected (A1-GND A8-RXD B8-TXD) for Pixel3, now only RX is worked but TX is not worked, It can not input anything on minicom console. Thanks.

samueldr commented 3 years ago

Hi,

Followed exactly what was on the main guide. This issue is about finding appropriate alternate boards for the adapter, not for general debugging. The question is a bit off-topic.

(Further answer to @pingwuu in #7)

pandasauce commented 3 years ago

If it's only the A8 and B8 (SBU) pins that are used, the dirt-cheap Adafruit breakout should be sufficient, no?

samueldr commented 3 years ago

You probably should have linked to the exact product page(s), to reduce doubt. In this answer I'm assuming the following products:

Either of those may work to get a UART output only. The main difference with the other recommended products is that they are taps in the middle of the connection. In turn, this allows charging and other USB features to be used alongside UART.

There's also another potential issue, but I don't know how much of an issue it actually would be. In my personal experience, length of wires was an issue with UART. I had to use shorter wires from the breakout up to the UART interface, otherwise I wouldn't get anything out.

Since these products are male sockets, you would need a type-c to type-c cable from the pixel to the socket, which in turn means the SBU signals end up going that extra length.

I will reiterate again, I do not know if it could be an issue. My adapters might have been shoddy too! So your YMMV.

pandasauce commented 3 years ago

No luck with the bundled USB-C to USB-C, https://www.adafruit.com/product/4090 and https://www.adafruit.com/product/2264 on a Pixel 4a. It's either the length of the cable or something else must be going on in USB-C for this to work. Tried pulling up CC1 too for orientation detection to kick in, but alas, it didn't help.

samueldr commented 3 years ago

AFAIUI SBU is orientation dependent, and never gets switched around, be it via hardware or software... I'm really not a hardware person though so my terminology is all over the place.

So you have to have the connector connected in the correct orientation for this to work. The debug cable is orientation dependent.

Though yeah, from my experience I kinda assume here that the length of the USB cable may be the main problematic part.

While a passthrough breakout board that allows you to tap off of the connections is better, the next best thing I guess is a male type-c connector board. As this should allow you to reduce the wire lengths to a minimum.

Peter-Easton commented 3 years ago

Hello @samueldr, sorry it's taken me so long to get to this. I will confirm that the USB-C-to-C cables sold by Google and that come in the box are not fully traced. They have the correct tracing and wires to run fastboot functions such as enabling the UART, and flashing the operating system, but they cannot be used for debugging. I forget which wire they are missing and I don't have the equipment to test it anymore, but they cannot be used with USB C-to-C breakout boards.

samueldr commented 3 years ago

Right, same kind of issues marcan42 was facing with the M1 shenanigans. If SBU lanes aren't available down the entire length, obviously(?) that won't happen.

Though note that my suspicions about wire length being important may still apply.

I am additionally basing my assumptions on this picture, which shows the board connected directly to the port, and not at the end of a cable:

It is unknown what exactly this adapter is, whether it's a Google-made design or another design.

pandasauce commented 3 years ago

That adapter looks like https://github.com/google/usb-cereal

samueldr commented 3 years ago

Oh, nice catch.

This does show that SBU1/2 are handled directly in the adapter. So my assumptions still holds, about total length the SBU1/2 signals can travel.

OH, this is a new repository, only 28 days old!