Serial Output from Linux

Discussion in 'UDOO 101' started by askywalker, Oct 29, 2014.

  1. askywalker

    askywalker New Member

    Joined:
    Oct 29, 2014
    Messages:
    7
    Likes Received:
    0
    Hello,
    I am a complete Linux noob, any help appreciated.
    GOAL: Output messages from Linux to serial . I want "Hello World" to come out Serial.
    The UDOO is connected to my PC and I see the boot up serial output, and I can log in to SSH over serial.

    The guides have conflicting information and are confusing. How do I accomplish this simple task? Thanks!


    Method One
    udoo-test-communication-sketch-ino-t387.html
    Result One
    Code:
    root@volumio:~# sudo ln -sf /dev/ttymxc3 /dev/ttyS0
    root@volumio:~# python
    Python 2.7.3 (default, Mar 14 2014, 17:55:54)
    [GCC 4.6.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import serial
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    

    Method Two
    http://udoo.org/download/files/Document ... 8_2013.pdf
    Result Two
    Code:
    root@volumio:~# stty -F /dev/ttymxc3 cs8 115200
    root@volumio:~# echo message > /dev/ttymxc3
    

    Method Three
    http://www.udoo.org/ProjectsAndTutorial ... ial-cable/
    Result Three
    Code:
    root@volumio:~# sudo chmod 666 /dev/ttyUSB0
    root@volumio:~# sudo minicom -w
    minicom: cannot open /dev/ttyUSB0: No such device
    
     
  2. askywalker

    askywalker New Member

    Joined:
    Oct 29, 2014
    Messages:
    7
    Likes Received:
    0
    Anyone? Thanks
     
  3. nicola

    nicola Member

    Joined:
    Apr 23, 2014
    Messages:
    45
    Likes Received:
    0
    I don't understand, are you connected through the serial cable or a network connection?
    If you are using the usb cable then you are probably using a serial comunication program like minicom.
    If you are using a network connection then SSH is probably involved.

    Method one:
    This example is used to send data to arduino through the serial port. You need an arduino sketch to read the data.
    Anyway, to avod the error you need the pyton library pyserial, try installing with:
    Code:
    sudo apt-get install python-serial
    Method two:
    This is used to send data to arduino through the serial port. You need an arduino sketch to read the data.

    Method three:
    This is meant to be used on a PC to connect to the UDOO.

    This is a solution i found to send a message from Udoo to PC using the USB cable (serial debug connection)
    The serial connections of Udoo are usually in the form of ttymxc<something> so i tested some devices in "/dev" and found "ttymxc1" to be the one related to the USB serial debuging connection. You need to be root to use it. The commands i used in the Udoo are:
    Code:
    su
    echo "ciao" > /dev/ttymxc1
    And then you will see the string "ciao" in the PC console
     
  4. askywalker

    askywalker New Member

    Joined:
    Oct 29, 2014
    Messages:
    7
    Likes Received:
    0
    Thanks!

    My goal is to send data FROM UDOO TO PC VIA SERIAL.
    It worked! Thanks!

    How would I go about writing a script that automatically sent a message over serial every second?
     
  5. delba

    delba Administrator Staff Member

    Joined:
    May 8, 2013
    Messages:
    1,064
    Likes Received:
    9
    you need to creare a bash script .sh with a while cycle and 1 second delay.

    Code:
    #!/bin/bash
    su
    
    while :
    do 
    	echo "hello" > /dev/ttymxc1
    	sleep 1 
    done
    
     

Share This Page