Working with EVOK API for the first time



  • Hi Tomas, thank you for the clarification. I figured that this is a POST request, and not GET, got it. However, none of these forms are actually secure at all. Even though the POST request doesn't show the data in the URL, the data is still visible in the body of the message. This means that anyone with access to the network is capable of changing PLC configuration and I/O state at will. This worries me. Therefore, my next question is how can I configure EVOK to only respond to localhost connections (i.e. block all connections from outside)?


  • administrators

    @thiagoralves

    Technically speaking POST requests can also pass attributes via the URL. At any rate - I agree completely. We recommend setting up filtering via IP tables and setting up a VPN (via OpenVPN) or a proxy if remote access is required, as denying the requests in EVOK would make the system much more vulnerable to DDOS attacks as well as other potential vulnerabilities.

    We used to implement a "secure" protocol access to EVOK, but the device lacks the capacity to handle the amount of requests which can reach a public IP - even just to drop them with a Python-based webserver - and it caused significant latency and overhead.



  • You don’t have to manually inspect and deny every packet. That would be unfeasible and greatly impact on performance, of course. Instead you can bind the socket only to the localhost adapter. This will prevent any external connection from reaching the server. I though EVOK had this functionality. If it doesn’t, I might modify the code myself and add this.

    My intention is to use EVOK as a layer for the OpenPLC UniPi driver. The next problem I’m facing is that OpenPLC also uses port 8080 for its webserver. However, even after changing EVOK port in the config file to 8081, port 8080 is still reserved and can’t be used.


  • administrators

    @thiagoralves

    You are very welcome to try and implement this yourself, but we currently have no plans to support this functionality. Most other similar IoT API frameworks, e.g. OpenHab, also opt to rely on IP filtering instead, and I believe it is far more straightforward and simple to setup. We would be happy to accept your code, and do have ours public if you wish to keep them to yourself. I understand this may seem like basic functionality, but to my knowledge it isn't simple or straightforward to implement in the version of Tornado which we use. What is easy to implement is only listening to a specific IP address, but binding to a specific interface, such that you can run two servers on the same port at once, one of which is 0.0.0.0, is considerably more tricky.

    As for the second part of your question - you should be able to see which programs are bound to a port via the "netstat -paunt" command - I believe this may in your case be either NGINX or perhaps an older instance of Evok. Do get back to us with an output of the command if changing the port in the configuration file (both /etc/evok.conf and /etc/evok-nginx.conf) and rebooting does not help.


  • administrators

    @thiagoralves

    I had a look at OpenPLC and I apologise if some of my comments above came across as a bit patronising; we have a wide range of customers in terms of skills. Our preferred solution is to use a firewall for security if at all possible, and we would rather discourage users from making the device publicly available at all, which is why binding to a specific IP is not a configuration option (though I'd like to reiterate that binding to a specific interface is considerably more complicated). You can easily implement it within EVOK by changing the line 1718 in evok.py, from

    httpServer.listen(port)
    

    to,

    httpServer.listen(port, address="127.0.0.1")
    

    or some variant thereof.

    That said, changing the port should indeed be working and would personally be my preferred solution. I am quite keen on finding out why the port is still reserved if you have changed the configuration and restarted EVOK.



  • @tomasknot
    Hi Tomas, thank you for your response. I ended up never giving you an update about this. In fact, the port being reserved was my mistake. I had already installed OpenPLC when I issued the netstat command, and didn't pay attention to the process that was using the port. In fact, the process that was using 8080 was OpenPLC =} (my bad!)

    So, everything worked out fine when I modified the evok config files. About the localhost thing, I had also figured that out myself. I though that it would be a "one-liner" kinda problem. So, no big deal.

    I'm now writing the driver to integrate EVOK with OpenPLC hardware layer. Hopefully in a few days I might have a prototype working and will publish that on OpenPLC website. So far, I'm manually polling every I/O using "rest/di/1_01" type of command, however this seems to be fairly inefficient. Is there any command that will give me the whole I/O status at once? And also, is there a command that will allow me to change multiple outputs at the same time?

    Meanwhile, I'm also having problems with the neuron_tcp_service. It listens on port 502 which is the same port OpenPLC uses to bind its Modbus/TCP server. I tried changing the command line argument of the systemd service (/lib/systemd/system/neurontcp.service) to "/opt/neuron-bin/neuron_tcp_server -p 501" but it broke EVOK entirely. After I have done that, every request I made to EVOK responded with an internal server error. Fortunately you can easily change the Modbus server port on OpenPLC using the web interface, so this shouldn't be a big deal. However, given that port 502 is usually reserved for Modbus/TCP, it would be nice to have OpenPLC using that port.



  • Tomas,

    So far my experience with EVOK has been interesting. The system offers a lot of capability, but at the same time it seems to be a heavy layer between the hardware. OpenPLC needs a faster way to access GPIO. While using EVOK, OpenPLC slows down considerably. I believe that there might be optimizations that can be done on the OpenPLC hardware driver side, but still I'm not expecting to achieve great speeds with this.

    For UniPi v1.1 I wrote a driver that has direct access to hardware, so now I would like to do the same thing with the Neuron devices. I know that the Neuron architecture is a lot more complicated than the first UniPi, but still I would like to try writing a rudimentary driver that allows at least to read and write local I/O.

    So, could you explain a bit how EVOK communicates with the internal microcontroller? Are they using Modbus? If so, what is the configuration (baud rate, etc, etc) and the register addresses? If the internal communication is in fact Modbus, I can use OpenPLC's Modbus driver to talk to it, and done!


  • administrators

    Hello @thiagoralves!

    I agree that EVOK puts quite a heavy layer between the hardware and the application. You can significantly increase the speed by a) increasing scanning frequency in the configuration file and b) disabling or lowering debouncing (this is only relevant with >20Hz scanning rates).

    Regardless - yes there is in fact a ModBus server! This is how both CODESYS and Mervis IDEs communicate with the device. The internal architecture looks like this:

    • Web GUI/App
    • ------ Network Stack ------
    • EVOK
    • TCP Modbus server written in C
    • GPIO/IIO/LED/etc. drivers, with SYSFS support (Note that these are written by UniPi, and are not connected to the RPI GPIOs in any way! All internal communication is via SPI; also the ModBus server does not use these but rather communicates with the device directly)
    • UniPi SPI 8MHz /12 MHz driver (custom Modbus-based, though not Modbus-compatible, protocol; described in https://git.unipi.technology/UniPi/unipi-kernel/src/master/docs); this is exposed via a character device in /dev/unipispi
    • 48MHz STM CPUs on custom PCBs keeping state and performing the SPI commands, providing electrical separation, additional ESD protection and hardware redundancy

    You can connect to the system at any desired level; large parts of our software including the driver and ModBus server are open source, which should provide you with all that you will need. For the ModBus server you'll also want the relevant ModBus maps, which you can find here. You may benefit from looking at the Mervis implementation as well - it is possible to use for evaluation purposes without a license, with only limited missing functionality.

    You should be able to squeeze out sub-millisecond communication rates easily enough, though it does get dicier in the microsecond range, largely because the RPI HW will not be able to keep up.

    I hope this helps



  • Hi Tomas! Wow, I wish I had found those documents before. This is exactly what I need. Well, it took me 30 seconds to configure the built-in UniPi Modbus server as a slave device on OpenPLC. I just had to provide the Modbus addresses on the web interface and boom, everything working. This by itself is already a lot faster than using EVOK, however, I think that using SYSFS on a specially crafted driver for UniPi will be a better approach. So now I'll convert the OpenPLC driver I wrote using EVOK to read/write directly from SYSFS.

    Once everything is working and tested appropriately, would you mind putting OpenPLC as an open source option on the softwares page for the Neuron?



  • I've finished writing the OpenPLC driver for Neurons. The installation instructions can be found here: http://www.openplcproject.com/getting-started-neuron

    All my tests were made on the small Neuron S103 and everything went great. Given that there are several different Neuron models available, I tried to create a generic driver "one-for-all" kinda style. To achieve that, upon driver initialization it scans the entire SYSFS path to find all possible combinations of I/Os so that the driver can map them all and work with different flavors of Neurons.

    So I decided to try this new driver with a Neuron M503 my University bought. This is when I found a weird problem. When OpenPLC driver is scanning for I/Os, it fails with weird error messages when it touches /sys/devices/platform/unipi_plc/io_group2/ao_2_1 (which is the first analog output of the second circuit). I found it interesting and decided to just perform a simple sudo cat /sys/devices/platform/unipi_plc/io_group2/ao_2_1/out_voltage0_raw. This is what I'm getting:

    pi@M503-sn22:/sys/devices/platform/unipi_plc/io_group2/ao_2_1 $ sudo cat out_voltage0_raw
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.866261] Internal error: Oops: 80000007 [#1] SMP ARM
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.916128] Process cat (pid: 1007, stack limit = 0xb90a4210)
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.918862] Stack: (0xb90a5dc8 to 0xb90a6000)
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.921548] 5dc0:                   00000000 00000001 00000001 00000002 014000c0 80276984
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.926833] 5de0: b90a5e34 b90a5df0 80276984 b6acbb00 b90e8280 8083bd4c b90a5e1c b90a5e08
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.932061] 5e00: 8053d6f8 7f4147bc b6acbb00 00001000 b90a5e44 b90a5e20 80309218 8053d6d8
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.937300] 5e20: b6acbb00 00000001 00000000 00000001 b6a2c000 b90a5f80 b90a5e54 b90a5e48
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.942696] 5e40: 80307a6c 8030918c b90a5ea4 b90a5e58 802b15ec 80307a44 00000000 b6acbb30
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.948424] 5e60: 76c6d000 00020000 00000000 00000000 bab4d488 00000000 b90a5ea4 00020000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.954374] 5e80: b90a5f80 76c6d000 b90a5f80 00020000 b6acbf00 00000000 b90a5edc b90a5ea8
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.960555] 5ea0: 80308884 802b1414 00000000 00100073 00000000 b6a2c000 b90a5f80 76c6d000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.967044] 5ec0: b90a5f80 00020000 b90a4000 00000000 b90a5f4c b90a5ee0 8028a624 8030875c
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.973667] 5ee0: 76c6c000 b90a5fb0 00001000 000001ff b90a5fac b90a5f00 801011e4 807a0468
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.980479] 5f00: b90a5f48 00000003 00022000 00000000 00000000 80242100 b90a5f74 8028a790
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.987419] 5f20: 80242100 8016cd34 00020000 b6a2c000 76c6d000 b90a5f80 80108204 b90a4000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   71.994397] 5f40: b90a5f7c b90a5f50 8028a7b8 8028a5f8 00000022 802aadf8 b90a5f7c b6a2c000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.001376] 5f60: b6a2c000 00020000 76c6d000 80108204 b90a5fa4 b90a5f80 8028ad68 8028a728
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.005460] 5f80: 00000000 00000000 00020000 7fffe000 00020000 00000003 00000000 b90a5fa8
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.008963] 5fa0: 80108060 8028ad20 00020000 7fffe000 00000003 76c6d000 00020000 00027184
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.012467] 5fc0: 00020000 7fffe000 00020000 00000003 00000003 00020000 ffffffff 00000000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.015970] 5fe0: 00000000 7eccf584 000141cc 76eea0cc 60000010 00000003 00000000 00000000
    
    Message from syslogd@unipi at Oct 11 14:15:54 ...
     kernel:[   72.047731] Code: bad PC value
    Segmentation fault
    

    I thought it could be a bad image or corrupted filesystem, so I removed the SD card, reflashed it with a brand new image of UniPian freshly downloaded from here: https://kb.unipi.technology/files:software:os-images:00-start

    Without even touching on anything, I just restarted the device, waited for a few minutes and repeat the simple cat command. Same error. I don't know if I have a faulty device or if the SYSFS driver is buggy. I don't have this problem with any other IO besides analog outputs on the second circuit (i.e. sudo cat /sys/devices/platform/unipi_plc/io_group2/ai_2_4/in_voltage0_raw works fine). Any hints?


  • administrators

    Hi @thiagoralves,

    It looks like there is either an issue with the driver or the hardware. The driver shouldn't be doing this certainly, ideally under any circumstances - though realistically we cannot always prevent it. I'll try it locally with our own M503 - as you have used the latest image you should have both the latest firmware and driver, so there is definitely something fishy going on there! I'll have time to look at it on Monday at the earliest, but at least I can definitely say that this functionality has been tested in the past, but there have been some changes relatively recently which could have broken it.

    One other thing you could do is try to run

    sudo /opt/unipi-bin/fwspi -i 1
    

    and paste the result here; it should show firmware details about the analog board. It might help us look at the test logs for the specific hardware unit and firmware version, to see if there's anything out of ordinary there. But I assume the issue will lie with a recent rewrite of the kernel driver.

    Thank you again for reporting the issue, and I hope this isn't too much of a setback. And one other thing related to the SYSFS - you should set the scanning frequency higher, since all SYSFS inputs run on various multiples of it. The low initial setting is to prevent the communication bus from getting unnecessarily overcrowded when using another IDE such as Mervis or CODESYS, which sidestep it by using the /dev/neuronspi character device directly.

    Edit: Another useful thing might be output from

    sudo dmesg
    

    at some point preceding the crash. This will show details about the kernel driver.



  • Hi Tomas,

    Here is my dmesg before and after touching ao_2_1.

    --edit-- apparently my post is too long for this forum, so I will have to split it up in three messages. Sorry!

    Before

    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 4.14.34-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1110 SMP Mon Apr 16 15:18:51 BST 2018
    [    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 Rev 1.2
    [    0.000000] Memory policy: Data cache writealloc
    [    0.000000] cma: Reserved 8 MiB at 0x3ac00000
    [    0.000000] On node 0 totalpages: 242688
    [    0.000000] free_area_init_node: node 0, pgdat 80c84e40, node_mem_map ba3a1000
    [    0.000000]   Normal zone: 2133 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 242688 pages, LIFO batch:31
    [    0.000000] random: fast init done
    [    0.000000] percpu: Embedded 17 pages/cpu @ba349000 s38720 r8192 d22720 u69632
    [    0.000000] pcpu-alloc: s38720 r8192 d22720 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: 8250.nr_uarts=0 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=PARTUUID=52bc33f2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
    [    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: 936296K/970752K available (7168K kernel code, 575K rwdata, 2072K rodata, 1024K init, 706K bss, 26264K 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 : 0x80008000 - 0x80800000   (8160 kB)
                         .init : 0x80b00000 - 0x80c00000   (1024 kB)
                         .data : 0x80c00000 - 0x80c8fd4c   ( 576 kB)
                          .bss : 0x80c96f4c - 0x80d478b4   ( 707 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    [    0.000000] ftrace: allocating 25231 entries in 74 pages
    [    0.000000] 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.000023] Switching to timer-based delay loop, resolution 52ns
    [    0.000274] Console: colour dummy device 80x30
    [    0.000819] console [tty1] enabled
    [    0.000856] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
    [    0.000895] pid_max: default: 32768 minimum: 301
    [    0.001221] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.001255] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.002212] Disabling memory control group subsystem
    [    0.002310] CPU: Testing write buffer coherency: ok
    [    0.002725] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [    0.003116] Setting up static identity map for 0x100000 - 0x10003c
    [    0.003251] Hierarchical SRCU implementation.
    [    0.003901] smp: Bringing up secondary CPUs ...
    [    0.004609] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    [    0.005366] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
    [    0.006104] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
    [    0.006208] smp: Brought up 1 node, 4 CPUs
    [    0.006279] SMP: Total of 4 processors activated (153.60 BogoMIPS).
    [    0.006300] CPU: All CPU(s) started in HYP mode.
    [    0.006318] CPU: Virtualization extensions available.
    [    0.007188] devtmpfs: initialized
    [    0.018104] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
    [    0.018356] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.018401] futex hash table entries: 1024 (order: 4, 65536 bytes)
    [    0.018977] pinctrl core: initialized pinctrl subsystem
    [    0.019732] NET: Registered protocol family 16
    [    0.022352] DMA: preallocated 1024 KiB pool for atomic coherent allocations
    [    0.027049] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
    [    0.027082] hw-breakpoint: maximum watchpoint size is 8 bytes.
    [    0.027302] Serial: AMBA PL011 UART driver
    [    0.028936] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
    [    0.029410] uart-pl011 3f201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
    [    0.060894] bcm2835-dma 3f007000.dma: DMA legacy API manager at bb813000, dmachans=0x1
    [    0.062328] SCSI subsystem initialized
    [    0.062564] usbcore: registered new interface driver usbfs
    [    0.062632] usbcore: registered new interface driver hub
    [    0.062731] usbcore: registered new device driver usb
    [    0.070069] raspberrypi-firmware soc:firmware: Attached to firmware from 2018-04-16 18:16
    [    0.071387] clocksource: Switched to clocksource arch_sys_counter
    [    0.148794] VFS: Disk quotas dquot_6.6.0
    [    0.148906] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [    0.149109] FS-Cache: Loaded
    [    0.149320] CacheFiles: Loaded
    [    0.158119] NET: Registered protocol family 2
    [    0.158860] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.158990] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    [    0.159193] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.159338] UDP hash table entries: 512 (order: 2, 16384 bytes)
    [    0.159399] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    [    0.159644] NET: Registered protocol family 1
    [    0.160103] RPC: Registered named UNIX socket transport module.
    [    0.160128] RPC: Registered udp transport module.
    [    0.160147] RPC: Registered tcp transport module.
    [    0.160166] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.160380] Trying to unpack rootfs image as initramfs...
    [    0.497099] Freeing initrd memory: 3936K
    [    0.502792] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
    [    0.505597] workingset: timestamp_bits=14 max_order=18 bucket_order=4
    [    0.513598] FS-Cache: Netfs 'nfs' registered for caching
    [    0.514206] NFS: Registering the id_resolver key type
    [    0.514253] Key type id_resolver registered
    [    0.514272] Key type id_legacy registered
    [    0.514301] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
    [    0.516149] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
    [    0.516295] io scheduler noop registered
    [    0.516317] io scheduler deadline registered (default)
    [    0.516605] io scheduler cfq registered
    [    0.516627] io scheduler mq-deadline registered
    [    0.516647] io scheduler kyber registered
    [    0.519489] BCM2708FB: allocated DMA memory fad10000
    [    0.519535] BCM2708FB: allocated DMA channel 0 @ bb813000
    [    0.528062] Console: switching to colour frame buffer device 82x26
    [    0.536532] bcm2835-rng 3f104000.rng: hwrng registered
    [    0.538989] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
    [    0.544128] vc-sm: Videocore shared memory driver
    [    0.546711] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
    [    0.560861] brd: module loaded
    [    0.571794] loop: module loaded
    [    0.574080] Loading iSCSI transport class v2.0-870.
    [    0.577024] libphy: Fixed MDIO Bus: probed
    [    0.579388] usbcore: registered new interface driver lan78xx
    [    0.581742] usbcore: registered new interface driver smsc95xx
    [    0.583906] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
    [    0.814153] Core Release: 2.80a
    [    0.816322] Setting default values for core params
    [    0.818560] Finished setting default values for core params
    [    1.021097] Using Buffer DMA mode
    [    1.023408] Periodic Transfer Interrupt Enhancement - disabled
    [    1.025784] Multiprocessor Interrupt Enhancement - disabled
    [    1.028214] OTG VER PARAM: 0, OTG VER FLAG: 0
    [    1.030599] Dedicated Tx FIFOs mode
    [    1.033254] WARN::dwc_otg_hcd_init:1046: FIQ DMA bounce buffers: virt = 0xbad04000 dma = 0xfad04000 len=9024
    [    1.037963] FIQ FSM acceleration enabled for :
                   Non-periodic Split Transactions
                   Periodic Split Transactions
                   High-Speed Isochronous Endpoints
                   Interrupt/Control Split Transaction hack enabled
    [    1.049032] dwc_otg: Microframe scheduler enabled
    [    1.049087] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x805e6a40
    [    1.051375] WARN::hcd_init_fiq:460: FIQ ASM at 0x805e6da8 length 36
    [    1.053644] WARN::hcd_init_fiq:486: MPHI regs_base at 0xbb87e000
    [    1.055922] dwc_otg 3f980000.usb: DWC OTG Controller
    [    1.058246] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
    [    1.060627] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
    [    1.062974] Init: Port Power? op_state=1
    [    1.065235] Init: Power Port (0)
    [    1.067625] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    1.069937] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    1.072267] usb usb1: Product: DWC OTG Controller
    [    1.074517] usb usb1: Manufacturer: Linux 4.14.34-v7+ dwc_otg_hcd
    [    1.076792] usb usb1: SerialNumber: 3f980000.usb
    [    1.079624] hub 1-0:1.0: USB hub found
    [    1.081855] hub 1-0:1.0: 1 port detected
    [    1.084440] dwc_otg: FIQ enabled
    [    1.084445] dwc_otg: NAK holdoff enabled
    [    1.084450] dwc_otg: FIQ split-transaction FSM enabled
    [    1.084459] Module dwc_common_port init
    [    1.084688] usbcore: registered new interface driver usb-storage
    [    1.086974] mousedev: PS/2 mouse device common for all mice
    [    1.089193] IR NEC protocol handler initialized
    [    1.091360] IR RC5(x/sz) protocol handler initialized
    [    1.093584] IR RC6 protocol handler initialized
    [    1.095761] IR JVC protocol handler initialized
    [    1.097839] IR Sony protocol handler initialized
    [    1.099923] IR SANYO protocol handler initialized
    [    1.102025] IR Sharp protocol handler initialized
    [    1.104021] IR MCE Keyboard/mouse protocol handler initialized
    [    1.106048] IR XMP protocol handler initialized
    [    1.108720] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
    [    1.111062] bcm2835-cpufreq: min=600000 max=1200000
    [    1.113596] sdhci: Secure Digital Host Controller Interface driver
    [    1.115726] sdhci: Copyright(c) Pierre Ossman
    [    1.118167] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe
    [    1.120637] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
    [    1.122956] sdhci-pltfm: SDHCI platform and OF driver helper
    [    1.126569] ledtrig-cpu: registered to indicate activity on CPUs
    [    1.128994] hidraw: raw HID events driver (C) Jiri Kosina
    [    1.131471] usbcore: registered new interface driver usbhid
    [    1.133778] usbhid: USB HID core driver
    [    1.136614] vchiq: vchiq_init_state: slot_zero = bad80000, is_master = 0
    [    1.140321] [vc_sm_connected_init]: start
    [    1.149779] [vc_sm_connected_init]: end - returning 0
    [    1.152653] Initializing XFRM netlink socket
    [    1.155034] NET: Registered protocol family 17
    [    1.157500] Key type dns_resolver registered
    [    1.160266] Registering SWP/SWPB emulation handler
    [    1.163371] registered taskstats version 1
    [    1.171647] uart-pl011 3f201000.serial: cts_event_workaround enabled
    [    1.174215] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
    [    1.180970] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
    [    1.183544] mmc-bcm2835 3f300000.mmc: DMA channel allocated
    [    1.242038] sdhost: log_buf @ bad07000 (fad07000)
    [    1.280710] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
    [    1.284701] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    1.288551] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    1.293557] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
    [    1.301490] Indeed it is in host mode hprt0 = 00021501
    [    1.321405] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
    [    1.362374] of_cfs_init
    [    1.364470] of_cfs_init: OK
    [    1.369708] Freeing unused kernel memory: 1024K
    [    1.388856] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.396486] mmc0: new high speed SDHC card at address b368
    [    1.399727] mmcblk0: mmc0:b368 SDU16 14.9 GiB
    [    1.403634]  mmcblk0: p1 p2
    [    1.428753] mmc1: new high speed SDIO card at address 0001
    [    1.521484] usb 1-1: new high-speed USB device number 2 using dwc_otg
    [    1.523775] Indeed it is in host mode hprt0 = 00001101
    [    1.761762] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
    [    1.764079] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.767102] hub 1-1:1.0: USB hub found
    [    1.769571] hub 1-1:1.0: 5 ports detected
    [    1.816259] rtc-ds1307 1-006f: registered as rtc0
    [    1.853824] at24 1-0057: 128 byte 24c01 EEPROM, writable, 1 bytes/write
    [    1.899674] i2c /dev entries driver
    [    2.091430] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
    [    2.197832] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    2.221821] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
    [    2.227133] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    2.234589] smsc95xx v1.0.6
    [    2.325136] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:bf:f5:2a
    [    2.891203] NET: Registered protocol family 10
    [    2.895334] Segment Routing with IPv6
    [    2.906940] ip_tables: (C) 2000-2006 Netfilter Core Team
    [    2.939852] 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)
    [    2.948768] systemd[1]: Detected architecture arm.
    [    2.953296] systemd[1]: Set hostname to <unipi>.
    [    2.960410] systemd[1]: Hardware watchdog 'Broadcom BCM2835 Watchdog timer', version 0
    [    2.960446] systemd[1]: Set hardware watchdog to 10s.
    [    3.342703] systemd[1]: [/etc/systemd/system/evok.service:9] Unknown lvalue 'StartLimitIntervalSec' in section 'Service'
    [    3.388229] systemd[1]: Listening on fsck to fsckd communication Socket.
    [    3.391927] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [    3.412053] systemd[1]: Listening on Syslog Socket.
    [    3.415855] systemd[1]: Created slice User and Session Slice.
    [    3.777925] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [    3.885148] systemd-journald[207]: Received request to flush runtime journal from PID 1
    [    4.452917] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
    [    4.460742] bcm2835_alsa bcm2835_alsa: card created with 8 channels
    [    4.595879] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
    [    4.609315] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
    [    4.609563] usbcore: registered new interface driver brcmfmac
    [    4.829735] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
    [    4.830625] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14
    [    4.889624] unipi: loading out-of-tree module taints kernel.
    [    4.889628] unipi: loading out-of-tree module taints kernel.
    [    4.892249] NEURONSPI: Neuronspi Probe Started
    [    4.895507] NEURONSPI: Probe did not detect a valid Neuron device on CS 3
    [    4.895959] NEURONSPI: Neuronspi Probe Started
    [    4.899222] NEURONSPI: Probe detected Neuron Board E_4Ai4Ao_U_6Di5Ro (L:f U:5 C:f) Index: 1 Fw: v5.18 on CS 2, Uart count: 1 - reg1000: 512, reg1001: 605, reg1002: 41, reg1003: f10, reg1004: b10
    [    4.899237] NEURONSPI: Neuron device E_4Ai4Ao_U_6Di5Ro on CS 2 uses SPI communication freq. 7500000 Hz
    [    4.910066] NEURONSPI: Added UART port 0
    [    4.916302] NEURONSPI: Neuronspi Probe Started
    [    4.918290] NEURONSPI: Probe detected Neuron Board B_1000 (L:0 U:0 C:0) Index: 0 Fw: v5.18 on CS 1, Uart count: 1 - reg1000: 512, reg1001: 404, reg1002: 311, reg1003: 10, reg1004: 10
    [    4.918302] NEURONSPI: Neuron device B_1000 on CS 1 uses SPI communication freq. 12000000 Hz
    [    4.918426] NEURONSPI: LED model B_1000 with 4 LEDs detected at CS: 1
    [    4.918442] NEURONSPI: Detected Neuron board combination corresponding to Neuron M503
    [    4.924209] NEURONSPI: Added UART port 1
    [    4.926066] NEURONSPI: SPI Driver Registered, Major Version: Development Beta Version 0.11:06:06:2018
    [    4.927369] NEURONSPI TTYInit
    [    5.765470] uart-pl011 3f201000.serial: no DMA platform data
    [    6.309841] EXT4-fs (mmcblk0p2): resizing filesystem from 442368 to 3897088 blocks
    [    6.365946] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [    6.365958] brcmfmac: power management disabled
    [    7.211363] random: crng init done
    [    7.972551] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
    [    9.631534] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    [   12.838396] Bluetooth: Core ver 2.22
    [   12.838475] NET: Registered protocol family 31
    [   12.838484] Bluetooth: HCI device and connection manager initialized
    [   12.838506] Bluetooth: HCI socket layer initialized
    [   12.838518] Bluetooth: L2CAP socket layer initialized
    [   12.838553] Bluetooth: SCO socket layer initialized
    [   13.688340] Bluetooth: HCI UART driver ver 2.3
    [   13.688355] Bluetooth: HCI UART protocol H4 registered
    [   13.688361] Bluetooth: HCI UART protocol Three-wire (H5) registered
    [   13.688589] Bluetooth: HCI UART protocol Broadcom registered
    [   18.863561] systemd[1]: apt-daily.timer: Adding 6h 56min 19.812726s random time.
    [   18.865315] systemd[1]: apt-daily-upgrade.timer: Adding 57min 19.609548s random time.
    [   19.114003] EXT4-fs (mmcblk0p2): resized to 1572864 blocks
    [   19.802250] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   19.802261] Bluetooth: BNEP filters: protocol multicast
    [   19.802284] Bluetooth: BNEP socket layer initialized
    [   19.863425] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
    [   43.322776] EXT4-fs (mmcblk0p2): resized to 3145728 blocks
    [   51.652015] EXT4-fs (mmcblk0p2): resized filesystem to 3897088
    [   60.959601] systemd[1]: apt-daily.timer: Adding 6h 35min 27.035347s random time.
    [   60.961564] systemd[1]: apt-daily-upgrade.timer: Adding 40min 52.921030s random time.
    [   62.394188] nf_conntrack version 0.5.0 (15360 buckets, 61440 max)
    


  • Continuing... here is dmesg after the crash

    After

    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 4.14.34-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1110 SMP Mon Apr 16 15:18:51 BST 2018
    [    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 Rev 1.2
    [    0.000000] Memory policy: Data cache writealloc
    [    0.000000] cma: Reserved 8 MiB at 0x3ac00000
    [    0.000000] On node 0 totalpages: 242688
    [    0.000000] free_area_init_node: node 0, pgdat 80c84e40, node_mem_map ba3a1000
    [    0.000000]   Normal zone: 2133 pages used for memmap
    [    0.000000]   Normal zone: 0 pages reserved
    [    0.000000]   Normal zone: 242688 pages, LIFO batch:31
    [    0.000000] random: fast init done
    [    0.000000] percpu: Embedded 17 pages/cpu @ba349000 s38720 r8192 d22720 u69632
    [    0.000000] pcpu-alloc: s38720 r8192 d22720 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: 8250.nr_uarts=0 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=PARTUUID=52bc33f2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
    [    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: 936296K/970752K available (7168K kernel code, 575K rwdata, 2072K rodata, 1024K init, 706K bss, 26264K 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 : 0x80008000 - 0x80800000   (8160 kB)
                         .init : 0x80b00000 - 0x80c00000   (1024 kB)
                         .data : 0x80c00000 - 0x80c8fd4c   ( 576 kB)
                          .bss : 0x80c96f4c - 0x80d478b4   ( 707 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    [    0.000000] ftrace: allocating 25231 entries in 74 pages
    [    0.000000] 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.000023] Switching to timer-based delay loop, resolution 52ns
    [    0.000274] Console: colour dummy device 80x30
    [    0.000819] console [tty1] enabled
    [    0.000856] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
    [    0.000895] pid_max: default: 32768 minimum: 301
    [    0.001221] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.001255] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.002212] Disabling memory control group subsystem
    [    0.002310] CPU: Testing write buffer coherency: ok
    [    0.002725] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [    0.003116] Setting up static identity map for 0x100000 - 0x10003c
    [    0.003251] Hierarchical SRCU implementation.
    [    0.003901] smp: Bringing up secondary CPUs ...
    [    0.004609] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    [    0.005366] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
    [    0.006104] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
    [    0.006208] smp: Brought up 1 node, 4 CPUs
    [    0.006279] SMP: Total of 4 processors activated (153.60 BogoMIPS).
    [    0.006300] CPU: All CPU(s) started in HYP mode.
    [    0.006318] CPU: Virtualization extensions available.
    [    0.007188] devtmpfs: initialized
    [    0.018104] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
    [    0.018356] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [    0.018401] futex hash table entries: 1024 (order: 4, 65536 bytes)
    [    0.018977] pinctrl core: initialized pinctrl subsystem
    [    0.019732] NET: Registered protocol family 16
    [    0.022352] DMA: preallocated 1024 KiB pool for atomic coherent allocations
    [    0.027049] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
    [    0.027082] hw-breakpoint: maximum watchpoint size is 8 bytes.
    [    0.027302] Serial: AMBA PL011 UART driver
    [    0.028936] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
    [    0.029410] uart-pl011 3f201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
    [    0.060894] bcm2835-dma 3f007000.dma: DMA legacy API manager at bb813000, dmachans=0x1
    [    0.062328] SCSI subsystem initialized
    [    0.062564] usbcore: registered new interface driver usbfs
    [    0.062632] usbcore: registered new interface driver hub
    [    0.062731] usbcore: registered new device driver usb
    [    0.070069] raspberrypi-firmware soc:firmware: Attached to firmware from 2018-04-16 18:16
    [    0.071387] clocksource: Switched to clocksource arch_sys_counter
    [    0.148794] VFS: Disk quotas dquot_6.6.0
    [    0.148906] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [    0.149109] FS-Cache: Loaded
    [    0.149320] CacheFiles: Loaded
    [    0.158119] NET: Registered protocol family 2
    [    0.158860] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.158990] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    [    0.159193] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.159338] UDP hash table entries: 512 (order: 2, 16384 bytes)
    [    0.159399] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    [    0.159644] NET: Registered protocol family 1
    [    0.160103] RPC: Registered named UNIX socket transport module.
    [    0.160128] RPC: Registered udp transport module.
    [    0.160147] RPC: Registered tcp transport module.
    [    0.160166] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.160380] Trying to unpack rootfs image as initramfs...
    [    0.497099] Freeing initrd memory: 3936K
    [    0.502792] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
    [    0.505597] workingset: timestamp_bits=14 max_order=18 bucket_order=4
    [    0.513598] FS-Cache: Netfs 'nfs' registered for caching
    [    0.514206] NFS: Registering the id_resolver key type
    [    0.514253] Key type id_resolver registered
    [    0.514272] Key type id_legacy registered
    [    0.514301] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
    [    0.516149] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
    [    0.516295] io scheduler noop registered
    [    0.516317] io scheduler deadline registered (default)
    [    0.516605] io scheduler cfq registered
    [    0.516627] io scheduler mq-deadline registered
    [    0.516647] io scheduler kyber registered
    [    0.519489] BCM2708FB: allocated DMA memory fad10000
    [    0.519535] BCM2708FB: allocated DMA channel 0 @ bb813000
    [    0.528062] Console: switching to colour frame buffer device 82x26
    [    0.536532] bcm2835-rng 3f104000.rng: hwrng registered
    [    0.538989] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
    [    0.544128] vc-sm: Videocore shared memory driver
    [    0.546711] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
    [    0.560861] brd: module loaded
    [    0.571794] loop: module loaded
    [    0.574080] Loading iSCSI transport class v2.0-870.
    [    0.577024] libphy: Fixed MDIO Bus: probed
    [    0.579388] usbcore: registered new interface driver lan78xx
    [    0.581742] usbcore: registered new interface driver smsc95xx
    [    0.583906] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
    [    0.814153] Core Release: 2.80a
    [    0.816322] Setting default values for core params
    [    0.818560] Finished setting default values for core params
    [    1.021097] Using Buffer DMA mode
    [    1.023408] Periodic Transfer Interrupt Enhancement - disabled
    [    1.025784] Multiprocessor Interrupt Enhancement - disabled
    [    1.028214] OTG VER PARAM: 0, OTG VER FLAG: 0
    [    1.030599] Dedicated Tx FIFOs mode
    [    1.033254] WARN::dwc_otg_hcd_init:1046: FIQ DMA bounce buffers: virt = 0xbad04000 dma = 0xfad04000 len=9024
    [    1.037963] FIQ FSM acceleration enabled for :
                   Non-periodic Split Transactions
                   Periodic Split Transactions
                   High-Speed Isochronous Endpoints
                   Interrupt/Control Split Transaction hack enabled
    [    1.049032] dwc_otg: Microframe scheduler enabled
    [    1.049087] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x805e6a40
    [    1.051375] WARN::hcd_init_fiq:460: FIQ ASM at 0x805e6da8 length 36
    [    1.053644] WARN::hcd_init_fiq:486: MPHI regs_base at 0xbb87e000
    [    1.055922] dwc_otg 3f980000.usb: DWC OTG Controller
    [    1.058246] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
    [    1.060627] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
    [    1.062974] Init: Port Power? op_state=1
    [    1.065235] Init: Power Port (0)
    [    1.067625] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    1.069937] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    1.072267] usb usb1: Product: DWC OTG Controller
    [    1.074517] usb usb1: Manufacturer: Linux 4.14.34-v7+ dwc_otg_hcd
    [    1.076792] usb usb1: SerialNumber: 3f980000.usb
    [    1.079624] hub 1-0:1.0: USB hub found
    [    1.081855] hub 1-0:1.0: 1 port detected
    [    1.084440] dwc_otg: FIQ enabled
    [    1.084445] dwc_otg: NAK holdoff enabled
    [    1.084450] dwc_otg: FIQ split-transaction FSM enabled
    [    1.084459] Module dwc_common_port init
    [    1.084688] usbcore: registered new interface driver usb-storage
    [    1.086974] mousedev: PS/2 mouse device common for all mice
    [    1.089193] IR NEC protocol handler initialized
    [    1.091360] IR RC5(x/sz) protocol handler initialized
    [    1.093584] IR RC6 protocol handler initialized
    [    1.095761] IR JVC protocol handler initialized
    [    1.097839] IR Sony protocol handler initialized
    [    1.099923] IR SANYO protocol handler initialized
    [    1.102025] IR Sharp protocol handler initialized
    [    1.104021] IR MCE Keyboard/mouse protocol handler initialized
    [    1.106048] IR XMP protocol handler initialized
    [    1.108720] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
    [    1.111062] bcm2835-cpufreq: min=600000 max=1200000
    [    1.113596] sdhci: Secure Digital Host Controller Interface driver
    [    1.115726] sdhci: Copyright(c) Pierre Ossman
    [    1.118167] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe
    [    1.120637] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
    [    1.122956] sdhci-pltfm: SDHCI platform and OF driver helper
    [    1.126569] ledtrig-cpu: registered to indicate activity on CPUs
    [    1.128994] hidraw: raw HID events driver (C) Jiri Kosina
    [    1.131471] usbcore: registered new interface driver usbhid
    [    1.133778] usbhid: USB HID core driver
    [    1.136614] vchiq: vchiq_init_state: slot_zero = bad80000, is_master = 0
    [    1.140321] [vc_sm_connected_init]: start
    [    1.149779] [vc_sm_connected_init]: end - returning 0
    [    1.152653] Initializing XFRM netlink socket
    [    1.155034] NET: Registered protocol family 17
    [    1.157500] Key type dns_resolver registered
    [    1.160266] Registering SWP/SWPB emulation handler
    [    1.163371] registered taskstats version 1
    [    1.171647] uart-pl011 3f201000.serial: cts_event_workaround enabled
    [    1.174215] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
    [    1.180970] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
    [    1.183544] mmc-bcm2835 3f300000.mmc: DMA channel allocated
    [    1.242038] sdhost: log_buf @ bad07000 (fad07000)
    [    1.280710] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
    [    1.284701] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    1.288551] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [    1.293557] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
    [    1.301490] Indeed it is in host mode hprt0 = 00021501
    [    1.321405] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
    [    1.362374] of_cfs_init
    [    1.364470] of_cfs_init: OK
    [    1.369708] Freeing unused kernel memory: 1024K
    [    1.388856] mmc0: host does not support reading read-only switch, assuming write-enable
    [    1.396486] mmc0: new high speed SDHC card at address b368
    [    1.399727] mmcblk0: mmc0:b368 SDU16 14.9 GiB
    [    1.403634]  mmcblk0: p1 p2
    [    1.428753] mmc1: new high speed SDIO card at address 0001
    [    1.521484] usb 1-1: new high-speed USB device number 2 using dwc_otg
    [    1.523775] Indeed it is in host mode hprt0 = 00001101
    [    1.761762] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
    [    1.764079] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    1.767102] hub 1-1:1.0: USB hub found
    [    1.769571] hub 1-1:1.0: 5 ports detected
    [    1.816259] rtc-ds1307 1-006f: registered as rtc0
    [    1.853824] at24 1-0057: 128 byte 24c01 EEPROM, writable, 1 bytes/write
    [    1.899674] i2c /dev entries driver
    [    2.091430] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
    [    2.197832] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    [    2.221821] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
    [    2.227133] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [    2.234589] smsc95xx v1.0.6
    [    2.325136] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:bf:f5:2a
    [    2.891203] NET: Registered protocol family 10
    [    2.895334] Segment Routing with IPv6
    [    2.906940] ip_tables: (C) 2000-2006 Netfilter Core Team
    [    2.939852] 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)
    [    2.948768] systemd[1]: Detected architecture arm.
    [    2.953296] systemd[1]: Set hostname to <unipi>.
    [    2.960410] systemd[1]: Hardware watchdog 'Broadcom BCM2835 Watchdog timer', version 0
    [    2.960446] systemd[1]: Set hardware watchdog to 10s.
    [    3.342703] systemd[1]: [/etc/systemd/system/evok.service:9] Unknown lvalue 'StartLimitIntervalSec' in section 'Service'
    [    3.388229] systemd[1]: Listening on fsck to fsckd communication Socket.
    [    3.391927] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
    [    3.412053] systemd[1]: Listening on Syslog Socket.
    [    3.415855] systemd[1]: Created slice User and Session Slice.
    [    3.777925] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [    3.885148] systemd-journald[207]: Received request to flush runtime journal from PID 1
    [    4.452917] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
    [    4.460742] bcm2835_alsa bcm2835_alsa: card created with 8 channels
    [    4.595879] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
    [    4.609315] brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001
    [    4.609563] usbcore: registered new interface driver brcmfmac
    [    4.829735] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
    [    4.830625] brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 7.11.15 Compiler: 1.24.2 ClmImport: 1.24.1 Creation: 2014-05-26 10:53:55 Inc Data: 9.10.39 Inc Compiler: 1.29.4 Inc ClmImport: 1.36.3 Creation: 2017-10-23 03:47:14
    [    4.889624] unipi: loading out-of-tree module taints kernel.
    [    4.889628] unipi: loading out-of-tree module taints kernel.
    [    4.892249] NEURONSPI: Neuronspi Probe Started
    [    4.895507] NEURONSPI: Probe did not detect a valid Neuron device on CS 3
    [    4.895959] NEURONSPI: Neuronspi Probe Started
    [    4.899222] NEURONSPI: Probe detected Neuron Board E_4Ai4Ao_U_6Di5Ro (L:f U:5 C:f) Index: 1 Fw: v5.18 on CS 2, Uart count: 1 - reg1000: 512, reg1001: 605, reg1002: 41, reg1003: f10, reg1004: b10
    [    4.899237] NEURONSPI: Neuron device E_4Ai4Ao_U_6Di5Ro on CS 2 uses SPI communication freq. 7500000 Hz
    [    4.910066] NEURONSPI: Added UART port 0
    [    4.916302] NEURONSPI: Neuronspi Probe Started
    [    4.918290] NEURONSPI: Probe detected Neuron Board B_1000 (L:0 U:0 C:0) Index: 0 Fw: v5.18 on CS 1, Uart count: 1 - reg1000: 512, reg1001: 404, reg1002: 311, reg1003: 10, reg1004: 10
    [    4.918302] NEURONSPI: Neuron device B_1000 on CS 1 uses SPI communication freq. 12000000 Hz
    [    4.918426] NEURONSPI: LED model B_1000 with 4 LEDs detected at CS: 1
    [    4.918442] NEURONSPI: Detected Neuron board combination corresponding to Neuron M503
    [    4.924209] NEURONSPI: Added UART port 1
    [    4.926066] NEURONSPI: SPI Driver Registered, Major Version: Development Beta Version 0.11:06:06:2018
    [    4.927369] NEURONSPI TTYInit
    [    5.765470] uart-pl011 3f201000.serial: no DMA platform data
    [    6.309841] EXT4-fs (mmcblk0p2): resizing filesystem from 442368 to 3897088 blocks
    [    6.365946] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [    6.365958] brcmfmac: power management disabled
    [    7.211363] random: crng init done
    [    7.972551] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
    [    9.631534] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    [   12.838396] Bluetooth: Core ver 2.22
    [   12.838475] NET: Registered protocol family 31
    [   12.838484] Bluetooth: HCI device and connection manager initialized
    [   12.838506] Bluetooth: HCI socket layer initialized
    [   12.838518] Bluetooth: L2CAP socket layer initialized
    [   12.838553] Bluetooth: SCO socket layer initialized
    [   13.688340] Bluetooth: HCI UART driver ver 2.3
    [   13.688355] Bluetooth: HCI UART protocol H4 registered
    [   13.688361] Bluetooth: HCI UART protocol Three-wire (H5) registered
    [   13.688589] Bluetooth: HCI UART protocol Broadcom registered
    [   18.863561] systemd[1]: apt-daily.timer: Adding 6h 56min 19.812726s random time.
    [   18.865315] systemd[1]: apt-daily-upgrade.timer: Adding 57min 19.609548s random time.
    [   19.114003] EXT4-fs (mmcblk0p2): resized to 1572864 blocks
    [   19.802250] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   19.802261] Bluetooth: BNEP filters: protocol multicast
    [   19.802284] Bluetooth: BNEP socket layer initialized
    [   19.863425] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
    [   43.322776] EXT4-fs (mmcblk0p2): resized to 3145728 blocks
    [   51.652015] EXT4-fs (mmcblk0p2): resized filesystem to 3897088
    [   60.959601] systemd[1]: apt-daily.timer: Adding 6h 35min 27.035347s random time.
    [   60.961564] systemd[1]: apt-daily-upgrade.timer: Adding 40min 52.921030s random time.
    [   62.394188] nf_conntrack version 0.5.0 (15360 buckets, 61440 max)
    [  249.928194] Unable to handle kernel NULL pointer dereference at virtual address 00000000
    [  249.932292] pgd = b93d0000
    [  249.934319] [00000000] *pgd=38b75835, *pte=00000000, *ppte=00000000
    [  249.936514] Internal error: Oops: 80000007 [#1] SMP ARM
    [  249.938698] Modules linked in: iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack cmac bnep hci_uart btbcm serdev bluetooth ecdh_generic unipi(O) industrialio spidev brcmfmac brcmutil cfg80211 rfkill snd_bcm2835(C) snd_pcm snd_timer snd spi_bcm2835 uio_pdrv_genirq uio fixed ip_tables x_tables ipv6 i2c_dev rtc_ds1307 at24 hwmon i2c_bcm2835
    [  249.950981] CPU: 1 PID: 1091 Comm: cat Tainted: G         C O    4.14.34-v7+ #1110
    [  249.956125] Hardware name: BCM2835
    [  249.958723] task: b8cfbc00 task.stack: b6dbe000
    [  249.961396] PC is at 0x0
    [  249.964074] LR is at iio_read_channel_info+0xa8/0xb0 [industrialio]
    [  249.966810] pc : [<00000000>]    lr : [<7f416858>]    psr: 60000013
    [  249.969569] sp : b6dbfdc8  ip : 00000000  fp : b6dbfe04
    [  249.972339] r10: b6dbfe68  r9 : b90c7e00  r8 : b928d818
    [  249.975080] r7 : b9dab000  r6 : 8083bd4c  r5 : b9dab000  r4 : b6dbfdd8
    [  249.977879] r3 : b6dbfddc  r2 : b6dbfdd8  r1 : 7f48b934  r0 : b928d800
    [  249.980601] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    [  249.983321] Control: 10c5383d  Table: 393d006a  DAC: 00000055
    [  249.986084] Process cat (pid: 1091, stack limit = 0xb6dbe210)
    [  249.988834] Stack: (0xb6dbfdc8 to 0xb6dc0000)
    [  249.991537] fdc0:                   00000000 00000001 00000001 00000002 014000c0 80276984
    [  249.996852] fde0: b6dbfe34 b6dbfdf0 80276984 b90c7500 b8bd24c0 8083bd4c b6dbfe1c b6dbfe08
    [  250.002114] fe00: 8053d6f8 7f4167bc b90c7500 00001000 b6dbfe44 b6dbfe20 80309218 8053d6d8
    [  250.007386] fe20: b90c7500 00000001 00000000 00000001 b881b540 b6dbff80 b6dbfe54 b6dbfe48
    [  250.012809] fe40: 80307a6c 8030918c b6dbfea4 b6dbfe58 802b15ec 80307a44 00000000 b90c7530
    [  250.018567] fe60: 76c92000 00020000 00000000 00000000 bab5bd68 00000000 b6dbfea4 00020000
    [  250.024554] fe80: b6dbff80 76c92000 b6dbff80 00020000 b90c7e00 00000000 b6dbfedc b6dbfea8
    [  250.030768] fea0: 80308884 802b1414 00000000 00100073 00000000 b881b540 b6dbff80 76c92000
    [  250.037291] fec0: b6dbff80 00020000 b6dbe000 00000000 b6dbff4c b6dbfee0 8028a624 8030875c
    [  250.043951] fee0: 76c91000 b6dbffb0 00001000 000001ff b6dbffac b6dbff00 801011e4 807a0468
    [  250.050798] ff00: b6dbff48 00000003 00022000 00000000 00000000 80242100 b6dbff74 8028a790
    [  250.057783] ff20: 80242100 8016cd34 00020000 b881b540 76c92000 b6dbff80 80108204 b6dbe000
    [  250.064012] ff40: b6dbff7c b6dbff50 8028a7b8 8028a5f8 00000022 802aadf8 b6dbff7c b881b540
    [  250.067522] ff60: b881b540 00020000 76c92000 80108204 b6dbffa4 b6dbff80 8028ad68 8028a728
    [  250.071040] ff80: 00000000 00000000 00020000 7fffe000 00020000 00000003 00000000 b6dbffa8
    [  250.074557] ffa0: 80108060 8028ad20 00020000 7fffe000 00000003 76c92000 00020000 00027184
    [  250.078074] ffc0: 00020000 7fffe000 00020000 00000003 00000003 00020000 ffffffff 00000000
    [  250.081582] ffe0: 00000000 7ec10594 000141cc 76f0f0cc 60000010 00000003 00000000 00000000
    [  250.085138] [<7f416858>] (iio_read_channel_info [industrialio]) from [<8053d6f8>] (dev_attr_show+0x2c/0x58)
    [  250.088690] [<8053d6f8>] (dev_attr_show) from [<80309218>] (sysfs_kf_seq_show+0x98/0x108)
    [  250.092226] [<80309218>] (sysfs_kf_seq_show) from [<80307a6c>] (kernfs_seq_show+0x34/0x38)
    [  250.095765] [<80307a6c>] (kernfs_seq_show) from [<802b15ec>] (seq_read+0x1e4/0x504)
    [  250.099294] [<802b15ec>] (seq_read) from [<80308884>] (kernfs_fop_read+0x134/0x1a4)
    [  250.102845] [<80308884>] (kernfs_fop_read) from [<8028a624>] (__vfs_read+0x38/0x130)
    [  250.106407] [<8028a624>] (__vfs_read) from [<8028a7b8>] (vfs_read+0x9c/0x168)
    [  250.108236] [<8028a7b8>] (vfs_read) from [<8028ad68>] (SyS_read+0x54/0xb0)
    [  250.110040] [<8028ad68>] (SyS_read) from [<80108060>] (ret_fast_syscall+0x0/0x28)
    [  250.113482] Code: bad PC value
    [  250.115194] ---[ end trace e9215518fd25ea5f ]---
    


  • And here is my fwspi report:

    pi@M503-sn22:/opt/neuron-bin $ sudo ./fwspi -i 1
    Boardset:    15 E-4Ai4Ao_U-6Di5Ro              (v1.0)
    Baseboard:   11 E-4Ai4Ao                       (v1.0)
    Firmware: v5.18
    

  • administrators

    Hi @thiagoralves!

    The software version you have (both for firmware and kernel) is relatively old. I cannot guarantee it will fix the issue, but you should be able to update it easily by running:

    sudo su
    mount -o rw,remount /
    echo "deb https://repo.unipi.technology/debian stretch main" >> /etc/apt/sources.list.d/unipi.list
    wget https://repo.unipi.technology/debian/unipi_pub.gpg -O - | apt-key add
    apt-get update
    sync
    reboot
    ----reboot occurs here----
    sudo su
    mount -o rw,remount /
    apt-get install neuron-kernel
    sync
    reboot
    ----second reboot occurs here----
    sudo su
    mount -o rw,remount /
    apt-get install unipi-modbus-tools
    apt-get install unipi-firmware
    sync
    reboot
    

    This should install the latest firmware, kernel and modbus server. Though unfortunately I really cannot say if that will fix the issue right at this very moment. I'll have a look into the code in the meanwhile, but please do see if the commands can fix the issue.

    I will check the image on our download server to see if I can get it updated. If you do encounter any errors in the installation process then please do post here; the packages are tuned for a standard raspbian image, and may possibly not work properly with the older image from our server.


  • administrators

    Hi @thiagoralves!

    I believe I have now identified the problem. Unfortunately the update above will likely not work (though it should not cause any harm either) - I will have to generate a new version of our kernel driver. This will take approximately 2 days; apologies for any difficulties caused.

    The issue is that the secondary analog output is missing a correct error code for reading, which the primary analog outputs do have. This causes a null pointer dereference and a subsequent crash. That said - the crash occurs because the IIO kernel subsystem does not check for a null pointer value where it is permitted, which it should, so it is possible that a general kernel update (which the commands above will try to perform) may help. However a definitive fix will be creating a dummy method to pass to the subsystem, which is something we should do regardless.

    Thank you for the debugging, and apologies for any problems caused. I should say that aside from reading the particular file there doesn't appear to be anything else wrong with the unit, and it should otherwise perform as expected.



  • Hi Tomas,

    Thank you for the replies. As you said, the procedure actually failed on my UniPian image with an error saying that the neuron-kernel depends on raspberrypi-kernel of a more recent version. In any case, I will try the steps on a clean Raspbian image and check how it behaves.

    In the mean time, are you guys planning to keep that UniPian image up to date? I'm asking this because I instructed OpenPLC users to download that image to install OpenPLC on their Neurons. If that image won't be getting updated regularly, I rather change the installation instructions to be based on a regular Raspbian image.

    Thanks!



  • I've tried the steps on a blank new Raspbian image and encountered the same error while trying to install neuron-kernel:

    root@raspberrypi:/home/pi# apt-get install neuron-kernel
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     neuron-kernel : Depends: raspberrypi-kernel (= 1.20180919-1) but 1.20180924-1 is to be installed
    E: Unable to correct problems, you have held broken packages.```

  • administrators

    Apologies, it looks like you will have to use

    apt-get install unipi-kernel-modules-dkms
    

    instead of

    apt-get install neuron-kernel
    

    this will install the module from source, rather than using a precompiled binary.

    The rest of the instructions should work fine. At any rate - we should release a new version tomorrow which should have the bug fixed.