Do not limit your challenges.. Challenge your limits

BTemplates.com

Search This Blog

Powered by Blogger.

About Me

My photo
kathmandu, Bagmati, Nepal
I am Software developer based on Nepal.I have started coding since mid of 1995 with QBasic.My interest in software development covers a broad range of technologies from assembly to the Microsoft .NET platform to Java, Linux to Windows, Windows Mobile to Android, desktop to web to mobile, and many others. But from 2007 I am just working on Java mainly working on Java EE platform and decided just to go with it. I really like to learn new stuff and share things with others which is my main objective in creating this blog.

ArchUnit : Java architecture test library

Finally I have found the required library which will enforce architecture patterns . ArchUnit  . Currently I am exploring it and will upd...

Sunday, June 9, 2013

Communicating with serial port



These days I am working on embedded ARM linux devices. I am writing an application for it. I was using Hyper terminal( windows machine ) to transfer image file,even though I am using linux for development( coding ).This suggestion was given from the vendor and since it is my first project in embedded , I am doing whatever they are suggesting. Just for file transfer I have to use windows machine which was giving me bad feeling .So this morning I decided to setup serial port with linux and will try to transfer file by linux.I have tried a lot of tools like minicom,cutecome,gtkterm and c-kermit . After trying around 2 hours I am able to transfer file from linux to POS machine using serial port with the help of kermit. So , I decide to write the procedure of it for future reference.

  1.   type dmesg in terminal and check wheather your device is listed or not.Iam using USB to serial connector so here is what dmesg show on terminal
[ 7387.476656] usbcore: registered new interface driver usbserial
[ 7387.476690] USB Serial support registered for generic
[ 7387.476757] usbcore: registered new interface driver usbserial_generic
[ 7387.476759] usbserial: USB Serial Driver core
[ 7387.490339] USB Serial support registered for ch341-uart
[ 7387.490420] ch341 1-1.2:1.0: ch341-uart converter detected
[ 7387.493091] usb 1-1.2: ch341-uart converter now attached to ttyUSB0
[ 7387.493107] usbcore: registered new interface driver ch341

2.  type lsusb

     Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
This gives,vendor information and device ID .It means port is ready for use


3 . Install C-kermit
  sudo apt-get install ckermit

4.  make a file in user home directory  [ ~/.kermrc ] and pest below configuration

          set line /dev/ttyUSB0
          set speed 115200
          set carrier-watch off
          set handshake none
          set flow-control none
          robust
5.  adjust configuration like line,speed according to your device and save it

6.  open terminal and type kermit. You will see as below

         suraj@suraj:~$ kermit
               C-Kermit 8.0.211, 10 Apr 2004, for Linux
               Copyright (C) 1985, 2004,
              Trustees of Columbia University in the City of New York.
              Type ? or HELP for help.
          (/home/suraj/) C-Kermit>

7.  type connect and start your device.You will see log message if device have configured any

           (/home/suraj/) C-Kermit>connect
          Connecting to /dev/ttyUSB0, speed 115200
          Escape character: Ctrl-\ (ASCII 28, FS): enabled
         Type the escape character followed by C to get back,
         or followed by ? to see other options.

8.   press enter then you will be at device linux prompt
9.   to disconnect from kermit press Ctrl + \ and then c
10. finally type exit

0 comments:

Post a Comment