Shop OBEX P1 Docs P2 Docs Learn Events
Linux Bash - Command line serial to propeller — Parallax Forums

Linux Bash - Command line serial to propeller

nathantranthamnathantrantham Posts: 5
edited 2014-04-10 21:04 in Propeller 1
Hi everyone,

I'm attempting to use the command line with Ubuntu to communicate using serial to the prop.

For instance, I would love to do: echo "text" >> dev/ttyUSB0 from the terminal and have the propeller receive it.

Has anyone tried this before? If so, is there a preferred serial object I need to use (e.g. Full Duplex, Simple Serial, etc)? I've read about people trying this with arduino and the basic stamp, but I can't find anything related to the prop.

Thanks - any help is much appreciated.

Nathan

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-04-06 17:51
    Hi everyone,

    I'm attempting to use the command line with Ubuntu to communicate using serial to the prop.

    For instance, I would love to do: echo "text" >> dev/ttyUSB0 from the terminal and have the propeller receive it.

    Has anyone tried this before? If so, is there a preferred serial object I need to use (e.g. Full Duplex, Simple Serial, etc)? I've read about people trying this with arduino and the basic stamp, but I can't find anything related to the prop.

    Thanks - any help is much appreciated.

    Nathan

    I've written a fast Forth for the Prop which has a lot of shell-like commands that are executed from the serial terminal, you can even telnet (see my sig) into one of my units and do an "ls" then pick a text file and "cat <name>" etc.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-06 20:24
    For communications, you need to use Minicom or Putty in Linux to set up a serial port.
    And you may find that initially only the Superuser has rights to the serial port.

    If you want your normal account to reach the USB serial, you will have to figure out how to add yourself to the group that has rights.

    I prefer Mincom for reaching the Propeller (and I too am a Forth user).

    PuTTY is more powerful, more feature rich. It may just make you feel lost if you are not deep into communication choices as it does a lot more than just a Serial Port. It also does SSH over the LAN or the internet.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2014-04-06 22:28
    I suppose that after you open up a ttyUSB0 port via Minicom, you can use Bash scripts to directly communicate with it and NOT have to key in instruction.

    Minicom does have a capture to file feature for data streamed from the serial port that is active. But again, you might have BASH do all that, if you prefer.
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 02:38
    nathantrantham

    Things like:

    $ echo "text" > /dev/ttyUSB0
    $ cat /dev/ttyUSB0

    work just fine.

    Provided:

    1) You have the permissions to access the port. You may need to run as root or set the port permissions before use or be a member of the "dialout" group. Up to you.

    2) The port is configured to with the right baud rate and protocol settings for what ever is connected to the other end of the link.

    That can be done with the "setserial" command. See this Ubunto discussion about it:

    http://ubuntuforums.org/showthread.php?t=1609727


    On the Propeller end I would simply use the FullDuplexSerial Spin object.



    Welcome to the forum by the way.
  • SRLMSRLM Posts: 5,045
    edited 2014-04-07 04:15
    I like picocom. If you start it with
    picocom --send-cmd "ascii-xfr -s -c 0" -b $baud $port
    

    Then you can use C-a C-s to send a file. Otherwise, it operates as a simple console.
  • nathantranthamnathantrantham Posts: 5
    edited 2014-04-10 21:04
    Wow, I'm never ceased to be amazed by how helpful the Parallax Forums are - you all are awesome! Thanks.

    Peter - thanks for your Forth suggestion, but for the moment that is out of my league and more than I was looking to get into.

    Loopy and SRLM - thanks for the tip on those serial monitors. I definitely like minicom and picocom. Great suggestions.

    Loopy and Heater - thanks for the reminder about root admin. I'm new to linux, so it was easy to forget. I believe this was the issue because I now have it working perfectly fine with the echo "text" >> /dev/ttyUSB0 method. I was also able to make it work with minicom and picocom.

    Thanks!
Sign In or Register to comment.