Serial Gateway not connecting - ttyUSB0 in use



  • Hi,

    I have a problem with my setup, I am using an arduino nano with rf24 module connected via USB to raspberry pi 3B+ and I am getting the following error in Karaf

    [ERROR] [ocol.serial.MySensorsSerialConnection] - Port: /dev/ttyUSB0 is already in use
    
    

    When I use the Arduino IDE within raspbian I see ttyUSB0 as the connected port, but get no serial data through the serial monitor window.

    Any help would be greatly appreciated



  • @CraigDubya did you close the Arduino IDE 😁



  • I did close the IDE.

    Normally within the serial monitor of the IDE I can see the DEBUG information of the gateway, and that isn't happening.



  • Do you have more usb devices plugged in? In Linux ttyUSB0 is not always the same physical port



  • Hi,

    No, nothing but the gateway.



  • And if you type
    ls /dev/tty*
    What is the result



  • pi@raspberrypi:~ $ ls /dev/tty*
    /dev/tty    /dev/tty19  /dev/tty3   /dev/tty40  /dev/tty51  /dev/tty62
    /dev/tty0   /dev/tty2   /dev/tty30  /dev/tty41  /dev/tty52  /dev/tty63
    /dev/tty1   /dev/tty20  /dev/tty31  /dev/tty42  /dev/tty53  /dev/tty7
    /dev/tty10  /dev/tty21  /dev/tty32  /dev/tty43  /dev/tty54  /dev/tty8
    /dev/tty11  /dev/tty22  /dev/tty33  /dev/tty44  /dev/tty55  /dev/tty9
    /dev/tty12  /dev/tty23  /dev/tty34  /dev/tty45  /dev/tty56  /dev/ttyAMA0
    /dev/tty13  /dev/tty24  /dev/tty35  /dev/tty46  /dev/tty57  /dev/ttyprintk
    /dev/tty14  /dev/tty25  /dev/tty36  /dev/tty47  /dev/tty58  /dev/ttyS0
    /dev/tty15  /dev/tty26  /dev/tty37  /dev/tty48  /dev/tty59  /dev/ttyUSB0
    /dev/tty16  /dev/tty27  /dev/tty38  /dev/tty49  /dev/tty6
    /dev/tty17  /dev/tty28  /dev/tty39  /dev/tty5   /dev/tty60
    /dev/tty18  /dev/tty29  /dev/tty4   /dev/tty50  /dev/tty61


  • This is what I am getting in the Karaf console of openhab

    17:06:12.741 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    17:06:12.745 [ERROR] [ocol.serial.MySensorsSerialConnection] - Failed connecting to bridge...next retry in 10 seconds (Retry No.:23)
    17:06:12.749 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Shutting down serial connection!
    17:06:12.755 [DEBUG] [sensors.factory.MySensorsCacheFactory] - Writing on cache given_ids, content: []
    17:06:22.760 [DEBUG] [ocol.serial.MySensorsSerialConnection] - Connecting to /dev/ttyUSB0 [baudRate:115200]
    17:06:24.764 [ERROR] [ocol.serial.MySensorsSerialConnection] - Port: /dev/ttyUSB0 is already in use
    gnu.io.PortInUseException: org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialConnection
            at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:459) ~[bundleFile:3.15.0.OH2]
            at org.openhab.binding.mysensors.internal.protocol.serial.MySensorsSerialConnection.establishConnection(MySensorsSerialConnection.java:57) [bundleFile:?]
            at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.connect(MySensorsAbstractConnection.java:152) [bundleFile:?]
            at org.openhab.binding.mysensors.internal.protocol.MySensorsAbstractConnection.run(MySensorsAbstractConnection.java:131) [bundleFile:?]
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_191]
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_191]
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_191]
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_191]
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
            at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
    


  • Can you try the gateway on a different system? If it doesn't work there, something is broken on your gateway.
    If it does, some other application or plugin of openhab uses the port



  • Thanks, I'll have a play and report back later 👍



  • Actually, I can plug the gateway in to my laptop, and see the debug information in arduino ide serial monitor there, so the gateway appears to be fine



  • This is the output of dmesg, perhaps something in there? I'm not great at linux 😕

    pi@raspberrypi:~ $ dmesg
    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 4.19.66-v7+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 11:49:46 BST 2019
    [    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
    [    0.000000] CPU: div instructions available: patching division code
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Plus Rev 1.3
    [    0.000000] Memory policy: Data cache writealloc
    [    0.000000] cma: Reserved 8 MiB at 0x3ac00000
    [    0.000000] On node 0 totalpages: 242688
    [    0.000000]   Normal zone: 2133 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 242688 pages, LIFO batch:63
    [    0.000000] random: get_random_bytes called from start_kernel+0xac/0x4b4 with crng_init=0
    [    0.000000] percpu: Embedded 17 pages/cpu s39488 r8192 d21952 u69632
    [    0.000000] pcpu-alloc: s39488 r8192 d21952 u69632 alloc=17*4096
    [    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 240555
    [    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=tty1 console=ttyS0,115200 root=PARTUUID=39f0d070-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
    [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
    [    0.000000] Memory: 939088K/970752K available (8192K kernel code, 629K rwdata, 2176K rodata, 1024K init, 821K bss, 23472K reserved, 8192K cma-reserved)
    [    0.000000] Virtual kernel memory layout:
                       vector  : 0xffff0000 - 0xffff1000   (   4 kB)
                       fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
                       vmalloc : 0xbb800000 - 0xff800000   (1088 MB)
                       lowmem  : 0x80000000 - 0xbb400000   ( 948 MB)
                       modules : 0x7f000000 - 0x80000000   (  16 MB)
                         .text : 0x(ptrval) - 0x(ptrval)   (9184 kB)
                         .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
                         .data : 0x(ptrval) - 0x(ptrval)   ( 630 kB)
                          .bss : 0x(ptrval) - 0x(ptrval)   ( 822 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    [    0.000000] ftrace: allocating 26394 entries in 78 pages
    [    0.000000] rcu: Hierarchical RCU implementation.
    [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
    [    0.000000] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
    [    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
    [    0.000007] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
    [    0.000019] Switching to timer-based delay loop, resolution 52ns
    [    0.000282] Console: colour dummy device 80x30
    [    0.000302] console [tty1] enabled
    [    0.000351] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
    [    0.000367] pid_max: default: 32768 minimum: 301
    [    0.000706] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.000723] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.001634] CPU: Testing write buffer coherency: ok
    [    0.002101] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [    0.002745] Setting up static identity map for 0x100000 - 0x10003c
    [    0.002892] rcu: Hierarchical SRCU implementation.
    [    0.003685] smp: Bringing up secondary CPUs ...
    [    0.004522] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    [    0.005449] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
    [    0.006316] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
    [    0.006438] smp: Brought up 1 node, 4 CPUs
    [    0.006450] SMP: Total of 4 processors activated (153.60 BogoMIPS).
    [    0.006456] CPU: All CPU(s) started in HYP mode.
    [    0.006461] CPU: Virtualization extensions available.
    [    0.007434] devtmpfs: initialized
    [    0.020689] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
    [    0.020928] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.020946] futex hash table entries: 1024 (order: 4, 65536 bytes)
    [    0.021536] pinctrl core: initialized pinctrl subsystem
    [    0.022390] NET: Registered protocol family 16
    [    0.025448] DMA: preallocated 1024 KiB pool for atomic coherent allocations
    [    0.031246] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
    [    0.031254] hw-breakpoint: maximum watchpoint size is 8 bytes.
    [    0.031458] Serial: AMBA PL011 UART driver
    [    0.033757] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
    [    0.068972] bcm2835-dma 3f007000.dma: DMA legacy API manager at (ptrval), dmachans=0x1
    [    0.070663] SCSI subsystem initialized
    [    0.070894] usbcore: registered new interface driver usbfs
    [    0.070949] usbcore: registered new interface driver hub
    [    0.071042] usbcore: registered new device driver usb
    [    0.090128] raspberrypi-firmware soc:firmware: Attached to firmware from 2019-08-15 12:06, variant start
    [    0.100404] raspberrypi-firmware soc:firmware: Firmware hash is 0e6daa5106dd4164474616408e0dc24f997ffcf3
    [    0.111826] clocksource: Switched to clocksource arch_sys_counter
    [    0.200910] VFS: Disk quotas dquot_6.6.0
    [    0.200994] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [    0.201183] FS-Cache: Loaded
    [    0.201394] CacheFiles: Loaded
    [    0.211370] NET: Registered protocol family 2
    [    0.212165] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
    [    0.212207] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.212317] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    [    0.212503] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.212638] UDP hash table entries: 512 (order: 2, 16384 bytes)
    [    0.212684] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    [    0.212996] NET: Registered protocol family 1
    [    0.213570] RPC: Registered named UNIX socket transport module.
    [    0.213577] RPC: Registered udp transport module.
    [    0.213583] RPC: Registered tcp transport module.
    [    0.213588] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.215320] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
    [    0.218326] Initialise system trusted keyrings
    [    0.218513] workingset: timestamp_bits=14 max_order=18 bucket_order=4
    [    0.228497] FS-Cache: Netfs 'nfs' registered for caching
    [    0.229066] NFS: Registering the id_resolver key type
    [    0.229092] Key type id_resolver registered
    [    0.229099] Key type id_legacy registered
    [    0.229115] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
    [    0.231365] Key type asymmetric registered
    [    0.231374] Asymmetric key parser 'x509' registered
    [    0.231423] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
    [    0.231580] io scheduler noop registered
    [    0.231587] io scheduler deadline registered (default)
    [    0.231773] io scheduler cfq registered
    [    0.231781] io scheduler mq-deadline registered (default)
    [    0.231788] io scheduler kyber registered
    [    0.234068] bcm2708_fb soc:fb: FB found 1 display(s)
    [    0.292910] Console: switching to colour frame buffer device 240x67
    [    0.326166] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 1920x1080
    [    0.327322] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
    [    0.328901] bcm2835-rng 3f104000.rng: hwrng registered
    [    0.329210] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
    [    0.329742] vc-sm: Videocore shared memory driver
    [    0.330068] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
    [    0.341039] brd: module loaded
    [    0.351628] loop: module loaded
    [    0.352362] Loading iSCSI transport class v2.0-870.
    [    0.353082] libphy: Fixed MDIO Bus: probed
    [    0.353188] usbcore: registered new interface driver lan78xx
    [    0.353245] usbcore: registered new interface driver smsc95xx
    [    0.353263] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
    [    0.381135] dwc_otg 3f980000.usb: base=(ptrval)
    [    0.581363] Core Release: 2.80a
    [    0.581373] Setting default values for core params
    [    0.581403] Finished setting default values for core params
    [    0.781690] Using Buffer DMA mode
    [    0.781696] Periodic Transfer Interrupt Enhancement - disabled
    [    0.781702] Multiprocessor Interrupt Enhancement - disabled
    [    0.781709] OTG VER PARAM: 0, OTG VER FLAG: 0
    [    0.781727] Dedicated Tx FIFOs mode
    [    0.782234] WARN::dwc_otg_hcd_init:1045: FIQ DMA bounce buffers: virt = bad14000 dma = 0xfad14000 len=9024
    [    0.782263] FIQ FSM acceleration enabled for :
                   Non-periodic Split Transactions
                   Periodic Split Transactions
                   High-Speed Isochronous Endpoints
                   Interrupt/Control Split Transaction hack enabled
    [    0.782270] dwc_otg: Microframe scheduler enabled
    [    0.782332] WARN::hcd_init_fiq:457: FIQ on core 1
    [    0.782343] WARN::hcd_init_fiq:458: FIQ ASM at 80654f4c length 36
    [    0.782356] WARN::hcd_init_fiq:497: MPHI regs_base at bb810000
    [    0.782376] dwc_otg 3f980000.usb: DWC OTG Controller
    [    0.782409] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
    [    0.782445] dwc_otg 3f980000.usb: irq 56, io mem 0x00000000
    [    0.782497] Init: Port Power? op_state=1
    [    0.782503] Init: Power Port (0)
    [    0.782762] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
    [    0.782774] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    0.782783] usb usb1: Product: DWC OTG Controller
    [    0.782793] usb usb1: Manufacturer: Linux 4.19.66-v7+ dwc_otg_hcd
    [    0.782802] usb usb1: SerialNumber: 3f980000.usb
    [    0.783458] hub 1-0:1.0: USB hub found
    [    0.783505] hub 1-0:1.0: 1 port detected
    [    0.784102] dwc_otg: FIQ enabled
    [    0.784108] dwc_otg: NAK holdoff enabled
    [    0.784113] dwc_otg: FIQ split-transaction FSM enabled
    [    0.784125] Module dwc_common_port init
    [    0.784408] usbcore: registered new interface driver usb-storage
    [    0.784592] mousedev: PS/2 mouse device common for all mice
    [    0.785485] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
    [    0.785964] bcm2835-cpufreq: min=600000 max=1400000
    [    0.786439] sdhci: Secure Digital Host Controller Interface driver
    [    0.786445] sdhci: Copyright(c) Pierre Ossman
    [    0.786827] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
    [    0.787215] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
    [    0.787341] sdhci-pltfm: SDHCI platform and OF driver helper
    [    0.788912] ledtrig-cpu: registered to indicate activity on CPUs
    [    0.789068] hidraw: raw HID events driver (C) Jiri Kosina
    [    0.789276] usbcore: registered new interface driver usbhid
    [    0.789281] usbhid: USB HID core driver
    [    0.790108] vchiq: vchiq_init_state: slot_zero = (ptrval), is_master = 0
    [    0.791793] [vc_sm_connected_init]: start
    [    0.801593] [vc_sm_connected_init]: end - returning 0
    [    0.802778] Initializing XFRM netlink socket
    [    0.802806] NET: Registered protocol family 17
    [    0.802929] Key type dns_resolver registered
    [    0.803517] Registering SWP/SWPB emulation handler
    [    0.804177] registered taskstats version 1
    [    0.804195] Loading compiled-in X.509 certificates
    [    0.811529] uart-pl011 3f201000.serial: cts_event_workaround enabled
    [    0.811621] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 81, base_baud = 0) is a PL011 rev2
    [    0.813391] console [ttyS0] disabled
    [    0.813428] 3f215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 31250000) is a 16550
    [    0.813486] console [ttyS0] enabled
    [    0.814573] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
    [    0.814583] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
    [    0.840803] sdhost: log_buf @ (ptrval) (fad13000)
    [    0.876152] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
    [    0.877737] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    0.879321] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    0.882218] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
    [    0.889259] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
    [    0.890603] of_cfs_init
    [    0.890777] of_cfs_init: OK
    [    0.891606] Waiting for root device PARTUUID=39f0d070-02...
    [    0.948401] mmc0: host does not support reading read-only switch, assuming write-enable
    [    0.951338] mmc0: new high speed SDHC card at address 59b4
    [    0.952735] mmcblk0: mmc0:59b4 USD00 15.0 GiB
    [    0.954798]  mmcblk0: p1 p2
    [    0.956467] random: fast init done
    [    0.966424] mmc1: new high speed SDIO card at address 0001
    [    0.984119] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    0.984178] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
    [    0.992202] devtmpfs: mounted
    [    0.997626] Freeing unused kernel memory: 1024K
    [    1.012201] Run /sbin/init as init process
    [    1.012326] Indeed it is in host mode hprt0 = 00021501
    [    1.221884] usb 1-1: new high-speed USB device number 2 using dwc_otg
    [    1.222045] Indeed it is in host mode hprt0 = 00001101
    [    1.462163] usb 1-1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
    [    1.462181] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.462884] hub 1-1:1.0: USB hub found
    [    1.462978] hub 1-1:1.0: 4 ports detected
    [    1.526149] systemd[1]: System time before build time, advancing clock.
    [    1.708386] NET: Registered protocol family 10
    [    1.709755] Segment Routing with IPv6
    [    1.739744] random: systemd: uninitialized urandom read (16 bytes read)
    [    1.742611] random: systemd: uninitialized urandom read (16 bytes read)
    [    1.748726] systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
    [    1.749350] systemd[1]: Detected architecture arm.
    [    1.750489] systemd[1]: Set hostname to <raspberrypi>.
    [    1.782007] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
    [    1.808216] random: systemd-sysv-ge: uninitialized urandom read (16 bytes read)
    [    1.922216] usb 1-1.1: New USB device found, idVendor=0424, idProduct=2514, bcdDevice= b.b3
    [    1.922233] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.922935] hub 1-1.1:1.0: USB hub found
    [    1.923024] hub 1-1.1:1.0: 3 ports detected
    [    2.241891] usb 1-1.1.2: new full-speed USB device number 4 using dwc_otg
    [    2.289429] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
    [    2.289987] systemd[1]: Listening on Journal Socket.
    [    2.290179] systemd[1]: Reached target Swap.
    [    2.290417] systemd[1]: Listening on Syslog Socket.
    [    2.291518] systemd[1]: Created slice User and Session Slice.
    [    2.312147] systemd[1]: Listening on fsck to fsckd communication Socket.
    [    2.312547] systemd[1]: Listening on udev Control Socket.
    [    2.375313] usb 1-1.1.2: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
    [    2.375329] usb 1-1.1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
    [    2.375340] usb 1-1.1.2: Product: USB2.0-Serial
    [    2.431957] i2c /dev entries driver
    [    2.672012] usb 1-1.1.1: new high-speed USB device number 5 using dwc_otg
    [    2.812333] usb 1-1.1.1: New USB device found, idVendor=0424, idProduct=7800, bcdDevice= 3.00
    [    2.812352] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    3.007355] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [    3.077294] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
    [    3.078330] libphy: lan78xx-mdiobus: probed
    [    3.078803] systemd-journald[102]: Received request to flush runtime journal from PID 1
    [    3.089720] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): int urb period 64
    [    3.778314] media: Linux media interface: v0.10
    [    3.781520] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.785462] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
    [    3.785479] [vc_sm_connected_init]: start
    [    3.804396] [vc_sm_connected_init]: installed successfully
    [    3.823241] videodev: Linux video capture interface: v2.00
    [    3.880134] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.880140] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.895033] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.898150] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.904925] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
    [    3.932696] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
    [    3.932714] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
    [    3.933310] bcm2835_audio soc:audio: card created with 8 channels
    [    3.937328] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
    [    3.937343] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
    [    3.950635] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
    [    3.950651] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
    [    4.151733] cfg80211: Loading compiled-in X.509 certificates for regulatory database
    [    4.166134] usbcore: registered new interface driver usbserial_generic
    [    4.166232] usbserial: USB Serial support registered for generic
    [    4.177214] usbcore: registered new interface driver ch341
    [    4.177340] usbserial: USB Serial support registered for ch341-uart
    [    4.177475] ch341 1-1.1.2:1.0: ch341-uart converter detected
    [    4.188473] usb 1-1.1.2: ch341-uart converter now attached to ttyUSB0
    [    4.215936] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
    [    4.328281] brcmfmac: F1 signature read @0x18000000=0x15264345
    [    4.336038] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
    [    4.336763] usbcore: registered new interface driver brcmfmac
    [    4.605941] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
    [    4.633684] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04
    [    6.519646] uart-pl011 3f201000.serial: no DMA platform data
    [    6.930723] random: crng init done
    [    6.930745] random: 7 urandom warning(s) missed due to ratelimiting
    [    7.215726] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [    7.215741] brcmfmac: power management disabled
    [    7.217877] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
    [    7.510584] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    [   13.401027] Bluetooth: Core ver 2.22
    [   13.401099] NET: Registered protocol family 31
    [   13.401103] Bluetooth: HCI device and connection manager initialized
    [   13.401126] Bluetooth: HCI socket layer initialized
    [   13.401135] Bluetooth: L2CAP socket layer initialized
    [   13.401158] Bluetooth: SCO socket layer initialized
    [   13.608178] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
    [   14.742869] Bluetooth: HCI UART driver ver 2.3
    [   14.742878] Bluetooth: HCI UART protocol H4 registered
    [   14.742928] Bluetooth: HCI UART protocol Three-wire (H5) registered
    [   14.743054] Bluetooth: HCI UART protocol Broadcom registered
    [   15.075555] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   15.075567] Bluetooth: BNEP filters: protocol multicast
    [   15.075585] Bluetooth: BNEP socket layer initialized
    [   15.134369] Bluetooth: RFCOMM TTY layer initialized
    [   15.134398] Bluetooth: RFCOMM socket layer initialized
    [   15.134423] Bluetooth: RFCOMM ver 1.11
    [   15.309786] fuse init (API version 7.27)
    


  • This doesn't say much to me. I think you should check what openhab shows in the log and configuration. Or other applications that use that port



  • Could it have anything to do with permissions? Perhaps try somthing like "sudo chmod 777 /dev/ttyUSB0"
    If it works you would need to find a more permantent solution like adding group/user access to to the device..
    Perhaps a long shot..

    I've had similar problems using arduino IDE before still have som problems when using ISP-programmer.



  • This post is deleted!


  • @niclas Hi,

    I don't think it's permissions related, I used:

    sudo usermod -a -G dialout openhab
    sudo usermod -a -G tty openhab
    

    when I was setting up according to this setup guide



  • So I think I have solved the ttyUSB0 in use problem - I had a bridge definition in my things file, and I had added a serial gateway through paperui, and I think they were conflicting.

    I've removed the paperui gateway and reverted to the things file entry, and visa-versa and have not seen that error again.

    However, I can't seem to get an example binary switch sensor node to be registered by the gateway, or read the serial debug of the gateway using the arduino ide


  • Hero Member

    @CraigDubya is your user which is executing the Arduino ide also in the dialout group? Did you program the gateway via this ide?
    Please ensure, that only one software is using the serial connection at a time. But you are able to switch between Arduino ide and Openhab if you shut down the other software before using the other.



  • @TimO Hi,

    So, something interesting... If I stop the openhab2.service I still get no debug information on the serial monitor of the Arduino IDE. Then, if I stop the mysgw.service and open the Arduino IDE I can no longer select the ttyUSB0 port for the serial monitor.

    I didn't use the native Arduino IDE to program the serial monitor, but I used my laptop to do that.



  • I've also tried adding the user pi to the dialout and tty groups, but still I can't select any port in the arduino ide when mysgw.service and openhab2.service are stopped. It's as if the mysgw.service is creating the ttyUSB0 port (virtually?) 😕



  • I did a ls /dev/tty* and ttyUSB0 had disappeared...so I unplugged the gateway and plugged it back in again (all while mysgw.service is stopped) then another ls /dev/tty* and ttyUSB0 was back. I started the arduino ide and selected ttyUSB0 and in the serial monitor I now have:

    0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGA---,FQ=16,REL=255,VER=2.3.2
    0;255;3;0;9;5 TSM:INIT
    0;255;3;0;9;7 TSF:WUR:MS=0
    0;255;3;0;9;15 TSM:INIT:TSP OK
    0;255;3;0;9;18 TSM:INIT:GW MODE
    0;255;3;0;9;21 TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;24 MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.3.2
    0;255;3;0;9;28 MCO:BGN:STP
    0;255;3;0;9;35 MCO:BGN:INIT OK,TSP=1
    0;255;3;0;9;38 TSM:READY:NWD REQ
    0;255;3;0;9;45 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    


  • When I restart the mysgw.service and do a ls /dev/tty* the ttyUSB0 is shown in blue as opposed to yellow as seen below.

    ttyUSB0.png


  • Mod

    @CraigDubya mysgw.service is partly a software gateway. From earlier posts, it seems you also have a hardware gateway (based on an Arduino Nano). Is that correct?

    If so, the two gateways might conflict. Is your intention to run two gateways?



  • @mfalkvidd Hi,

    No, my intention is not to run 2 gateways, I did a make on the mysgw.service and changed the port to ttyUSB020 in the config and restarted openhab. I now have communication with the hardware gateway. It seems it's all working properly now, but I'm a bit concerned that I may still have a software gateway running aswell.

    karaf.png



  • I just rebooted my pi, and whatever I did to get the bridge working has reset, and I'm not getting any node connections anymore 😕



  • If I stop the mysgw.service and restart openhab2.service the gateway works fine. So, the mysgw.service is starting on bootup, how do I remove or disable mysgw.service from bootup?



  • @mfalkvidd Sorry, in answer to your earlier question, that's correct... I have an Arduino Nano connected via USB to the raspberry pi as a hardware serial gateway



  • Ah I found it using:

    sudo systemctl disable mysgw.service
    

    Now when I reboot the pi the gateway is working and my sensor node is reporting correctly.

    Thanks for everyones help, it's been 2 years since I last played with openhab and mysensors, and what I learned back then I had mostly forgotten. Also with the openhab and mysensors updates that have happened in that time it's been a struggle to get back on track 😁


  • Mod

    Great work @CraigDuby, thanks for reporting back.



  • And so here is my serial gateway with 3d printed case:

    20200411_212514.jpg


Log in to reply
 

Suggested Topics

190
Online

9.7k
Users

10.3k
Topics

106.4k
Posts