Can't connect to RS485 without being root
-
Hi guys,
I'm trying to read the data received from RS485 with a simple python script but I connect to the port. Here is the snippet
import serial ser = serial.Serial("/dev/extcomm/1/0", 19200, parity=serial.PARITY_NONE, stopbits=1, timeout=3) while True: c = ser.read(1) print c
And here is what it returns
Traceback (most recent call last): File "test.py", line 3, in <module> ser = serial.Serial("/dev/extcomm/1/0", 19200, parity=serial.PARITY_NONE, stopbits=1, timeout=3) File "/home/pi/test/venv/local/lib/python2.7/site-packages/serial/serialutil.py", line 240, in __init__ self.open() File "/home/pi/test/venv/local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg)) serial.serialutil.SerialException: [Errno 13] could not open port /dev/extcomm/1/0: [Errno 13] Permission denied: '/dev/extcomm/1/0'
I already tried to add the user pi to the group dialout but it still doesn't work! I must use sudo to access to my RS485 data.
How can I modify that?
Thank you very much
EDIT : I'm using Evok 1.0
-
EVOK 1.0 (or indeed any EVOK outside our images which have custom drivers) uses PTY software emulation running as root to implement the TTY interface to the RS485, which is why the permissions are required. You could try running the "neurontcp" or "neuron_tcp_server" service as some other user, but I cannot guarantee it will work.
You should not have the same issue with the latest opensource image, or with compiling the kernel module for your target platform yourself; though that may be difficult to do.
-
Hi Tomas,
Thank you for you answer! I tried to use your last image but it doesn't work. The RUN LED blinks with a period of 4 seconds and I can't find any additional serial port.
Also, the README file explains that the FileSystem should be mounted as "ReadOnly upon every boot" but it is ReadWrite... -
@flo
The ReadOnly section applies to the Mervis IDE images, which are different from the opensource ones. It must have gotten there by mistake - I'll arrange for my coworker to fix it. As for the blinking behavior - the image tries to flash your Neuron with latest firmware on first boot, which may take a few minutes.If you want to see more diagnostic messages you can use "sudo dmesg | grep neuronspi", which should mention the boards found and whether UART ports have been created.
Note that the UART ports are called /dev/ttyNS0..N, though they should be symlinked to /dev/extcomm as previously. I can talk with my coworkers who set it up and check if it happens.
-
It worked! Thanks for the explanations.
With these OpenSource Images is there a way to access to digital inputs and user LEDs directly in python without using Websocket or REST API?EDIT
It only works when the RS485 wires are not connected to UniPi at boot time. If I connect them after it works but when they are already connected the RUN LED blinks. Here are the diagnostic messages:pi@S103-sn407:~ $ sudo dmesg | grep -i neuronspi [ 3.909403] neuronspi: loading out-of-tree module taints kernel. [ 3.909409] neuronspi: loading out-of-tree module taints kernel. [ 3.911534] NEURONSPI: Neuronspi Probe Started [ 3.913243] NEURONSPI: Probe did not detect a valid Neuron device on CS 3 [ 3.913314] neuronspi: probe of spi0.3 failed with error -5 [ 3.913891] NEURONSPI: Neuronspi Probe Started [ 3.915809] NEURONSPI: Probe did not detect a valid Neuron device on CS 2 [ 3.915870] neuronspi: probe of spi0.2 failed with error -5 [ 3.916632] NEURONSPI: Neuronspi Probe Started [ 3.925392] Modules linked in: neuronspi(O+) spidev brcmfmac brcmutil cfg80211 rfkill i2c_bcm2835 spi_bcm2835 bcm2835_gpiomem uio_pdrv_genirq fixed uio i2c_dev ip_tables x_tables ipv6 [ 3.925443] PC is at neuronspi_spi_send_message+0x4a4/0x5bc [neuronspi] [ 3.925923] [<7f30d4a4>] (neuronspi_spi_send_message [neuronspi]) from [<7f30eda4>] (neuronspi_spi_probe+0x228/0xc80 [neuronspi]) [ 3.925959] [<7f30eda4>] (neuronspi_spi_probe [neuronspi]) from [<80544e6c>] (spi_drv_probe+0x8c/0xb8) [ 3.926097] [<80544d98>] (__spi_register_driver) from [<7f31805c>] (neuronspi_init+0x5c/0xa0 [neuronspi]) [ 3.926129] [<7f31805c>] (neuronspi_init [neuronspi]) from [<80101bf0>] (do_one_initcall+0x50/0x184)
EDIT2
A simple *sudo reboot" is not enough. To fix the situation I need to- Unplug the power supply
- Unplug RS485 wires
- Plug the power supply
- Wait for the end of boot time
- Plug RS485
So it seems that the issue is due to Neuron extension and not the raspberry pi
-
Could you post the entire "sudo dmesg" output? It looks like there might be something going wrong. It may be sizable.
-
Of course! Here is the entire dsmeg output
pi@unipi-stretch:~ $ sudo dmesg [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.9.41-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #1023 SMP Tue Aug 8 16:00:15 BST 2017 [ 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] cma: Reserved 8 MiB at 0x3d800000 [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] On node 0 totalpages: 253952 [ 0.000000] free_area_init_node: node 0, pgdat 80c6eec0, node_mem_map bcf3e000 [ 0.000000] Normal zone: 2232 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 253952 pages, LIFO batch:31 [ 0.000000] percpu: Embedded 14 pages/cpu @bcef6000 s25600 r8192 d23552 u57344 [ 0.000000] pcpu-alloc: s25600 r8192 d23552 u57344 alloc=14*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 251720 [ 0.000000] Kernel command line: 8250.nr_uarts=1 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=tty1 root=PARTUUID=39958d65-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: 985004K/1015808K available (7168K kernel code, 484K rwdata, 2012K rodata, 1024K init, 778K bss, 22612K reserved, 8192K cma-reserved) [ 0.000000] Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xbe800000 - 0xff800000 (1040 MB) lowmem : 0x80000000 - 0xbe000000 ( 992 MB) modules : 0x7f000000 - 0x80000000 ( 16 MB) .text : 0x80008000 - 0x80800000 (8160 kB) .init : 0x80b00000 - 0x80c00000 (1024 kB) .data : 0x80c00000 - 0x80c79094 ( 485 kB) .bss : 0x80c7b000 - 0x80d3da64 ( 779 kB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] Build-time adjustment of leaf fanout to 32. [ 0.000000] NR_IRQS:16 nr_irqs:16 16 [ 0.000000] arm_arch_timer: Architected 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.000299] Console: colour dummy device 80x30 [ 0.001185] console [tty1] enabled [ 0.001232] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000) [ 0.001300] pid_max: default: 32768 minimum: 301 [ 0.001632] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.001674] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.002562] Disabling cpuset control group subsystem [ 0.002720] CPU: Testing write buffer coherency: ok [ 0.002782] ftrace: allocating 22396 entries in 66 pages [ 0.049276] CPU0: update cpu_capacity 1024 [ 0.049327] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 [ 0.049387] Setting up static identity map for 0x100000 - 0x100034 [ 0.051252] CPU1: update cpu_capacity 1024 [ 0.051259] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001 [ 0.051942] CPU2: update cpu_capacity 1024 [ 0.051949] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002 [ 0.052615] CPU3: update cpu_capacity 1024 [ 0.052621] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003 [ 0.052708] Brought up 4 CPUs [ 0.052880] SMP: Total of 4 processors activated (153.60 BogoMIPS). [ 0.052910] CPU: All CPU(s) started in HYP mode. [ 0.052936] CPU: Virtualization extensions available. [ 0.053766] devtmpfs: initialized [ 0.065894] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4 [ 0.066224] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns [ 0.066286] futex hash table entries: 1024 (order: 4, 65536 bytes) [ 0.066847] pinctrl core: initialized pinctrl subsystem [ 0.067791] NET: Registered protocol family 16 [ 0.070037] DMA: preallocated 1024 KiB pool for atomic coherent allocations [ 0.078857] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [ 0.078927] hw-breakpoint: maximum watchpoint size is 8 bytes. [ 0.079118] Serial: AMBA PL011 UART driver [ 0.081007] bcm2835-mbox 3f00b880.mailbox: mailbox enabled [ 0.081560] uart-pl011 3f201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe [ 0.150192] bcm2835-dma 3f007000.dma: DMA legacy API manager at be80f000, dmachans=0x1 [ 0.152084] SCSI subsystem initialized [ 0.152270] usbcore: registered new interface driver usbfs [ 0.152374] usbcore: registered new interface driver hub [ 0.152490] usbcore: registered new device driver usb [ 0.159105] raspberrypi-firmware soc:firmware: Attached to firmware from 2017-08-08 12:01 [ 0.160501] clocksource: Switched to clocksource arch_sys_counter [ 0.207683] VFS: Disk quotas dquot_6.6.0 [ 0.207795] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 0.208022] FS-Cache: Loaded [ 0.208288] CacheFiles: Loaded [ 0.220437] NET: Registered protocol family 2 [ 0.221355] TCP established hash table entries: 8192 (order: 3, 32768 bytes) [ 0.221492] TCP bind hash table entries: 8192 (order: 4, 65536 bytes) [ 0.221703] TCP: Hash tables configured (established 8192 bind 8192) [ 0.221816] UDP hash table entries: 512 (order: 2, 16384 bytes) [ 0.221884] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) [ 0.222117] NET: Registered protocol family 1 [ 0.222558] RPC: Registered named UNIX socket transport module. [ 0.222591] RPC: Registered udp transport module. [ 0.222618] RPC: Registered tcp transport module. [ 0.222646] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.223585] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available [ 0.225929] workingset: timestamp_bits=14 max_order=18 bucket_order=4 [ 0.242033] FS-Cache: Netfs 'nfs' registered for caching [ 0.243046] NFS: Registering the id_resolver key type [ 0.243097] Key type id_resolver registered [ 0.243125] Key type id_legacy registered [ 0.245435] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251) [ 0.245580] io scheduler noop registered [ 0.245610] io scheduler deadline registered (default) [ 0.245899] io scheduler cfq registered [ 0.251691] BCM2708FB: allocated DMA memory fd910000 [ 0.251746] BCM2708FB: allocated DMA channel 0 @ be80f000 [ 0.260432] Console: switching to colour frame buffer device 82x26 [ 0.267876] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled [ 0.271754] bcm2835-rng 3f104000.rng: hwrng registered [ 0.274142] vc-cma: Videocore CMA driver [ 0.276408] vc-cma: vc_cma_base = 0x00000000 [ 0.278744] vc-cma: vc_cma_size = 0x00000000 (0 MiB) [ 0.281082] vc-cma: vc_cma_initial = 0x00000000 (0 MiB) [ 0.283497] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB) [ 0.302925] brd: module loaded [ 0.313873] loop: module loaded [ 0.315944] Loading iSCSI transport class v2.0-870. [ 0.318549] usbcore: registered new interface driver smsc95xx [ 0.320752] dwc_otg: version 3.00a 10-AUG-2012 (platform bus) [ 0.550950] Core Release: 2.80a [ 0.552988] Setting default values for core params [ 0.555077] Finished setting default values for core params [ 0.757574] Using Buffer DMA mode [ 0.759686] Periodic Transfer Interrupt Enhancement - disabled [ 0.761892] Multiprocessor Interrupt Enhancement - disabled [ 0.764142] OTG VER PARAM: 0, OTG VER FLAG: 0 [ 0.766346] Dedicated Tx FIFOs mode [ 0.768802] WARN::dwc_otg_hcd_init:1032: FIQ DMA bounce buffers: virt = 0xbd904000 dma = 0xfd904000 len=9024 [ 0.773268] FIQ FSM acceleration enabled for : Non-periodic Split Transactions Periodic Split Transactions High-Speed Isochronous Endpoints Interrupt/Control Split Transaction hack enabled [ 0.784630] dwc_otg: Microframe scheduler enabled [ 0.784680] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x8058f7fc [ 0.786987] WARN::hcd_init_fiq:460: FIQ ASM at 0x8058fb6c length 36 [ 0.789309] WARN::hcd_init_fiq:486: MPHI regs_base at 0xbe87a000 [ 0.791660] dwc_otg 3f980000.usb: DWC OTG Controller [ 0.793977] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1 [ 0.796338] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000 [ 0.798658] Init: Port Power? op_state=1 [ 0.800928] Init: Power Port (0) [ 0.803312] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 0.805621] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 0.807920] usb usb1: Product: DWC OTG Controller [ 0.810164] usb usb1: Manufacturer: Linux 4.9.41-v7+ dwc_otg_hcd [ 0.812455] usb usb1: SerialNumber: 3f980000.usb [ 0.815463] hub 1-0:1.0: USB hub found [ 0.817666] hub 1-0:1.0: 1 port detected [ 0.820334] dwc_otg: FIQ enabled [ 0.820339] dwc_otg: NAK holdoff enabled [ 0.820343] dwc_otg: FIQ split-transaction FSM enabled [ 0.820355] Module dwc_common_port init [ 0.820635] usbcore: registered new interface driver usb-storage [ 0.822965] mousedev: PS/2 mouse device common for all mice [ 0.826072] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer [ 0.828608] bcm2835-cpufreq: min=600000 max=1200000 [ 0.831270] sdhci: Secure Digital Host Controller Interface driver [ 0.833585] sdhci: Copyright(c) Pierre Ossman [ 0.836114] sdhost-bcm2835 3f202000.sdhost: could not get clk, deferring probe [ 0.840710] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe [ 0.843253] sdhci-pltfm: SDHCI platform and OF driver helper [ 0.848305] ledtrig-cpu: registered to indicate activity on CPUs [ 0.850968] hidraw: raw HID events driver (C) Jiri Kosina [ 0.853642] usbcore: registered new interface driver usbhid [ 0.856106] usbhid: USB HID core driver [ 0.859351] vchiq: vchiq_init_state: slot_zero = 0xbd980000, is_master = 0 [ 0.863630] Initializing XFRM netlink socket [ 0.866171] NET: Registered protocol family 17 [ 0.868765] Key type dns_resolver registered [ 0.871599] Registering SWP/SWPB emulation handler [ 0.874781] registered taskstats version 1 [ 0.877560] vc-sm: Videocore shared memory driver [ 0.880070] [vc_sm_connected_init]: start [ 0.883035] [vc_sm_connected_init]: end - returning 0 [ 0.890435] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2 [ 0.896976] sdhost: log_buf @ bd907000 (fd907000) [ 0.970526] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1) [ 0.975187] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0 [ 0.977625] mmc-bcm2835 3f300000.mmc: DMA channel allocated [ 1.030589] Indeed it is in host mode hprt0 = 00021501 [ 1.093040] of_cfs_init [ 1.095524] of_cfs_init: OK [ 1.098171] Waiting for root device PARTUUID=39958d65-02... [ 1.104430] mmc0: host does not support reading read-only switch, assuming write-enable [ 1.110897] mmc0: new high speed SDHC card at address 0007 [ 1.113909] mmcblk0: mmc0:0007 SD4GB 3.71 GiB [ 1.117971] mmcblk0: p1 p2 [ 1.119312] random: fast init done [ 1.125847] mmc1: queuing unknown CIS tuple 0x80 (2 bytes) [ 1.129671] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 1.133455] mmc1: queuing unknown CIS tuple 0x80 (3 bytes) [ 1.138383] mmc1: queuing unknown CIS tuple 0x80 (7 bytes) [ 1.225341] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null) [ 1.229577] VFS: Mounted root (ext4 filesystem) readonly on device 179:2. [ 1.230541] usb 1-1: new high-speed USB device number 2 using dwc_otg [ 1.230673] Indeed it is in host mode hprt0 = 00001101 [ 1.245892] devtmpfs: mounted [ 1.291548] mmc1: new high speed SDIO card at address 0001 [ 1.292448] Freeing unused kernel memory: 1024K (80b00000 - 80c00000) [ 1.460835] usb 1-1: New USB device found, idVendor=0424, idProduct=9514 [ 1.463286] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 1.466532] hub 1-1:1.0: USB hub found [ 1.468931] hub 1-1:1.0: 5 ports detected [ 1.744547] systemd[1]: System time before build time, advancing clock. [ 1.790548] usb 1-1.1: new high-speed USB device number 3 using dwc_otg [ 1.881040] NET: Registered protocol family 10 [ 1.895024] ip_tables: (C) 2000-2006 Netfilter Core Team [ 1.920947] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00 [ 1.923406] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 1.927841] systemd[1]: systemd 232 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN) [ 1.936367] smsc95xx v1.0.5 [ 1.936729] systemd[1]: Detected architecture arm. [ 1.950802] systemd[1]: Set hostname to <unipi-stretch>. [ 1.961041] systemd[1]: Hardware watchdog 'Broadcom BCM2835 Watchdog timer', version 0 [ 1.966154] systemd[1]: Set hardware watchdog to 10s. [ 2.036605] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:4e:be:ad [ 2.160581] usb 1-1.4: new high-speed USB device number 4 using dwc_otg [ 2.292253] usb 1-1.4: New USB device found, idVendor=090c, idProduct=1000 [ 2.295090] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2.297863] usb 1-1.4: Product: Flash Disk [ 2.300627] usb 1-1.4: Manufacturer: USB [ 2.303272] usb 1-1.4: SerialNumber: SCY0000000095946 [ 2.306849] usb-storage 1-1.4:1.0: USB Mass Storage device detected [ 2.310224] scsi host0: usb-storage 1-1.4:1.0 [ 2.473000] systemd[1]: Created slice System Slice. [ 2.479232] systemd[1]: Created slice system-systemd\x2dfsck.slice. [ 2.485439] systemd[1]: Created slice system-getty.slice. [ 2.491655] systemd[1]: Created slice User and Session Slice. [ 2.522415] systemd[1]: Mounting Debug File System... [ 2.646541] i2c /dev entries driver [ 2.992587] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 3.116599] systemd-journald[127]: Received request to flush runtime journal from PID 1 [ 3.503266] scsi 0:0:0:0: Direct-Access USB Flash Disk 1100 PQ: 0 ANSI: 4 [ 3.504660] sd 0:0:0:0: [sda] 15974400 512-byte logical blocks: (8.18 GB/7.62 GiB) [ 3.505306] sd 0:0:0:0: [sda] Write Protect is off [ 3.505321] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00 [ 3.505956] sd 0:0:0:0: [sda] No Caching mode page found [ 3.505966] sd 0:0:0:0: [sda] Assuming drive cache: write through [ 3.516786] sda: sda1 [ 3.519451] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000 [ 3.520398] sd 0:0:0:0: [sda] Attached SCSI removable disk [ 3.846108] usbcore: registered new interface driver brcmfmac [ 3.881783] neuronspi: loading out-of-tree module taints kernel. [ 3.883844] NEURONSPI: Neuronspi Probe Started [ 3.885450] NEURONSPI: Probe did not detect a valid Neuron device on CS 3 [ 3.885500] neuronspi: probe of spi0.3 failed with error -5 [ 3.885962] NEURONSPI: Neuronspi Probe Started [ 3.890800] NEURONSPI: Probe did not detect a valid Neuron device on CS 2 [ 3.890856] neuronspi: probe of spi0.2 failed with error -5 [ 3.891330] NEURONSPI: Neuronspi Probe Started [ 3.894063] Unable to handle kernel NULL pointer dereference at virtual address 00000070 [ 3.898542] pgd = bbffc000 [ 3.900768] [00000070] *pgd=00000000 [ 3.902859] Internal error: Oops: 5 [#1] SMP ARM [ 3.905117] Modules linked in: spidev(+) neuronspi(O+) brcmfmac brcmutil cfg80211 rfkill bcm2835_gpiomem i2c_bcm2835 spi_bcm2835 uio_pdrv_genirq uio fixed i2c_dev ip_tables x_tables ipv6 [ 3.912886] CPU: 2 PID: 179 Comm: systemd-udevd Tainted: G O 4.9.41-v7+ #1023 [ 3.917700] Hardware name: BCM2835 [ 3.920209] task: bbfc2c40 task.stack: bbd2a000 [ 3.922714] PC is at neuronspi_spi_send_message+0x4a4/0x5bc [neuronspi] [ 3.925382] LR is at 0x200 [ 3.928048] pc : [<7f2fb4a4>] lr : [<00000200>] psr: 60000013 sp : bbd2bb90 ip : b9d18640 fp : bbd2bc3c [ 3.933689] r10: bbcf0634 r9 : bbcf0634 r8 : ffffffd8 [ 3.936587] r7 : bbcf0600 r6 : 00000000 r5 : 0000f7b5 r4 : 7f2fe3d4 [ 3.939359] r3 : 00000041 r2 : b9d18640 r1 : b9d18640 r0 : bbd2bbd8 [ 3.942254] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 3.945137] Control: 10c5383d Table: 3bffc06a DAC: 00000055 [ 3.947959] Process systemd-udevd (pid: 179, stack limit = 0xbbd2a210) [ 3.950571] Stack: (0xbbd2bb90 to 0xbbd2c000) [ 3.953158] bb80: bcf17940 ffffffd8 00000016 b9d1867e [ 3.958603] bba0: bc16f03e b9d18646 bc16f006 00000016 b9d1861e bc16efde bc39a800 bc16f000 [ 3.964572] bbc0: 00000002 b9d18640 00000003 00000016 bbd2a000 f7b580c0 bbd2bbd8 bbd2bbd8 [ 3.964590] bbe0: bc39a800 00000000 805454b4 00000000 0000001c 0000001c 00000000 bbd2bbfc [ 3.964601] bc00: bbd2bbfc 00000000 bbd2bc08 bbd2bc08 00000000 00000000 80d047d0 b9d0f000 [ 3.964630] bc20: bc39a800 7f2fe878 00001612 00000001 bbd2bcb4 bbd2bc40 7f2fcda4 7f2fb00c [ 3.964649] bc40: 0007a120 00000019 00000001 b9c7c5f0 bbd2bc7c b9ef9f50 bcf316c0 00000000 [ 3.964676] bc60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 3.964694] bc80: 00000032 00000000 7f2ff08c bc39a800 00000000 7f2ff08c 7f2ff09c 00000015 [ 3.964705] bca0: 4626bc9c 00000000 bbd2bcd4 bbd2bcb8 80544e6c 7f2fcb88 80544de0 80d10558 [ 3.964715] bcc0: bc39a800 00000000 bbd2bcfc bbd2bcd8 804fb6a8 80544dec 00000000 bc39a800 [ 3.964725] bce0: 7f2ff09c bc39a834 00000000 00000001 bbd2bd1c bbd2bd00 804fb810 804fb494 [ 3.964736] bd00: 804fb754 00000000 7f2ff09c 804fb754 bbd2bd44 bbd2bd20 804f967c 804fb760 [ 3.964746] bd20: bca3145c bbdf7b34 bca31470 7f2ff09c b9d06400 80c5b3d8 bbd2bd54 bbd2bd48 [ 3.964756] bd40: 804fb028 804f960c bbd2bd7c bbd2bd58 804fabc0 804fb008 7f2feb50 bbd2bd68 [ 3.964766] bd60: 7f2ff09c 7f302000 b9d94440 7f2ff180 bbd2bd94 bbd2bd80 804fbf08 804faa18 [ 3.964777] bd80: 7f2ff380 7f302000 bbd2bda4 bbd2bd98 80544d98 804fbe8c bbd2bdbc bbd2bda8 [ 3.964788] bda0: 7f30205c 80544d3c 00000000 7f2ff180 bbd2be3c bbd2bdc0 80101bf0 7f30200c [ 3.964798] bdc0: 00000000 3c38b000 8022d0a0 b9ef8380 00001620 3c38b000 8024e9fc b9ef81c0 [ 3.964808] bde0: 00001620 8025e514 bbd2be3c bbd2bdf8 8025e514 80715cec 8025f8d4 8025ed78 [ 3.964819] be00: 00000001 00001620 b9d94480 a0000113 bf168000 7f2ff180 00000001 b9d94440 [ 3.964829] be20: 7f2ff180 00000001 4626bc9c b9d94388 bbd2be64 bbd2be40 80209f2c 80101bac [ 3.964839] be40: bbd2be64 bbd2be50 8024eaf0 bbd2bf3c 00000001 b9d94380 bbd2bf14 bbd2be68 [ 3.964849] be60: 801a3588 80209ec4 7f2ff18c 00007fff 7f2ff180 801a0c6c bbd2bea4 7f2ff36c [ 3.964860] be80: bf16e284 7f3040ec 7f2ff3cc 00000000 7f2ff294 7f2ff1c8 bbd2bee4 bbd2bea8 [ 3.964870] bea0: 80276d48 80276bc8 bf168000 00000000 00000000 00000000 00000000 00000000 [ 3.964879] bec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 3.964889] bee0: 00000000 00000000 7fffffff 00000000 00000007 76e60a18 0000017b 7fffffff [ 3.964899] bf00: 00000000 00000080 bbd2bfa4 bbd2bf18 801a3ea0 801a1bc8 7fffffff 00000000 [ 3.964909] bf20: 00000003 00000000 00000000 bf168000 0000a10a 00000000 db367000 bf168000 [ 3.964919] bf40: 0000a10a bf16e620 bf16e445 bf171300 000053cc 00005f8c 00000000 00000000 [ 3.964929] bf60: 00000000 000020ec 0000002b 0000002c 00000023 00000020 0000001c 00000000 [ 3.964939] bf80: 8010a560 db367000 01c3f6f0 00000000 80108244 bbd2a000 00000000 bbd2bfa8 [ 3.964949] bfa0: 80108220 801a3e10 db367000 01c3f6f0 00000007 76e60a18 00000000 76e6152c [ 3.964960] bfc0: db367000 01c3f6f0 00000000 0000017b 00020000 004c5110 00000000 01c43578 [ 3.964970] bfe0: 7eb1d8a8 7eb1d898 76e583d0 76d3d590 60000010 00000007 00000000 00000000 [ 3.965048] [<7f2fb4a4>] (neuronspi_spi_send_message [neuronspi]) from [<7f2fcda4>] (neuronspi_spi_probe+0x228/0xc80 [neuronspi]) [ 3.965085] [<7f2fcda4>] (neuronspi_spi_probe [neuronspi]) from [<80544e6c>] (spi_drv_probe+0x8c/0xb8) [ 3.965107] [<80544e6c>] (spi_drv_probe) from [<804fb6a8>] (driver_probe_device+0x220/0x2cc) [ 3.965125] [<804fb6a8>] (driver_probe_device) from [<804fb810>] (__driver_attach+0xbc/0xc0) [ 3.965139] [<804fb810>] (__driver_attach) from [<804f967c>] (bus_for_each_dev+0x7c/0xb0) [ 3.965154] [<804f967c>] (bus_for_each_dev) from [<804fb028>] (driver_attach+0x2c/0x30) [ 3.965169] [<804fb028>] (driver_attach) from [<804fabc0>] (bus_add_driver+0x1b4/0x22c) [ 3.965183] [<804fabc0>] (bus_add_driver) from [<804fbf08>] (driver_register+0x88/0x108) [ 3.965198] [<804fbf08>] (driver_register) from [<80544d98>] (__spi_register_driver+0x68/0x6c) [ 3.965226] [<80544d98>] (__spi_register_driver) from [<7f30205c>] (neuronspi_init+0x5c/0xa0 [neuronspi]) [ 3.965260] [<7f30205c>] (neuronspi_init [neuronspi]) from [<80101bf0>] (do_one_initcall+0x50/0x184) [ 3.965276] [<80101bf0>] (do_one_initcall) from [<80209f2c>] (do_init_module+0x74/0x1e4) [ 3.965294] [<80209f2c>] (do_init_module) from [<801a3588>] (load_module+0x19cc/0x2108) [ 3.965312] [<801a3588>] (load_module) from [<801a3ea0>] (SyS_finit_module+0x9c/0xac) [ 3.965328] [<801a3ea0>] (SyS_finit_module) from [<80108220>] (__sys_trace_return+0x0/0x10) [ 3.965339] Code: e51b2078 e5d23000 e3530041 1affffd8 (e5963070) [ 3.965450] ---[ end trace aa75ea3c72e3c9c9 ]--- [ 3.980837] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 3.986235] brcmfmac: Firmware version = wl0: Aug 7 2017 00:46:29 version 7.45.41.46 (r666254 CY) FWID 01-f8a78378 [ 5.120559] i2c-bcm2835 3f804000.i2c: i2c transfer timed out [ 5.128306] at24 1-0057: 128 byte 24c01 EEPROM, writable, 1 bytes/write [ 5.135702] rtc-ds1307 1-006f: rtc core: registered mcp7941x as rtc0 [ 5.137976] rtc-ds1307 1-006f: 64 bytes nvram [ 5.826128] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS [ 5.878474] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 5.879722] brcmfmac: power management disabled [ 5.971829] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 5.973432] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 7.399818] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 7.406583] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 [ 9.213167] random: crng init done```
-
If you try the latest beta image it should work somewhat better. You'll also have full SYSFS access to all the Neuron peripherals (IOs, watchdog, etc..)
It looks like there's an error when probing the Neuron if it has data in the UART buffer before the RPi has time to start; I believe this has been fixed a while ago in the drivers, but they haven't been updated on the main image for quite a long time.
-
It works fine with the last beta image! Thank you!
I'm also able to get digital input 1_01 state with the following command
sudo cat /sys/devices/platform/unipi_plc/io_group1/driver/di_1_01/di_value
Is there a way to turn on/off user LED with SYSFS too?
-
@flo
Glad to hear it works!You should be able to find the whole SYSFS tree symlinked to /run/unipi; which makes accessing it a bit easier.
As for the LEDs, they are available as /sys/class/leds/neuron:green:uled-x[1..N]. Specifically you want to write to the "brightness" file, 0 to turn it off, 1-255 to turn it on (there is no actual brightness support as the LED controller we are currently using doesn't support PWM)
The command is then:
echo "1" > "/run/unipi/io_group1/leds/neuron:green:uled-x1/brightness"
E: or just /run/unipi/io_group1/leds; in general SYSFS has both a device-class link and a device hierarchy link for everything.
-
Thanks for your help!
I have to execute the command in sudo for the LEDs, but it works fine! So, I will execute a chmod command after boot time.