Insei / linux

Linux kernel source tree | WIP for Tegra T124 mocha board
Other
3 stars 3 forks source link

how to enable UART debugging #1

Open linsmod opened 1 year ago

linsmod commented 1 year ago

Hi there,this is my failure “build and run” test,I need your help!

I built the los18.1 ROM successful with kernel branch/revision mocha-5.4.y,and with the known working version of the device repo and the vendor repo for my Xiaomi mipad1 device,

this is the roomservice.xml and the kernel is not shows here because I put it under kernel dir using git clone.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
        <remote name="github-mirror"
                fetch="git://localhost/github"/>

        <remote name="gitlab-mirror"
                fetch="git://localhost/gitlab"
                />

        <project revision="lineage-18.1"  path="device/xiaomi/mocha" name="Dargons10/device_xiaomi_mocha-nexus9EGL"
                remote="gitlab-mirror" />

        <project revision="q" path="vendor/xiaomi/mocha" name="Dargons10/vendor_xiaomi_mocha-nexus9egl"
                remote="gitlab-mirror" />
</manifest>

I installed the ROM, and I try to start it, it shows the MI logo screen then a linux logo splashed one second,

after that,it becomes and keeps BLACK screen like dead,I takes some pictures for my doing, this picture is from a video screenshort, it shows the result.

Screenshot_2023-09-25-13-20-07-76_99c04817c0de5652397fc8b56c3b3817.jpg

I can restart it after shutdown it with a power button press that requires long press more than 10s.

When I was reading the commit message of this repo, I noticed that we may debugging the kernel through the headphone interface(4 line audio connector), then I find out my old LP2303 connector, it can still working. it echos what I sent when connected the RX line to the TX line.

Due to my unknown about which line is rx and which line is tx from the headphone inteface out, I tested all possible line order combination modes, however no data comes out from any of them. even I tested all 4 line.

These data is only represent wrong data when I was switching the line order combination, nothing is returned actully. my test step is: switched to the next line order, shutdown the pad then press the power to restart it.

IMG_20230925_125758.jpg

I don't know if I missed something in this steps, so I asked help on you.

And these pictures show the steps I have tried.

IMG_20230925_125916.jpg

IMG_20230925_125458.jpg

IMG_20230925_125740.jpg

IMG_20230925_130206.jpg

IMG_20230925_130218.jpg

IMG_20230925_130339.jpg

Insei commented 1 year ago

Hi @lintrust, nice description! But sory UART works only if you have ISL54062 chip on S700 place, this chip has some revisions of MiPad 1, but not all, but this is a not big problem! You can use test points 703 (TP703) and 702 (TP702) to connect to UART0 without this chip. Advanced info in attached scheme.

schematic_Xiaomi_Mi_Pad1.zip

About Android: I couldn’t launch it, there are a lot of questions and difficulties with video drivers, we need to pair andorid + mesa + gralloc + nouveau. Old android device trees are not compatible with this kernel, otherwise with this kernel you will have to create the android_device_tree from scratch. But @arttttt has already tried to do this, and we even build TWRP recovery on this kernel, you can look at the work in its repository, but it’s not a fact that they will work) https://github.com/arttttt/android_device_xiaomi_mocha_mainline

linsmod commented 1 year ago

Hi @Insei , you're right, it did not have that lsl54062 chip. Thank you for your Advanced information!

IMG_20230926_083304.jpg

So then, if use the TP703 and TP702,should we got output without making any kernel changes?

I ask this is because that I made some tweaks to export the two pins today. Then I tested the uart again after all things done. Still nothing output to the console. IMG_20230926_100155.jpg

IMG_20230926_144945.jpg

IMG_20230926_145002.jpg

IMG_20230926_152720.jpg

IMG_20230926_152738.jpg

I have checked the printk flag, it's on, so the configuration of the kernel maybe OK.

This failure may comes from my unknown mistakes on device tweaking or missing adapting to the kernel side, I think I need an old but valid kernel to confirm which cause it firstly.

Another question is that I am not sure if this kernel is set to print debugging message using the uart interface, does it print use uart?

Insei commented 1 year ago

@lintrust Have you connected GND of your UART reader to the GND of the tablet?

linsmod commented 1 year ago

@lintrust Have you connected GND of your UART reader to the GND of the tablet?

No, only two data pin exported.

Let me test it with the audio GND.

linsmod commented 1 year ago

Thanks the good tweaking design by myself.

before: IMG_20230926_152720.jpg

now: IMG_20230926_184228.jpg

One more question, the audio connector should be 4 pin, but in this device has 2 more. it has 6 pin in total.

Do you know about this? I can only guess that, it may be used to do connection state testing for better user experience.

OK, let's start testing uart with the GND.

linsmod commented 1 year ago

Still noting output.

I have a idea,we can write some thing to UART in a good rom use Android APP,but not sure which app I should use and if it can be done by that way.

linsmod commented 1 year ago

IMG_20230926_233000.jpg

I got an Android serial port api,it contains this sample APP. May helps for testing.

We can build a SmokeKernel with UART enable,right?Or the UART is enabled by default in SmokeKernel?I don't know.

None of these interface is designed to be able to transmit data over UART, perhaps I guess, based on my preliminary test on it.

When the overall architecture and implementation of these general data protocols are not clear enough, and I frequently use related terms, I actually feel confused. But it doesn't matter, all this will be clear at some point in the future.

linsmod commented 1 year ago

Fixed a device tweaking problem:

The copper sheet on the other side of the relay circuit board coated with copper on both sides was not handled properly, which led to a short circuit.

Then I build the serial api, Echo test is passed but the connection is not much stable sometimes.

IMG_20230928_103105.jpg

This runs on los 16, use ttyS0, should grant permission by using terminal App or adb shell

chmod 777 /dev/ttyS0

Its not much stable,maybe some unknown problems there,Android can read what pc written but PC can not read what the Android written.

Echo testing passed on both phone and computer, however it becomes a one way connection after the line connected.

PC TX to Android RX pc RX to Android TX pc GND to Android AUDIO GND

TOO WEIRD.