11 Replies Latest reply on Jul 29, 2014 7:50 PM by steam

    Gaining shell access in Galileo linux enviornment

    steam

      I would like to get shell/terminal access to the linux OS running on a Galileo board but have been unable to. Eventually I would like to get to the point where I can compile my own project directly on the board with debian so I can use i386 precompiled binaries for a 3d sensor I have (there are no arm binaries available).

       

      I have installed firmware as described in the startup manual (v1.0.2). Uploading the blink sketch works when the SD card is not in. Power pins are at 5V +/- .1 volts.

       

      Things I have tried:

      1. Serial access via USB client (did not expect this to work because my understanding is that it is an interface for uploading sketches)

           Conditions: 115200 Baud, 8 data bits, 1 stop bit, no parity or handshake (cutecom running on debian), only usb client plugged in, using /dev/ttyACM0 port

           Result: Output only on reboot button: "**\0x18B0100000063f694\n\0x8a\0x11\0x18\0x18..."

      2. Serial access via audio jack UART port

           Conditions: 115200 Baud, 8 data bits, 1 stop bit, no parity or handshake (cutecom running on debian), ftdi wired to spliced audio jack less than 3 inches long, using /dev/ttyUSB0 port, continuity check with multimeter indicates clean connection between pins and no shorting

           Results: Output is null character (\0x00) at 1 second intervals, rebooting device (via button or power supply) results in several big blocks of garbled ASCII and hex bytes eventually returning to null output chars. Having the USB plugged in various ports does not have an effect as it might if there was a bad ground in my home made jack. Switching RX and TX wires gives no output at all. Changing the baud rates still demonstrates garbled output followed by period nulls.

      3. Mikal Harts Poor mans teletype terminal

           Conditions: Uploaded as sketch from Intel Galileo Arduino 1.5.3, listen with cutecom at 115200 baud, 8 data bits, 1 stop bit, no parity, /dev/ttyACM0 via usb client

           Result: Upload successful, no output on opening serial terminal

      4. Creating a SD card image to boot from

           Conditions: Tried a 2GB (non-HC) and 32GB (HC) card, formated to fat32 with gparted, placed in sd card slot and rebooted with power cable

           Results: /dev/ttyACM0 port does not show up ever (normally takes 30 seconds) attempts to find the device with nmap -sn 192.168.1.1/24 fail, does not show up on router, serial output identical to 1 & 2, right after a reboot the SD light flickers for a little while, I assume this is because grub is looking at it before passing over, without the serial interface I don't know how to stop it from doing so.

       

      Questions:

      1. Could my Galileo be damaged and still run the blink sketch/Are there other damage indication tests I can run?

      2. I have never logged into a shell over a serial connection, is there anything particularly in #2 that seems like I'm doing wrong?

      3. Should the SD card technique work without updating the grub preferences?

       

      Any wisdom would be greatly appreciated!

        • 1. Re: Gaining shell access in Galileo linux enviornment
          Rushang.Karia

          For #1 you cannot use the USB wire as a serial device except over the arduino IDE

          For #2 you are supposed to use /dev/ttyS0 or /dev/ttyS1 not USB0.

           

          #3 Telnet requires an ethernet connection.

           

          Also the USB wire is only accessible via the serial monitor in the arduino IDE. you cannot use the micro USB- USB as a serial wire except via an arduino sketch.

          Some brilliant people have written a program enabling ssh like semantics over the arduino IDE. check them out.

           

          Regarding the serial monitor, it is found in the arduino IDE -> tools -> Serial Monitor OR press Ctrl+Shift+M at the IDE

          Again, serial monitor is exclusive to arduino but it is possible to write a program for ssh like functionality.

           

          For your SD-card image, it seems that your system is not booting. Can you post the results of cat /etc/inittab over here.

          There is a known bug that prevents the SD-card from booting and present in /etc/inittab.

           

          If you use the supplied image then NO, you do not need to change anything. However the names of initramfs and the filesystem are prebuilt into the grub.conf. So if you rename them to say abc

          then you will have to change grub.conf in the SD-card.

          • 2. Re: Gaining shell access in Galileo linux enviornment
            steam

            Thanks for you reply,

             

            I tried listening to the ttyS0-3 ports (on my workstation side) but there was no activity, those ports show up in /dev regardless of if I have an ftdi or usb connected from my workstation to the Galileo. From what I've read my understanding is that ttyS0-2 are also serial port interfaces on the Galileo side representing the pin 0 and 1, the USB client and the UART audio jack. When you ask for /etc/inittab, I assume you want it from my Galileo and not my linux workstation. I don't know how to do this without being in a shell on the Galileo which I have not been able to get.

             

            I might be misunderstanding but I think I should be able to connect via the UART 3.5mm audio jack with a serial to USB converter (FTDI chip) from my linux workstation via any serial terminal to get access to the linux OS on the Galileo. Is this incorrect?

             

            I'll try your recommendation for #3 with these instructions Using Galileo Linux over Ethernet(Telnet).

            • 3. Re: Gaining shell access in Galileo linux enviornment
              steam

              Here is my /etc/inittab from a sketch with system("cat /etc/inittab > /dev/ttyGS0"); running at setup

               

              # /etc/inittab: init(8) configuration.

              # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

               

              # The default runlevel.

              id:5:initdefault:

               

              # Boot-time system configuration/initialization script.

              # This is run first except when booting in emergency (-b) mode.

              si::sysinit:/etc/init.d/rcS

               

              # What to do in single-user mode.

              ~~:S:wait:/sbin/sulogin

               

              # /etc/init.d executes the S and K scripts upon change

              # of runlevel.

              #

              # Runlevel 0 is halt.

              # Runlevel 1 is single-user.

              # Runlevels 2-5 are multi-user.

              # Runlevel 6 is reboot.

               

              l0:0:wait:/etc/init.d/rc 0

              l1:1:wait:/etc/init.d/rc 1

              l2:2:wait:/etc/init.d/rc 2

              l3:3:wait:/etc/init.d/rc 3

              l4:4:wait:/etc/init.d/rc 4

              l5:5:wait:/etc/init.d/rc 5

              l6:6:wait:/etc/init.d/rc 6

              # Normally not reached, but fallthrough in case of emergency.

              z6:6:respawn:/sbin/sulogin

              S:2345:respawn:/sbin/getty 115200 ttyS1

              # /sbin/getty invocations for the runlevels.

              #

              # The "id" field MUST be the same as the last

              # characters of the device (after "tty").

              #

              # Format:

              # <id>:<runlevels>:<action>:<process>

              #

               

              1:2345:respawn:/sbin/getty 38400 tty1

              • 4. Re: Gaining shell access in Galileo linux enviornment
                Rushang.Karia

                Hi,

                 

                You should be able to connect via serial with the following

                3.5 mm to serial female/male  and connect serial-male/female to usb

                That way the device is /dev/ttyUSB[0-9]

                 

                I am not sure what you mean by /dev/ttyS0-[0-9]. They should appear as /dev/ttyS[0-9] **without the hyphen and the part after it**

                You are correct in saying that the workstation has /dev/tty* by default. That is normally done during the startup phase and it shows that you can open connections on these ports by connecting the pins

                to them.

                 

                I might be misunderstanding but I think I should be able to connect via the UART 3.5mm audio jack with a serial to USB converter (FTDI chip) from my linux workstation via any serial terminal to get access to the linux OS on the Galileo. Is this incorrect?

                Yes if you are doing this then you should be able to serial your way in. The device will/should appear as /dev/ttyUSB[0-9].

                If you did the above then you are correct. I am sorry for misunderstanding earlier then.,

                 

                I am assuming you do the above and set the correct baud rate and other parameters{ which btw are correct}.

                Please run the following as a root user

                chmod -v 666 /dev/ttyUSB0

                 

                It seems to me that you do not have access **as a normal user** to open these ports.

                Doing so might fix the problem if you had not done this.

                • 5. Re: Gaining shell access in Galileo linux enviornment
                  AlexT_Intel

                  steam, you mentioned FTDI a couple of times in relation to the serial console cable, can you present a schematic of your cable, to make sure it's correct? It sounds like you've built it yourself completely, including the serial-to-USB part, right?

                   

                  As far as device names are concerned, /dev/ttyS{0,1} are the names of those on Galileo, not on the Linux host machine you're connecting from. Those ones are usually *USB*, as long as you're using seial-to-USB converter.

                   

                  If the board works (and it does per your tests) off of the SPI, it shouldn't be broken, that's rather a SD card, which is not working (there are some that simply don't work with Galileo), or formatting of the card, which is incorrect. Image file naming and locations are usually out of the equation, if you just unpack the official image 7z file into root of the card.

                   

                  I might be misunderstanding but I think I should be able to connect via the UART 3.5mm audio jack with a serial to USB converter (FTDI chip) from my linux workstation via any serial terminal to get access to the linux OS on the Galileo

                  This is correct understanding.

                   

                  Another option, which you've already tried, is to use the SD card and SSH, but if Blink doesn't work with SD card, then it's probably not booting properly, so that won't work (and that's confirmed by your findings). So I'd suggest you to focus on getting serial cable working, that will open the door to full troubleshooting (and further, development) capabilities.

                  1 of 1 people found this helpful
                  • 6. Re: Gaining shell access in Galileo linux enviornment
                    steam

                    I have gotten the SD card to work and have been able to boot in via ssh, even though my computer indicated it ejected the disk it appears that it was not finished flushing the write buffer. Here are the explicit commands I used to get a working SD card:

                     

                    sudo fdisk -l

                    # Find your SD card device assignment here, my 32 GB SDHC looked like this:

                    # Disk /dev/sdc: 31.9 GB, 31914983424 bytes

                    # 255 heads, 63 sectors/track, 3880 cylinders, total 62333952 sectors

                    # Units = sectors of 1 * 512 = 512 bytes

                    # Sector size (logical/physical): 512 bytes / 512 bytes

                    # I/O size (minimum/optimal): 512 bytes / 512 bytes

                    # Disk identifier: 0x0008ff48

                    # Device Boot      Start         End      Blocks   Id  System

                    # /dev/sdc1            2048    62332927    31165440    b  W95 FAT32

                    umount /dev/sdc1

                    sudo mkdosfs -n GALILEO -F 32 -I /dev/sdc1

                    mkfs.fat 3.0.26 (2014-03-07)

                    mkdir galileo_mount

                    sudo mount /dev/sdc1/ galileo_mount/

                    cd galileo_mount/

                    ~/galileo_mount$ sudo 7z x ~/Downloads/LINUX_IMAGE_FOR_SD_Intel_Galileo_v1.0.0.7z

                    ~/galileo_mount$ cd ..

                    sync

                    sudo umount /dev/sdc1

                    nmap -sn 192.168.1.1/24

                    # note the devices, put the SD card in the Galileo and power cycle it and wait for a while

                    nmap -sn 192.168.1.1/24

                    # find the new device and note the last three of its address XXX

                    ssh root@192.168.1.XXX

                    • 7. Re: Gaining shell access in Galileo linux enviornment
                      Rushang.Karia

                      Good.

                       

                      As a caution, whenever you use the command line to copy stuff always execute sync later. It ensures that all writes are committed to the actual destination

                       

                      Example.

                      cp -fr "some very big files here"

                      sync  # this ensures everything actually makes it to the device.

                       

                      Please mark this question as answered and enjoy playing with the board.

                      Feel free to post any questions in the forum.

                      1 of 1 people found this helpful
                      • 8. Re: Gaining shell access in Galileo linux enviornment
                        steam

                        RS232-cable.png

                        Since I just got SSH working this is not very important any more but for the curious here is some more info. The bove is the schematic I was using.

                        IMAG0244.jpg

                        And the actual circuit, I tested for shorts and continuity between the pins the UART connector has on the bottom of the Galileo board and the pins on the back of the FTDI basic chip.  I still observe the same behavior of around 500 garbled characters at reboot and \0x00 characters twice a second even after hitting reset. Having the SD card (working clanton image) and testing at different baud rates 9600, 36000, 57600, 115200 result in the same behavior.

                        • 9. Re: Gaining shell access in Galileo linux enviornment
                          JMR

                          The signals at the input of the cable mini jack 3.5 mm to DB9 serial port are RS232 levels, for a PC serial port. I am not sure that it is a good idea to inject them directly on the FTDI chip...

                          • 10. Re: Gaining shell access in Galileo linux enviornment
                            JMR

                            Alex, I think that a RS232 level shifter such as the MAX232 should be placed before the FTDI chip.

                            • 11. Re: Gaining shell access in Galileo linux enviornment
                              steam

                              Thank you, your right, the signal on the UART output is 5 volts but it also inverts. I misunderstood and thought that 5V RS232 was the same thing as 5V TTL that I normally use the FTDI chip for, that would be the reason for the bad serial output.

                               

                              Screenshot from 2014-07-29 19:47:32.png