Serial Gateway connect problem ttyAMA0



  • Hi all,

    Using Mysensors 2.11, latest version of Domoticz (3.58.77), Arduino pro mini 5V directly connected to RPI2 through Tx/Rx connection (having carefully made a voltage divider for 3.3 V Rx on RPI2), have compiled SerialGateway with following parameters :
    0_1486163187143_upload-a7d023e6-ec73-428a-9a00-0936a051df99

    No connection to Serial Gateway (even after waiting for hours ) :
    0_1486163349709_upload-81bdad53-aa16-4e69-9907-b07e369c64dc

    So I tried to lock the ttyAMA0 in order to see if Domoticz is really tries to connect to ttyAMA0, so have locked ttyAMA0 :
    0_1486163122930_upload-3121397d-a0a6-4c8b-a944-573e869ad493

    And Domoticz is happy with this (as after a restart of Dmz service) !
    0_1486163299460_upload-c5703d3c-8d71-4a9e-9775-39c8b9f6e452
    No error seen...

    I suspect Domoticz doesn't try to connect to ttyAMA0. I already fully disabled the serial boot ability and log on ttyAMA0 in RPI (systemctrl diasble,sudo systemctl stop getty.target, /boot/cmdline.txt does'nt contain any ttyAMA0 reference, disable serial-getty@ttyAMA0.service, ...)
    The same hardware is fully functional with my old SD Card (Rasbian/Mysensors installed 1 year ago) !

    Is anybody knows what's wrong



  • how many different USB devices do you have connected to your RPI2?
    Mine using RPI3 is connected to dev/ttyUSB0
    what happens when you type in a command prompt dmesg | grep tty?

     dmesg |grep tty
    [    0.000000] Kernel command line: 8250.nr_uarts=0 dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa02082 bcm2709.serial=0x206ad9b smsc95xx.macaddr=B8:27:EB:06:AD:9B bcm2708_fb.fbswap=1 bcm2709.uart_clock=48000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    [    0.001343] console [tty1] enabled
    [    1.893707] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
    [   21.511692] systemd[1]: Cannot add dependency job for unit getty-static.service, ignoring: Unit getty-static.service failed to load: No such file or directory.
    [   21.769044] systemd[1]: Starting system-getty.slice.
    [   21.775173] systemd[1]: Created slice system-getty.slice.
    [   33.592862] usb 1-1.4: cp210x converter now attached to ttyUSB1
    [   33.603346] usb 1-1.3: ch341-uart converter now attached to ttyUSB0
    
    

    You find something like this:
    ch341-uart converter now attached to ttyUSB0



  • This :
    0_1486332218660_upload-dc9673dc-b693-48f4-871c-5fbca09aa933

    But I'm not using USB to serial converter, I'm only using native serial GPIO Tx/Rx pins like I said in my 1st post.



  • @lrtsenar
    By default ttyAMA0 is configured like system console for Linux on Raspberry.
    Do you disable it?
    http://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/



  • @lrtsenar
    console [ttyAMA0] enabled

    I think, that this is issue.....
    It is used by system.



  • @kimot
    After folowing your link, dmesg displays :

    0_1486335983940_upload-d22dbac5-5ecd-4d50-9b44-ee70b7d64dd1

    And :
    0_1486336890405_upload-4226c005-294c-4c8d-9de7-27e26a6467bb

    Now, sems console uses only tty1 but problem persists 😞



  • This post is deleted!


  • @lrtsenar But I'm not using USB to serial converter, I'm only using native serial GPIO Tx/Rx pins like I said in my 1st post.
    I overlooked this info



  • Maybe it's a rights problem, can you sudo minicom it? Your domoticz user should be added to the group allowing access to ttys. For me it's group uucp.



  • @pansen
    I Think, that it is "dialout" group.
    Or try start Domoticz: sudo ./domoticz

    But I found informations, that handle of "tty"s depends on Rapsbian version too.

    "Because OS version jessie has changed to using systemd, the file /etc/initab no longer exists. You must use the systemd command systemctl to stop getty.target that is attached to /dev/ttyAMA0

    pi@raspberrypi:~ $ sudo systemctl stop getty.target

    NOTE: This will release ttyAMA0 until you reboot/restart the raspberry pi. After you reboot you will have to give the command again."

    And for the best - on RPI3 ttyAMA0 is connected to Bluetooth and gpio is ttyS0 and is software emulated.



  • Did you try to this?
    sudo nano /boot/config.txt
    Add to the end:

    enable_uart=1
    sudo nano /boot/cmdline.txt
    Remove everything and add this:
    dwc_otg.lpm_enable=0 console=tty1 elevator=deadline net.ifnames=0 root=/dev/mmcblk0p2 rootfsty

    Taken from here:
    https://community.openhab.org/t/has-anyone-gotten-razberry-working-with-openhab-2/12539/11


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts