🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Display terminal (tty) on CoreMP135 buildin display

    Cores
    3
    10
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      johan_s
      last edited by

      Hi,

      I am running a CoreMP135 with the M5 debian image (kernel 5.15). I am interacting with the device over USB-C / serial tty. How can I show the tty terminal on the buildin display? If connect an external monitor via hdmi it will directly show a tty terminal on the external monitor, can i get the same output on the ILI9342C LCD?

      Thanks

      ajb2k3A 1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3 @johan_s
        last edited by

        @johan_s You will need to create a program that to capture the the terminal and display it.

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        J 1 Reply Last reply Reply Quote 0
        • J
          johan_s @ajb2k3
          last edited by

          Hi @ajb2k3 can you elaborate?

          I think it should be possible to get a terminal on the LCD using the tools provided by the linux distribution. What i gathered from searching on google, is that fbcon can be used to display terminals on framebuffers (such as the ILI9342C). Unfortunately, fbcon is not included in the CoreMP135 Debian image. I am now playing around with the CoreMP135_buildroot repo to see if I can compile it there. I will keep digging.

          ajb2k3A 1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @johan_s
            last edited by ajb2k3

            @johan_s unfortunately I only know the theory and haven’t had much time to work on documentation as having to move my hose and office around. I started looking into the firmware and I/o control just didn’t get very far. I need to dig through not the Devicetree and display code.

            Have you tried installing FBCon yet?

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            J 2 Replies Last reply Reply Quote 0
            • J
              johan_s @ajb2k3
              last edited by

              Hi @ajb2k3 , ok that makes sense, no problem.

              Yesterday, I tried a to use the fbterm because it is included in the Debian repo (easy to install with apt), but I unfortutaly I could not get it work.

              I have been looking for fbcon in the buildroot configuration menu but I have not been able to find it so far. But I have noticed that buildroot under kernel extensions include an optoin to compile FB TFT drivers. I will try and recompile with the FB TFT drivers tonight.

              I will post updates here.

              The CoreMP135 is a cool little device, but it is not as easy to use as the other M5 controllers.

              1 Reply Last reply Reply Quote 0
              • J
                johan_s @ajb2k3
                last edited by

                @ajb2k3 OK, I figured it out using FbTerm, see my notes below. Just a note to temper expectations: The device is not very powerful (surprise). In my case, I am running Debian, connected to two tty terminals (ttyGS0 over USB-C and tty1 being shown in display), connected over WiFi dongle, and added a BT dongle for keyboard/mouse, and as a result the CoreMP135 very easily becomes sluggish and quite warm.

                Anyway, here are my notes

                Showing a terminal on the LCD TFT display

                Very briefly:

                • The CoreMP135 contains a ILITEK ILI9342C LCD TFT display with touch
                • The Debian OS recognizes as the display as a framebuffer and makes it accesible at /dev/fb1
                • Low level interaction directly with fb1 is below, see examples below. In all the included examples, I was signed in as root via the USB-C interface (ttyGS0)
                # signed in as root
                cat /dev/zero > /dev/fb1 # clear display
                cat /dev/urandom > /dev/fb1 # show random 'static' on display
                echo "HELLO WORLD" > /dev/fb1 # will show some extremely small in the top left corner - not discernible
                
                • The M5Stack CoreMP135 Debian image includes fbv - a program for rendering .jpg on the framebuffer (TFT LCD). Example:
                # signed in as root
                . /usr/local/m5stack/bashrc # prepare environment for using fbv
                /usr/local/m5stack/bin/fbv /root/mycoolpic.jpg # display .jpg on framebuffer, might only show part depending on jpg resolution
                
                • It is also possible to show a (somewhat) fully functional terminal on the TFT LCD display using the fbterm program:
                # signed in as root
                apt install fbterm # install FbTerm
                export FRAMEBUFFER=/dev/fb1 # Tell FbTerm to use fb1 as framebuffer
                fbterm -s 12 < /dev/tty1 & # Tell fbterm to diplay tty1 terminal on fb1 with size 12. 
                
                • Connect a BT keyboard or similar and enjoy a somewhat functional terminal
                • One final note: I added root to the video group, although this should not be required.
                  Screenshot from 2024-08-13 09-49-45.png
                ajb2k3A 1 Reply Last reply Reply Quote 1
                • ajb2k3A
                  ajb2k3 @johan_s
                  last edited by

                  @johan_s I saw the export frame buffer on the CM4 stack but haven’t had time to look into it as moving around the house. Thanks for continuing the work in my steed

                  UIFlow, so easy an adult can learn it!
                  If I don't know it, be patient!
                  I've ether not learned it or am too drunk to remember it!
                  Author of the WIP UIFlow Handbook!
                  M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                  1 Reply Last reply Reply Quote 0
                  • P
                    prima
                    last edited by

                    I haven't tested yet but on other devices I usually start programs from the serial console or SSH just by adding CLI arguments like this:

                    FRAMEBUFFER=/dev/fb1 <some command>
                    
                    J 1 Reply Last reply Reply Quote 1
                    • J
                      johan_s @prima
                      last edited by

                      @ajb2k3 no problem my friend

                      @prima I tried your suggestion but I can't really get it to work.

                      With the method I outlined the terminal works fine, but the keyboard input (USB keyboard) is not so reliable. It stop registering keystrokes after a short period. Not sure if the keyboard input get redirected to another terminal in the background or something.

                      ajb2k3A 1 Reply Last reply Reply Quote 0
                      • ajb2k3A
                        ajb2k3 @johan_s
                        last edited by

                        @johan_s Hi John sorry for the long delay.

                        I had a chance to play with the frame buffer today after remembering this conversation.

                        I am finding the issue with the small text/garbidge written to the screen that you shared and looking into it.

                        Thanks for the point out.

                        UIFlow, so easy an adult can learn it!
                        If I don't know it, be patient!
                        I've ether not learned it or am too drunk to remember it!
                        Author of the WIP UIFlow Handbook!
                        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post