[SOLVED] Unable to write data to serial port on pi3



  • Hello everyone,

    I'm trying to create a custom controller on a pi 3. I have some really specific need.

    I have build MySensors using the following command :

    ./configure —my-debug=enable —my-gateway=serial --my-serial-pty=/dev/ttyGateway --my-serial-is-pty --my-rf24-ce-pin=22 --my-rf24-cs-pin=24 --my-rf24-irq-pin=13
    

    Everything is working fine, the radio is working and I can receive data from nodes with a static ID.
    What I want to do is to handle ID request from nodes and to simply send data to nodes. The issue is that I can't write to the serial port.

    When I try to do :

    sudo echo "255;0;3;0;4;4" > /dev/ttyGateway
    

    I get : "Permission not granted"

    When I do : ls -l /dev/ttyGateway

    lrwxrwxrwx 1 root root 10 mars   4 13:51 /dev/ttyGateway -> /dev/pts/5
    

    In principle it should work with no issue, right ?

    My question is : How can I send data by writing to the serial port ?


  • Mod

    @sapher said in Unable to write data to serial port on pi3:

    sudo echo "255;0;3;0;4;4" > /dev/ttyGateway

    Try

    sudo echo "255;0;3;0;4;4" | sudo tee /dev/ttyGateway > /dev/null
    

    or make yourself superuser:

    sudo su
    echo "255;0;3;0;4;4" > /dev/ttyGateway
    


  • @Yveaux said in Unable to write data to serial port on pi3:

    Thank you dear Sir, both of your solution work. Amazing.
    I hope this will help others. Cause I can sense that this is pretty basic Linux stuff. But I was stuck for days on that. Thank you 👍


Log in to reply
 

Suggested Topics

  • 4
  • 933
  • 1
  • 2
  • 3
  • 5

21
Online

11.2k
Users

11.1k
Topics

112.5k
Posts