Problem with running MySensors gateway on NanoPi NEO with Armbian



  • Hello,
    I would like to ask if anyone has successfully run Gateway on NanoPi NEO with Armbian installed.
    I am especially interested in running it with RS485 as a transport, but any information will be helpful.

    I have successfully compiled and run MySensors on the NanoPi Neo:

    $ ./configure --my-transport=rs485 --my-rs485-serial-port=/dev/ttyS1 --my-rs485-de-pin=1 --my-gateway=mqtt --my-controller-ip-address=192.168.1.100 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1
    [...]
    
    $ make
    [...]
    
    $ sudo ./bin/mysgw
    
    Jul 28 00:18:53 INFO  Starting gateway...
    Jul 28 00:18:53 INFO  Protocol version - 2.3.2
    Jul 28 00:18:53 DEBUG MCO:BGN:INIT GW,CP=RSNGL---,FQ=NA,REL=255,VER=2.3.2
    Jul 28 00:18:53 DEBUG TSF:LRT:OK
    Jul 28 00:18:53 DEBUG TSM:INIT
    Jul 28 00:18:53 DEBUG TSF:WUR:MS=0
    Jul 28 00:18:53 DEBUG Serial port /dev/ttyS1 (9600 baud) created
    Jul 28 00:18:53 DEBUG TSM:INIT:TSP OK
    Jul 28 00:18:53 DEBUG TSM:INIT:GW MODE
    Jul 28 00:18:53 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Jul 28 00:18:53 DEBUG MCO:REG:NOT NEEDED
    Jul 28 00:18:53 DEBUG MCO:BGN:STP
    Jul 28 00:18:53 DEBUG MCO:BGN:INIT OK,TSP=1
    Jul 28 00:18:53 DEBUG GWT:RMQ:CONNECTING...
    Jul 28 00:18:53 DEBUG connected to 192.168.1.100
    Jul 28 00:18:53 DEBUG GWT:RMQ:OK
    Jul 28 00:18:53 DEBUG GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT
    Jul 28 00:18:53 DEBUG TSM:READY:NWD REQ
    Jul 28 00:18:53 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    
    

    I have the node with BME280 prepared and I've tested it works correctly with another gateway (Arduino Mega).
    All wires triple checked and I am running out of ideas.
    Any tips are highly appreciated.
    Knowing this setup works for someone else will be already a huge help.



  • Hello,

    I noticed that you did not yet get an answer. While I have not worked with this specific combination, I do have a NEO2 with armbian, and have played with GPIO on these a bit. Maybe I can help?

    No experience with RS485 on mysensors, though...

    My first thought is, that it is very easy to get confused with pin numbers on these boards, with chip pin numbers/board pin numbers/linux GPIO numbers potentially all being different. You can look at Friendlyarm's gpio tool (specifically 'readall') to help test and clarify. Are you sure that your driver enable pin is correct? Do you have a multimeter or a scope to check weither it is being activated? I would try and use the sysfs interface to test your chosen driver enable pin.
    I found a simple explanation here, if you are not familiar with the gpio sysfs system.

    Also, you can temporarily connect the TX and RX for your serial port and do a loopback test with screen /dev/ttyS1 9600 or another terminal program. You should see any characters that you send coming back to you if the serial port is working right.

    Is that perhaps helpful?

    Best regards,
    pragtich



  • Hello @pragtich,
    Thank you so much for your reply. Your tips on how to debug serial port and GPIOs were extremely helpful.
    Thanks to that I have found the reason it was not working. It was poorly soldered pin of bidirectional level shifter (the one for the driver enable pin).
    You've pointed me in the right direction.

    I will leave some information about my configuration and wiring, if someone would try the same thing.
    Here is the pinout for NanoPi NEO.

    Pin PA1 on the board can be configured with --my-rs485-de-pin=1.
    Pin PG11 on the board can be configured with --my-rs485-de-pin=203.
    See section 4.1. of board documentation to see more.

    I use MAX485 module for RS485 and all wires for it (TX, RX, DE) are going through bi-directional level shifter (3.3V <-> 5V).
    I am running Armbian 20.11 Bionic with Linux 5.8.16-sunxi on NanoPi NEO. I've tried latest one, but had some problems with accessing ports.



  • Hi @mariuszjozala ,

    Thank you for reporting back. Glad that it works now!

    In my eyes, the good documentation (and availability of LTS options) is one of the really big plus points of the NanoPi/FriendlyARM products. I did save a local copy of their wiki, just in case it ever disappeared, because these references are really helpful.

    Best regards
    pragtich


Log in to reply
 

Suggested Topics

2
Online

10.3k
Users

10.7k
Topics

109.5k
Posts