ge0rg / samsung-nx-hacks

Firmware Hacks for the Linux-based Samsung NX mirrorless camera models (NX300, NX2000, ???)
115 stars 11 forks source link

Finding the Serial Port / UART #7

Open ge0rg opened 8 years ago

ge0rg commented 8 years ago

The Bootloader performs logging over the serial port, and allows limited interactive access. Therefore it would be great to locate and document the serial port.

Possible serial port locations:

  1. 2x4 contact pad on the mainboard (iFixit tutorial with pictures)
  2. On the Micro-USB port, using a port multiplexer (like Nexus S / Galaxy Nexus or Nexus 4)

There is an external shutter using the USB pins in a way comparable to (2), so chances are that a different resistor value will actually provide UART access.

A brave person is needed to either risk their camera by trying this out or to disassemble it and make high-res photos of the PCB. Moderate-quality pictures exist, but don't allow to identify all chips, especially an eventually existing USB multiplexer.

ge0rg commented 8 years ago

After verifying that the NX300 uses a TI TSU61111a USB multiplexer, and that it supports resistor-based port switching, I was brave enough to attach a USB-OTG-UART cable, and tested 150K and 620K resistor values, which should trigger UART and BOOT-UART modes, respectively. Unfortunately, there was no serial output on either.

However, the Linux kernel on the NX300 reported the following in dmesg, when attaching/removing the cable:

[   17.385776] not surport
[   19.435360] not surport

This is output by arch/arm/mach-drime4/board-d4-nx300.c if the detected USB mode is neither USB nor ETC (charger or audio), leaving A/V and UART as the possibilities.

ge0rg commented 8 years ago

I also tried this approach on the NX500, but it doesn't even put anything into dmesg :'(

vasile-gh commented 8 years ago

OTG cables have the ID pin internally shorted to GND so regardless what resistor you put, it won't change impedance on that pin.

You need to start with a normal cable and put the resistor between ID and GND pin. Also, if you put the cables when the camera was already booted, it was useless. You need to power on the camera with the cable plugged in.

ge0rg commented 8 years ago

Sorry for the confusion. This is not a real OTG cable of course, it is a micro-USB connector soldered to a breakout board, with actual resistors connected. It was prepared by a friend as I totally lack soldering skills, so I can't change the resistor values besides the two I tried.

Lehkeda commented 7 years ago

@vasile-gh hey, sorry for annoying. I've tried to put 150K resistor between GND and ID pin to start uart serial debugging for my device (samsung galaxy star gt-s5282) but it doesn't work and I even tried to use jig dongle to enter my phone to download mode and it didn't work. I think the problem is with ID pin on my phone so is there anything I can do do check where is the problem ? (btw, the phone is fully working and it can be charged and connected as mtb too)

Nikolas-LFDesigns commented 7 years ago

to start uart serial debugging for my device (samsung galaxy star gt-s5282)

wanna get to bootloader? Use ODIN instead. Because, you know, it's an android phone, not a fancy camera with linux.. If you insist on UART connection, I would search along the lines of service manual, which contains information about pins and so on.

Lehkeda commented 7 years ago

@Nikolas-LFDesigns use odin to debug the phone ??? can you send me a link to start with ? I wanna port higher version of linux kerrnel for my phone for learning purpose that's why I need uart connection.

Nikolas-LFDesigns commented 7 years ago

@Lehkeda well, that's a better definition of intent, ok.. tools like ODIN would only go as far as to boot you into the only known bootloader - Samsung fw loader ;) that of no use in debugging, yeah. As my suggestion stands, I would look for a service manual of sorts which occasionally published for phones. Another debugging method would be file writes at crucial points, the only downside of that would be that at least inital fs should exist by then )) Anyway, this is going to be offtopic here, XDA-developers would be a better place for that sort of things.

Lehkeda commented 7 years ago

@Nikolas-LFDesigns thanks for help :)