[리눅스] Serial, 시리얼 케이블 사용법 (콘솔 사용법)

Posted by nkjok
2019. 1. 29. 10:48 OS&기타/Linux
반응형

해당 실습은 루트 사용자가 아닌 일반사용자 환경에서 진행하였습니다.

- 운영체제 : Linux Mint 19 Cinnamon

- 커       널 : 4.15.0-20-generic



시리얼 케이블 확인방법

- 시리얼 케이블을 대상 노트북과 대상 장비에 연결한다. (USB to Serial 사용)


dmesg | grep serial

[    0.998828] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[58883.346901] usbcore: registered new interface driver usbserial_generic
[58883.346931] usbserial: USB Serial support registered for generic
[58883.351207] usbserial: USB Serial support registered for FTDI USB Serial Device
[59503.413665] ftdi_sio ttyUSB0: usb_serial_generic_write_bulk_callback - nonzero urb status: -71


sudo setserial -a /dev/ttyUSB0

- 설치방법 : sudo apt-get -y install setserial

sudo setserial -a /dev/ttyUSB0
/dev/ttyUSB0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
    Baud_base: 24000000, close_delay: 0, divisor: 0
    closing_wait: infinite
    Flags: spd_normal



접속 방법

1. 접속 클라이언트를 설치한다.

sudo apt-get -y install minicom


2. 접속 클라이언트를 실행한다.

sudo minicom


3. 접속 클라이언트를 설정한다.

접속화면 ↓

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB0, 10:22:32

Press CTRL-A Z for help on special keys


3-1.

접속 화면에서 CTRL + A 를 눌리면  "CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB0" 이 하단에 출력한다.

이 상태에서 Z 를 눌리면 된다.


Welcome to minicom 2.7.1                                                            +-------------------------------------------------------------------+
                                                                                    |                      Minicom Command Summary                      |
OPTIONS: I18n                                                                       |                                                                   |
Compiled on Aug 13 2017, 15:25:34.                                                  |              Commands can be called by CTRL-A <key>               |
Port /dev/ttyUSB0, 10:22:32                                                         |                                                                   |
                                                                                    |               Main Functions                  Other Functions     |
Press CTRL-A Z for help on special keys                                             |                                                                   |
                                                                                    | Dialing directory..D  run script (Go)....G | Clear Screen.......C |
                                                                                    | Send files.........S  Receive files......R | cOnfigure Minicom..O |
                                                                                    | comm Parameters....P  Add linefeed.......A | Suspend minicom....J |
                                                                                    | Capture on/off.....L  Hangup.............H | eXit and reset.....X |
                                                                                    | send break.........F  initialize Modem...M | Quit with no reset.Q |
                                                                                    | Terminal settings..T  run Kermit.........K | Cursor key mode....I |
                                                                                    | lineWrap on/off....W  local Echo on/off..E | Help screen........Z |
                                                                                    | Paste file.........Y  Timestamp toggle...N | scroll Back........B |
                                                                                    | Add Carriage Ret...U                                              |
                                                                                    |                                                                   |
                                                                                    |             Select function or press Enter for none.              |
                                                                                    +-------------------------------------------------------------------+

3-2.

위와 같은 화면이 출력되는데 o 를 입력한다 (영어 소문자 O) , o 를 입력하면 아래 화면이 출력된다.

            +-----[configuration]------+                                                                                                                
            | Filenames and paths      |                                                                                                                
            | File transfer protocols  |                                                                                                                
            | Serial port setup        |                                                                                                                
            | Modem and dialing        |                                                                                                                
            | Screen and keyboard      |                                                                                                                
            | Save setup as dfl        |                                                                                                                
            | Save setup as..          |                                                                                                                
            | Exit                     |                                                                                                                
            +--------------------------+    

- Serial port setup 로 가서 자기에 맞게 끔 설정한다

OPTI+-----------------------------------------------------------------------+                                                                           
Comp| A -    Serial Device      : /dev/ttyUSB0                              |                                                                           
Port| B - Lockfile Location     : /var/lock                                 |                                                                           
    | C -   Callin Program      :                                           |                                                                           
Pres| D -  Callout Program      :                                           |                                                                           
    | E -    Bps/Par/Bits       : 115200 8N1                                |                                                                           
    | F - Hardware Flow Control : Yes                                       |                                                                           
    | G - Software Flow Control : No                                        |                                                                           
    |                                                                       |                                                                           
    |    Change which setting?                                              |                                                                           
    +-----------------------------------------------------------------------+


# Hardware Flow Control : Yes   <- 이 설정이 No  로 되어야 먹통이 안되었다.



3-3. 설정 저장

Save setup as dfl,  Save setup as 설정 저장


3-4. 종료

CTRL + A 를 눌리면  "CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB0" 이 하단에 출력한다.

이 상태에서 Z 를 눌린 다음 'o' 를 입력


3-5. 재접속

sudo minicom

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB0, 10:44:56

Press CTRL-A Z for help on special keys


[root@localhost ~]#


결론 : 대상 장비의 쉘모드로 진입되어있는 것을 확인 할 수 있다.

반응형