• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to add xS40 to Neuron L203 using custom software

    Official API - Evok
    6
    46
    21115
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      TomasKnot @Boy Lenssen last edited by

      @Boy-Lenssen

      Do you see the TX and RX leds blinking? That's the most part important. Ideally if you could mention the status of all four of them.

      The dip switches are used to set speed, parity and address, as per the descriptions on top. They need to be set to 19200, N, and e.g. 1 (you will need to set the address to 1 in the configuration file as well).

      The switch on the Neuron (there is another equivalent switch on the extension marked END) is used to turn on termination resistors. These are used to make the line more resistant to noise, and you can ignore it for now.

      1 Reply Last reply Reply Quote 0
      • B
        Boy Lenssen last edited by

        I have no idea how to set the dipswitches to 19200 N and 1. They are just 8 "toggles".

        The TX / RX on both xS40 and Neuron don't do anything. I have all dipswitches to 'off'.
        The run led is blinking every 2 seconds. Power led is on ofcourse :)

        Do I need a minimum version of the EVOK service installed on the system?

        1 Reply Last reply Reply Quote 0
        • T
          TomasKnot last edited by TomasKnot

          Does the file /dev/extcomm/0/0 exist? Try changing it to /dev/ttyNS0 if it does not.

          If the TX light on the Neuron doesn't turn on it means there is no communication at all.

          I'm not quite clear on what you by having an EVOK service installed.

          1 Reply Last reply Reply Quote 0
          • B
            Boy Lenssen last edited by Boy Lenssen

            root@raspberrypi:/home/pi# ls /dev/extcomm/
            0 1
            root@raspberrypi:/home/pi# ls /dev/extcomm/0/0
            /dev/extcomm/0/0
            root@raspberrypi:/home/pi#

            seems to exists.

            With evok service, I mean the latest EVOK software from Github.

            Is it correct to have the RS-485-A connected to the RS-485-A of the xS40 and the B's too?

            Can you point me to the page in the documentation someone should follow when adding an Extension unit?

            1 Reply Last reply Reply Quote 0
            • T
              TomasKnot last edited by TomasKnot

              @Boy-Lenssen
              It should be connected A-A, B-B, yes, the other way around will not work. The documentation, such as it is, is available from https://evok-6.api-docs.io/1.05/cgct7pncnqf9fper7/introduction, but it's targeted at users with prior experience with serial lines.

              I would use the following settings myself:

              [EXTENSION_1]
              global_id = 2                                                   ; Mandatory, REQUIRED TO BE UNIQUE
              device_name = xS40                                              ; Mandatory
              modbus_uart_port = /dev/extcomm/0/0     ; Mandatory
              neuron_uart_circuit = 1_01                             ; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0)
              ;allow_register_access = True                   ; Optional, False default, is mandatory with third-party devices
              address = 1                                                   ; Optional, 15 default
              scan_frequency = 10                                     ; Optional, 1 default
              ;scan_enabled = True                                    ; Optional, True default
              ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0
              baud_rate = 19200                                              ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
              parity = N                                                             ; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
              stop_bits = 1  
              

              Then connect the line and set the dip switches to the following positions:
              0_1526637503219_20180518_115609.jpg

              (apologies for the rotation)
              I have verified that these settings work with a fresh EVOK install, with the device in the photo.

              B 1 Reply Last reply Reply Quote 0
              • B
                Boy Lenssen @TomasKnot last edited by Boy Lenssen

                @TomasKnot Hey, thanks a lot! I got it working now. I think I might have forgotten to remove the semi-colon before [EXTENSION 1] :face_palm:

                Now the Rx light on the xS40 is now constant on, the run light is still going on / off every 2 seconds. On the neuron, the TX flashes on very swiftly.

                I don't see the extra in/outputs when I go to my ip address. How can I read / write the ports now? I thought I would get some ports like 4_05 or so...

                I tried something like this: http://192.168.1.16/rest/relay/UART_1_2 but gives a 500 error

                T 1 Reply Last reply Reply Quote 0
                • T
                  TomasKnot @Boy Lenssen last edited by TomasKnot

                  @Boy-Lenssen
                  This looks like an address problem perhaps, or possibly some other communication setting issue. Did you try to set it up as I have above? At least for testing purposes.

                  If you did do so then it may be another issue, possibly with a hardware definition; if you can run the following commands while connected to the Neuron and paste the output here we may find the problem.

                  sudo su
                  systemctl stop evok
                  python /opt/evok.py
                  
                  B 1 Reply Last reply Reply Quote 0
                  • B
                    Boy Lenssen @TomasKnot last edited by

                    @TomasKnot
                    Hi! As far as I can see, I set it up exactly the way you said above...
                    This is the output:

                    The /get/all call is my software requesting the status of all in and outputs, you can ignore that.

                    root@raspberrypi:/home/pi# python /opt/evok/evok.py 
                    [I 180522 06:56:19 config:63] eprom: UniPi Neuron L203 version: 1.0 serial: 0x51
                    [I 180522 06:56:19 evok:1634] Starting using config file /etc/evok.conf
                    [I 180522 06:56:20 config:75] YAML Definition loaded: L30x.yaml, type: 3, definition count 0
                    [I 180522 06:56:20 config:75] YAML Definition loaded: M20x.yaml, type: 3, definition count 1
                    [I 180522 06:56:20 config:75] YAML Definition loaded: M50x.yaml, type: 3, definition count 2
                    [I 180522 06:56:20 config:75] YAML Definition loaded: xS40.yaml, type: 3, definition count 3
                    [I 180522 06:56:20 config:75] YAML Definition loaded: M30x.yaml, type: 3, definition count 4
                    [I 180522 06:56:20 config:75] YAML Definition loaded: L40x.yaml, type: 3, definition count 5
                    [I 180522 06:56:20 config:75] YAML Definition loaded: S10x.yaml, type: 3, definition count 6
                    [I 180522 06:56:21 config:75] YAML Definition loaded: L51x.yaml, type: 3, definition count 7
                    [I 180522 06:56:21 config:75] YAML Definition loaded: CUSTOM MODBUS DEVICE.yaml, type: 3, definition count 8
                    [I 180522 06:56:21 config:75] YAML Definition loaded: L50x.yaml, type: 3, definition count 9
                    [I 180522 06:56:21 config:75] YAML Definition loaded: xS30.yaml, type: 3, definition count 10
                    [I 180522 06:56:21 config:75] YAML Definition loaded: xS10.yaml, type: 3, definition count 11
                    [I 180522 06:56:21 config:75] YAML Definition loaded: M40x.yaml, type: 3, definition count 12
                    [I 180522 06:56:21 config:75] YAML Definition loaded: M10x.yaml, type: 3, definition count 13
                    [I 180522 06:56:21 config:75] YAML Definition loaded: M60x.yaml, type: 3, definition count 14
                    [I 180522 06:56:22 config:75] YAML Definition loaded: L20x.yaml, type: 3, definition count 15
                    [I 180522 06:56:22 config:75] YAML Definition loaded: xS50.yaml, type: 3, definition count 16
                    [I 180522 06:56:22 config:75] YAML Definition loaded: evok-alias.yaml, type: 2, definition count 0
                    [I 180522 06:56:22 evok:1698] HTTP server listening on port: 8080
                    [I 180522 06:56:22 modbusclient_tornado:122] SPI client started
                    [I 180522 06:56:22 modbusclient_rs485:333] UART client started
                    [I 180522 06:56:22 neuron:268] Reading the UART board on Modbus address 1
                    [D 180522 06:56:22 owclient:377] Entering 1wire loop
                    [I 180522 06:56:22 web:2064] 101 GET /ws (::1) 3.76ms
                    [D 180522 06:56:22 evok:158] New WebSocket client connected
                    [I 180522 06:56:22 neuron:157] Reading SPI boards
                    [I 180522 06:56:22 web:2064] 200 GET /rest/all (::1) 3.10ms
                    [I 180522 06:56:22 config:351] Alias loaded: <neuron.Relay object at 0x75f42690> al_lights_kitchen
                    [I 180522 06:56:22 config:351] Alias loaded: <neuron.Relay object at 0x75f42650> al_lights_bedroom
                    [I 180522 06:56:24 web:2064] 101 GET /ws (::1) 1.79ms
                    [D 180522 06:56:24 evok:158] New WebSocket client connected
                    [I 180522 06:56:24 web:2064] 200 GET /rest/all (::1) 7.07ms
                    [E 180522 06:56:28 neuron:290] No cached value of register 1018 on unit 1 - read error
                        Traceback (most recent call last):
                          File "/opt/evok/neuron.py", line 283, in readboards
                            yield board.parse_definition(self.hw_dict, 1)
                          File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
                            value = future.result()
                          File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
                            raise_exc_info(self._exc_info)
                          File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run
                            yielded = self.gen.send(value)
                          File "/opt/evok/neuron.py", line 409, in parse_definition
                            regpolarity=m_feature['polar_reg'], legacy_mode=self.legacy_mode)
                          File "/opt/evok/neuron.py", line 1309, in __init__
                            curr_ds = self.arm.neuron.modbus_cache_map.get_register(1, self.regmode, unit=self.arm.modbus_address)[0]
                          File "/opt/evok/neuron.py", line 48, in get_register
                            raise Exception('No cached value of register %d on unit %d - read error' % (counter, unit))
                        Exception: No cached value of register 1018 on unit 1 - read error
                    ^C[I 180522 06:56:39 evok:1773] Shutting down
                    
                    1 Reply Last reply Reply Quote 0
                    • T
                      TomasKnot last edited by TomasKnot

                      It looks like the system can't connect to the device - does the RX light on the Neuron (not the extension) flash at all? It should be roughly simultaneous with the TX light.

                      From the log it looks like there's no valid communication with the extension unfortunately, so something must be wrong with the connection.

                      B 1 Reply Last reply Reply Quote 0
                      • U
                        unix last edited by

                        Hi
                        this day after a reboot i have the same error message and the link from S103G to xs50 not working only one short blink from the modbus rx/tx

                        reinstall evok and fresh image not working.

                        root@pimatic:~# /usr/bin/python /opt/evok/evok.py
                        [I 180524 19:27:48 config:63] eprom: UniPi Neuron S103 version: 1.0 serial: 0xd
                        [I 180524 19:27:48 evok:1634] Starting using config file /etc/evok.conf
                        [I 180524 19:27:48 config:75] YAML Definition loaded: M20x.yaml, type: 3, definition count 0
                        [I 180524 19:27:48 config:75] YAML Definition loaded: xS40.yaml, type: 3, definition count 1
                        [I 180524 19:27:48 config:75] YAML Definition loaded: M30x.yaml, type: 3, definition count 2
                        [I 180524 19:27:48 config:75] YAML Definition loaded: L40x.yaml, type: 3, definition count 3
                        [I 180524 19:27:49 config:75] YAML Definition loaded: L50x.yaml, type: 3, definition count 4
                        [I 180524 19:27:49 config:75] YAML Definition loaded: M50x.yaml, type: 3, definition count 5
                        [I 180524 19:27:49 config:75] YAML Definition loaded: M40x.yaml, type: 3, definition count 6
                        [I 180524 19:27:49 config:75] YAML Definition loaded: L30x.yaml, type: 3, definition count 7
                        [I 180524 19:27:49 config:75] YAML Definition loaded: xS50.yaml, type: 3, definition count 8
                        [I 180524 19:27:49 config:75] YAML Definition loaded: CUSTOM MODBUS DEVICE.yaml, type: 3, definition count 9
                        [I 180524 19:27:50 config:75] YAML Definition loaded: M60x.yaml, type: 3, definition count 10
                        [I 180524 19:27:50 config:75] YAML Definition loaded: L20x.yaml, type: 3, definition count 11
                        [I 180524 19:27:50 config:75] YAML Definition loaded: S10x.yaml, type: 3, definition count 12
                        [I 180524 19:27:50 config:75] YAML Definition loaded: xS30.yaml, type: 3, definition count 13
                        [I 180524 19:27:50 config:75] YAML Definition loaded: M10x.yaml, type: 3, definition count 14
                        [I 180524 19:27:51 config:75] YAML Definition loaded: L51x.yaml, type: 3, definition count 15
                        [I 180524 19:27:51 config:75] YAML Definition loaded: xS10.yaml, type: 3, definition count 16
                        [I 180524 19:27:51 config:75] YAML Definition loaded: DALI.yaml, type: 3, definition count 17
                        [I 180524 19:27:51 config:75] YAML Definition loaded: evok-alias.yaml, type: 2, definition count 0
                        [I 180524 19:27:51 evok:1698] HTTP server listening on port: 8080
                        [I 180524 19:27:51 modbusclient_tornado:122] SPI client started
                        [I 180524 19:27:51 modbusclient_rs485:333] UART client started
                        [I 180524 19:27:51 neuron:268] Reading the UART board on Modbus address 15
                        [I 180524 19:27:51 neuron:157] Reading SPI boards
                        [D 180524 19:27:51 owclient:377] Entering 1wire loop
                        [I 180524 19:27:51 neuron:172] No board on SPI 2
                        [E 180524 19:27:51 neuron:290] 'NoneType' object has no attribute 'get_register'
                            Traceback (most recent call last):
                              File "/opt/evok/neuron.py", line 283, in readboards
                                yield board.parse_definition(self.hw_dict, 1)
                              File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
                                value = future.result()
                              File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
                                raise_exc_info(self._exc_info)
                              File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run
                                yielded = self.gen.send(value)
                              File "/opt/evok/neuron.py", line 561, in parse_definition
                                self.parse_feature(m_feature, board_id)
                              File "/opt/evok/neuron.py", line 546, in parse_feature
                                self.parse_feature_ao(max_count, m_feature, board_id)
                              File "/opt/evok/neuron.py", line 478, in parse_feature_ao
                                dev_id=self.dev_id, major_group=m_feature['major_group'], legacy_mode=self.legacy_mode)
                              File "/opt/evok/neuron.py", line 1777, in __init__
                                self.offset = (uint16_to_int(self.arm.neuron.modbus_cache_map.get_register(1, self.regcal + 1, unit=self.arm.modbus_address)[0]) / 10000.0)
                            AttributeError: 'NoneType' object has no attribute 'get_register'
                        [I 180524 19:27:51 neuron:172] No board on SPI 3
                        [I 180524 19:27:51 config:351] Alias loaded: <neuron.Relay object at 0x7600dc70> al_lights_kitchen
                        [I 180524 19:27:51 config:351] Alias loaded: <neuron.Relay object at 0x7600df50> al_lights_bedroom
                        

                        Regards

                        1 Reply Last reply Reply Quote 0
                        • A
                          alydersen last edited by

                          I have this exact same issue as "unix", both with the master branch and 2.0.6. Anyone that came up with a solution?

                          1 Reply Last reply Reply Quote 0
                          • T
                            TomasKnot last edited by TomasKnot

                            Hi @alydersen!

                            Do you also have the xS50 and S103G models? The error is simply a generic error indicating that no data from the device is available to EVOK in its cache.

                            It can be caused by wrong parity, bitcount or address settings, as well as potentially any other issues which break the communication.

                            By far the most crucial LED indicator is the RX LED light on the master Neuron unit - does it light at all? If not it means that no response has been sent on the bus, which means that there is no data received on the underlying hardware - much less EVOK itself.

                            Please see below, apologies

                            1 Reply Last reply Reply Quote 0
                            • T
                              TomasKnot last edited by

                              @alydersen

                              It looks like there has been a recent bug in EVOK which caused the hardware definitions to be parsed incorrectly. What I said above does stand, but the error is a software bug on our part.

                              You will need to download the release 2.0.7 in order to fix the problems you are seeing. The source of the error is a missing condition which causes UART hw_definitions to break, though only some of the time.

                              1 Reply Last reply Reply Quote 0
                              • A
                                alydersen last edited by

                                Thanks @TomasKnot - will try it out

                                1 Reply Last reply Reply Quote 0
                                • A
                                  alydersen last edited by

                                  @TomasKnot That did it - thanks again

                                  1 Reply Last reply Reply Quote 0
                                  • B
                                    Boy Lenssen @TomasKnot last edited by Boy Lenssen

                                    @tomasknot Sorry for the late response! I had a different project that needed my attention.

                                    The RX light of the extension is constant on.
                                    the TX light of the Neuron flashes. The RX light doesn't do anything.

                                    Hope we can figure this out, as I got told we need to get this working soon, hopefully this week...

                                    This is the config:

                                    global_id = 1							; Mandatory, REQUIRED TO BE UNIQUE
                                    allow_register_access = False 			; Optional, False default
                                    scan_frequency = 10						; Optional, 10 default
                                    scan_enabled = True 					; Optional, True default
                                    
                                    ; Below you can find examples for connecting devices over UART; first example is a Neuron extension while the second is a custom third-party device
                                    ; Devices sharing a port use the port settings of the first device on that port (baud rate, parity, stopbits)
                                    ; !!!Note that device_name has to match a filename in the /etc/hw_definitions directory!!! See /etc/hw_definitions/DOMAT MMIO.yaml for an example
                                    
                                    [EXTENSION_1]
                                    global_id = 2							; Mandatory, REQUIRED TO BE UNIQUE
                                    device_name = xS40						; Mandatory
                                    modbus_uart_port = /dev/extcomm/0/0 	; Mandatory
                                    ;neuron_uart_circuit = 1_01				; Optional, allows associating extensions with specific Neuron UART-over-Modbus ports (not possible for non-Modbus UART ports, e.g. /dev/ttyUSB0 or /dev/ttyS0)
                                    ;allow_register_access = True 			; Optional, False default, is mandatory with third-party devices
                                    address = 1							; Optional, 1 default
                                    ;scan_frequency = 10 					; Optional, 10 default
                                    ;scan_enabled = True 					; Optional, True default
                                    ; Note that the following settings will be inherited by other devices sharing the same port, i.e. /dev/extcomm/0/0
                                    baud_rate = 19200						; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
                                    parity = N								; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
                                    stop_bits = 1							; Optional, NEEDS UNIPI IMAGE TO WORK! USE API TO CONFIGURE UART MANUALLY IF USING STANDARD RASPBIAN
                                    

                                    This is the config on the xS40:

                                    https://imgur.com/a/Af53afq

                                    What can I do to help troubleshoot further?

                                    1 Reply Last reply Reply Quote 0
                                    • T
                                      TomasKnot last edited by

                                      @Boy-Lenssen
                                      That definitely looks like a problem with UART settings, as no RX on the Neuron indicates that there is no response from the extension, not even an error response (which is what occurs when e.g. reading wrong registers or issuing invalid commands).

                                      Could you try using the latest version of EVOK? It is possible that some recent changes will help fix the problems you are seeing.

                                      B 1 Reply Last reply Reply Quote 0
                                      • B
                                        Boy Lenssen @TomasKnot last edited by

                                        @tomasknot I'm sorry, I'm already running 2.0.7. Forgot to mention.

                                        still getting this:

                                            Traceback (most recent call last):
                                              File "/opt/evok/neuron.py", line 289, in readboards
                                                yield board.parse_definition(self.hw_dict, 1)
                                              File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
                                                value = future.result()
                                              File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
                                                raise_exc_info(self._exc_info)
                                              File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1069, in run
                                                yielded = self.gen.send(value)
                                              File "/opt/evok/neuron.py", line 571, in parse_definition
                                                self.parse_feature(m_feature, board_id)
                                              File "/opt/evok/neuron.py", line 547, in parse_feature
                                                self.parse_feature_di(max_count, m_feature, board_id)
                                              File "/opt/evok/neuron.py", line 413, in parse_feature_di
                                                regpolarity=m_feature['polar_reg'], legacy_mode=self.legacy_mode)
                                              File "/opt/evok/neuron.py", line 1394, in __init__
                                                curr_ds = self.arm.neuron.modbus_cache_map.get_register(1, self.regmode, unit=self.arm.modbus_address)[0]
                                              File "/opt/evok/neuron.py", line 50, in get_register
                                                raise Exception('No cached value of register %d on unit %d - read error' % (counter, unit))
                                            Exception: No cached value of register 1018 on unit 1 - read error
                                        
                                        B 1 Reply Last reply Reply Quote 0
                                        • B
                                          Boy Lenssen @Boy Lenssen last edited by Boy Lenssen

                                          @TomasKnot do you have any pointers for me? I really need to get this working for a customer :\

                                          Any way I can supply you with more info to test it?

                                          Maybe you can create an SD card image file of the configuration that works for you so I can try it out?

                                          Martin Kudláček 1 Reply Last reply Reply Quote 0
                                          • Martin Kudláček
                                            Martin Kudláček @Boy Lenssen last edited by

                                            @boy-lenssen Hello, I am terribly sorry for a delay on our side. Tommorow morning I will reproduce your setup (L203 with xS40) and supply you with the working image. Thank you for you patience.

                                            Martin

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post