RUN1 & RUN2 blinking in 2-second interval



  • Hi,

    I bought Neuron M403, it's running Minibian and I'm having trouble getting it to work (e.g. accessing both groups, switching on/off relays).

    • I have successfully installed Evok directly from master
    • Evok service is running
    • neuron_tcp_server is running
    root       276  0.0  0.1   2384  1552 ?        Ss   10:18   0:00 /opt/neurontcp/neuron_tcp_server -p 502 --check-firmware
    root       277  1.1  1.5  19812 15388 ?        Ss   10:18   0:01 /usr/bin/python /opt/evok/evok.py --path1=/etc/evok.conf --path2=/etc/evok-neuron.conf
    message+   280  0.0  0.2   5408  2796 ?        Ss   10:18   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
    root       287  0.0  0.0   1608   316 ?        Ss   10:18   0:00 runsv git-daemon
    gitlog     289  0.0  0.0   1752   968 ?        S    10:18   0:00 svlogd -tt /var/log/git-daemon
    gitdaem+   293  0.0  0.1   3608  1724 ?        S    10:18   0:00 /usr/lib/git-core/git-daemon --verbose --reuseaddr --base-path=/var/lib /var/lib/git
    root       302  0.0  0.2   3768  2416 ?        Ss   10:18   0:00 /lib/systemd/systemd-logind
    root       329  0.0  0.1   3964  1708 tty1     Ss+  10:18   0:00 /sbin/agetty --noclear tty1 linux
    root       330  0.0  0.1   3784  1896 ttyS0    Ss+  10:18   0:00 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt102
    nobody     344  0.0  0.1   2204  1436 ?        Ss   10:18   0:00 /usr/sbin/thd --daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile /var/run/thd.pid --user nobody /dev/input/event*
    ntp        353  0.0  0.3   5328  3628 ?        Ss   10:18   0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 105:109
    root       391  0.0  0.3   7140  3736 ?        Ss   10:18   0:00 /usr/sbin/apache2 -k start
    www-data   394  0.0  0.3 229548  3412 ?        Sl   10:18   0:00 /usr/sbin/apache2 -k start
    www-data   395  0.0  0.3 229548  3412 ?        Sl   10:18   0:00 /usr/sbin/apache2 -k start
    root       450  0.0  1.2  19488 12136 ?        S    10:18   0:00 /usr/bin/python /opt/evok/evok.py --path1=/etc/evok.conf --path2=/etc/evok-neuron.conf
    

    When I run the Neuron TCP server manually...

    $ /opt/neurontcp/neuron_tcp_server -p 502 --check-firmware --verbose
    Board on /dev/spidev0.1 firmware=4.6  hardware=0.16 (B-1000-1)
    Cannot open device: No such file or directory
    Cannot open device: No such file or directory
    Board0 PTY0 /dev/pts/2
    Starting loop
    

    When I run Evok manually...

    $ ./evok.py 
    eprom:: UniPi Neuron M403 version: 1.0 serial: 0x8
    Using config file /etc/evok-neuron.conf
    HTTP server listening on port: 8088
    Entering 1wire loop
    New WebSocket client connected
    [I 170125 09:51:24 web:1971] 200 GET /rest/all (192.168.7.185) 2.81ms
    

    Contents of /etc/evok-neuron.conf...

    #!! don't use # for inline comments
    
    [MAIN]
    webname = unipi-neuron
    staticfiles = /var/www/evok
    ;password = test
    ;rpcpassword = test
    secret = ut5kB3hhf6VmZCujXGQ5ZHb1EAfiXHcy
    port = 80
    enable_cors = False
    cors_domains = *
    modbus_port = 0
    #modbus_address = 127.0.0.1
    modbus_address = *
    
    [NEURON_1]
    scan_frequency = 2
    
    [OWBUS_1]
    owbus = --i2c=/dev/i2c-1:ALL     ; scanned bus (--i2c=/dev/i2c-1:ALL or localhost:2122 or 'u' for USB dongle)
    interval = 3          ; [s] default sensor reading
    scan_interval = 300    ; [s] how often is made searching
    

    When I send a GET request to /rest/all (Evok REST API), this is what I get...

    [
      {
        "circuit": "1_01",
        "debounce": 50,
        "counter": 0,
        "value": 0,
        "dev": "input",
        "counter_mode": "disabled"
      },
      {
        "circuit": "1_02",
        "debounce": 50,
        "counter": 0,
        "value": 0,
        "dev": "input",
        "counter_mode": "disabled"
      },
      {
        "circuit": "1_03",
        "debounce": 50,
        "counter": 0,
        "value": 0,
        "dev": "input",
        "counter_mode": "disabled"
      },
      {
        "circuit": "1_04",
        "debounce": 50,
        "counter": 0,
        "value": 0,
        "dev": "input",
        "counter_mode": "disabled"
      },
      {
        "value": 0,
        "pending": false,
        "circuit": "1_01",
        "dev": "relay"
      },
      {
        "value": 0,
        "pending": false,
        "circuit": "1_02",
        "dev": "relay"
      },
      {
        "value": 0,
        "pending": false,
        "circuit": "1_03",
        "dev": "relay"
      },
      {
        "value": 0,
        "pending": false,
        "circuit": "1_04",
        "dev": "relay"
      },
      {
        "value": 0.0159,
        "circuit": "1_01",
        "dev": "ai"
      },
      {
        "value": 0.014369322022101755,
        "circuit": "1_02",
        "dev": "ai"
      },
      {
        "value": 0.0105,
        "circuit": "1_01",
        "dev": "ao"
      }
    ]
    

    The group 2 is completely missing.

    When I try to switch a relay from the second group (POST /rest/relay/2_01), I'm getting an error {"errors": {"__all__": "Invalid device circuit number 2_01"}, "success": false}.

    What am I doing wrong? Could you please help me?


  • administrators

    @Baggz It seems that the SPI overlay is not enabled. Please try to reinstall the tcp modbus server including the overlay and paste the output please

    https://github.com/UniPiTechnology/neuron_tcp_modbus_overlay

    You should see also devices SPIDEV0.1 and SPIDEV0.2 in /dev/



  • @tomas_hora, thanks for the reply!

    Here's the output when installing the Overlay again.

    $ git clone https://github.com/UniPiTechnology/neuron_tcp_modbus_overlay.git
    Cloning into 'neuron_tcp_modbus_overlay'...
    remote: Counting objects: 32, done.
    remote: Total 32 (delta 0), reused 0 (delta 0), pack-reused 32
    Unpacking objects: 100% (32/32), done.
    Checking connectivity... done.
    
    $ cd neuron_tcp_modbus_overlay/
    $ ls
    LICENSE  README.md  install.sh	neuron_tcp_server  spi_overlay
    
    $ chmod +x install.sh 
    $ ./install.sh 
    Installing libmodbus
    Hit http://archive.raspberrypi.org jessie InRelease
    Hit http://archive.raspberrypi.org jessie/main armhf Packages          
    Ign http://archive.raspberrypi.org jessie/main Translation-en                                                         
    Hit http://mirrordirector.raspbian.org jessie InRelease               
    Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
    Hit http://mirrordirector.raspbian.org jessie/firmware armhf Packages
    Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
    Ign http://mirrordirector.raspbian.org jessie/firmware Translation-en
    Ign http://mirrordirector.raspbian.org jessie/main Translation-en
    Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en                                                                                  
    Reading package lists... Done                                                                                                                          
    Reading package lists... Done
    Building dependency tree        
    Reading state information... Done
    libmodbus-dev is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
    Enabling SPI overlay
    Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
    Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
    mkdir: cannot create directory '/opt/neurontcp': File exists
    Compiling neurontcp server...
    gcc -g -c  -I .  armspi.c -o armspi.o
    gcc -g -c  -I .  spicrc.c -o spicrc.o
    gcc -g -c  -I .  nb_modbus.c -o nb_modbus.o
    gcc -g -c  -I .  armpty.c -o armpty.o
    gcc -g -c  -I .  neuron_tcp_server.c -o neuron_tcp_server.o
    gcc -g neuron_tcp_server.o armspi.o spicrc.o nb_modbus.o armpty.o  -lmodbus -lutil -o neuron_tcp_server
    gcc -g -c  -I .  neuronspi.c -o neuronspi.o
    gcc -g neuronspi.o armspi.o spicrc.o -o neuronspi
    gcc -g -c  -I .  bandwidth-client.c -o bandwidth-client.o
    gcc -g bandwidth-client.o armspi.o spicrc.o nb_modbus.o armpty.o  -lmodbus -lutil -o bandwidth-client
    Installing Neuron TCP server into /opt/neurontcp/
    cp: cannot create regular file '/opt/neurontcp/neuron_tcp_server': Text file busy
    Enabling neurontcp service for systemd
    Reboot is required. Is it OK to reboot now? [y/n] y
    

    When I try to compile just the SPI Overlay, this what I get.

    $ sh compile-dtc 
    Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
    Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
    

    Also, contents of the /boot/config.txt is...

    gpu_mem=16
    dtparam=spi=on
    dtparam=i2c_arm=on
    
    #Enable i2c bus 1
    device_tree_param=i2c1=on
    
    #Enable UniPi Neuron SPI overlay
    dtoverlay=neuron-spi
    dtoverlay=w1-gpio
    enable_uart=1
    

    Isn't the issue in Minibian? Shall I try Raspbian?


  • administrators

    @Baggz It seems OK, did you restart the OS?



  • @tomas_hora

    Yes, I did. Still the same. :-(


  • administrators

    @Baggz Try commenting out the dtparam=spi=on and dtoverlay=w1-gpio and reboot

    Howeve I did not test it with minibian but shoudl be ok. Raspbian definitely works..



  • @tomas_hora

    Thank a lot for your help!

    I end up using Raspbian and it works out of the box! :-) Minibian seems to be a bit buggy, wouldn't recommend.

    Thanks!



  • @tomas_hora

    BTW, I absolute love Neuron! <3 I'll put it everywhere.

    Having a simple REST API is a bless.

    Thank you for all your hard work that goes into UniPi!