Project

General

Profile

Bug #7808

Unable to add device to pin 7

Added by Daniel Wisnewski IoT 1 Cloud 6 months ago. Updated 5 months ago.

Status:
Feedback
Priority:
Normal
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Adding a device using mobile client, the stanza appears to be formed correctly, however Pin 7 (pin 4 on BCM) seems to be unusable according to framework output.

Note GPIO pin 7 and Wiring Pi pin 7 are the same, possible conflict?

The following error occurs:

2018-07-02 18:11:05.668 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean c7eaf0d3-b5ef-42be-ab15-84fdcd1daea2 (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:05.788 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean c7eaf0d3-b5ef-42be-ab15-84fdcd1daea2 (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:05.902 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean c7eaf0d3-b5ef-42be-ab15-84fdcd1daea2 (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:06.117 [pool-4-thread-1]  Kernel.getInstance()                    SEVERE:   Exception getting instance
java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

        at com.pi4j.wiringpi.GpioUtil.export(Native Method)
        at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
        at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:566)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:539)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:640)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:668)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:662)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:685)
        at tigase.iot.framework.rpi.sensors.pir.HC_SR501.initializeInput(HC_SR501.java:128)
        at tigase.iot.framework.rpi.sensors.pir.HC_SR501.initialize(HC_SR501.java:123)
        at tigase.kernel.core.Kernel.initBean(Kernel.java:139)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:306)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:297)
        at tigase.iot.framework.runtime.DeviceManager.createDevice(DeviceManager.java:97)
        at tigase.iot.framework.runtime.adhoc.AddDeviceCommand.handle(AddDeviceCommand.java:107)
        at tigase.jaxmpp.core.client.xmpp.modules.adhoc.AdHocCommansModule.processSet(AdHocCommansModule.java:261)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:39)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:31)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule.process(AbstractStanzaModule.java:73)
        at tigase.jaxmpp.core.client.Processor$1.process(Processor.java:130)
        at tigase.jaxmpp.core.client.AbstractStanzaHandler.run(AbstractStanzaHandler.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2018-07-02 18:11:06.595 [pool-4-thread-1]  DeviceManager.createDevice()            WARNING:  failed creation of device tigase.iot.framework.rpi.sensors.pir.HC_SR501 with configuration <x type="submit" xmlns="jabber:x:data"><field type="text-single" label="WiringPi Pin number" var="pin"><value>7</value></field><field type="text-single" label="Time in miliseconds after which we should change state to inactive if there was no movement in this time" var="timeout"><value>30000</value></field><field type="text-single" label="Label" var="label"><value>HC-SR501</value></field><field type="hidden" var="type"><value>movement-sensor</value></field><field type="hidden" var="category"><value>movement-sensor</value></field><field type="hidden" var="deviceClass"><value>tigase.iot.framework.rpi.sensors.pir.HC_SR501</value></field></x>
2018-07-02 18:11:06.740 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean 5547e668-bd02-473b-8df9-4e6639f2ca4c (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:06.859 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean 5547e668-bd02-473b-8df9-4e6639f2ca4c (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:06.975 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean 5547e668-bd02-473b-8df9-4e6639f2ca4c (class: class tigase.iot.framework.rpi.sensors.pir.HC_SR501), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
=====================



2018-07-02 18:11:07.201 [pool-4-thread-1]  Kernel.getInstance()                    SEVERE:   Exception getting instance
java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

        at com.pi4j.wiringpi.GpioUtil.export(Native Method)
        at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
        at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:566)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:539)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:640)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:668)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:662)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalInputPin(GpioControllerImpl.java:685)
        at tigase.iot.framework.rpi.sensors.pir.HC_SR501.initializeInput(HC_SR501.java:128)
        at tigase.iot.framework.rpi.sensors.pir.HC_SR501.initialize(HC_SR501.java:123)
        at tigase.kernel.core.Kernel.initBean(Kernel.java:139)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:306)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:297)
        at tigase.iot.framework.runtime.DeviceManager.createDevice(DeviceManager.java:97)
        at tigase.iot.framework.runtime.adhoc.AddDeviceCommand.handle(AddDeviceCommand.java:107)
        at tigase.jaxmpp.core.client.xmpp.modules.adhoc.AdHocCommansModule.processSet(AdHocCommansModule.java:261)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:39)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:31)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule.process(AbstractStanzaModule.java:73)
        at tigase.jaxmpp.core.client.Processor$1.process(Processor.java:130)
        at tigase.jaxmpp.core.client.AbstractStanzaHandler.run(AbstractStanzaHandler.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
2018-07-02 18:11:07.628 [pool-4-thread-1]  DeviceManager.createDevice()            WARNING:  failed creation of device tigase.iot.framework.rpi.sensors.pir.HC_SR501 with configuration <x type="submit" xmlns="jabber:x:data"><field type="text-single" label="WiringPi Pin number" var="pin"><value>7</value></field><field type="text-single" label="Time in miliseconds after which we should change state to inactive if there was no movement in this time" var="timeout"><value>30000</value></field><field type="text-single" label="Label" var="label"><value>HC-SR501</value></field><field type="hidden" var="type"><value>movement-sensor</value></field><field type="hidden" var="category"><value>movement-sensor</value></field><field type="hidden" var="deviceClass"><value>tigase.iot.framework.rpi.sensors.pir.HC_SR501</value></field></x>


History

#1 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam 6 months ago

  • Status changed from New to Feedback
  • Assignee changed from Andrzej Wójcik to Daniel Wisnewski

Adding a device using mobile client, the stanza appears to be formed correctly, however Pin 7 (pin 4 on BCM) seems to be unusable according to framework output.

Note GPIO pin 7 and Wiring Pi pin 7 are the same, possible conflict?

BCM 4 is the same pin as WiringPi 7 and both are pointing to the same pin no. 7 on the main GPIO connector. So if you have 2 drivers which try to use the same pin and error like that may occur, but it should not make framework unusable. Also, it is impossible to connect 2 devices to the same pin, so this should not be an issue. (The only exception is for 1Wire or for I2C connectors).

#2 Updated by Daniel Wisnewski IoT 1 Cloud 5 months ago

  • Assignee changed from Daniel Wisnewski to Andrzej Wójcik

With this error, I did some testing today to see if any other pins had the same issue. I tried adding a device to each wiring pi number (1-29) and found that pins 7 and 8 provided the same error. I did the same with Pin switches and actual devices (where appropriate).

Pins 7 and 8 provide this error, that they are in use.

2018-07-07 00:57:54.773 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:


=====================
Could not initialize bean 06e27b98-73e3-47eb-ab3f-61958c73f601 (class: class tigase.iot.framework.rpi.sensors.PinSwitch), skipping injection of this bean
RootCause:
   -> com.pi4j.io.gpio.exception.GpioPinExistsException: This GPIO pin already exists: GPIO 8
      [com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:553)]
=====================



2018-07-07 00:57:55.095 [pool-4-thread-1]  Kernel.getInstance()                    SEVERE:   Exception getting instance
com.pi4j.io.gpio.exception.GpioPinExistsException: This GPIO pin already exists: GPIO 8
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:553)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:539)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:534)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:697)
        at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:707)
        at tigase.iot.framework.rpi.sensors.PinSwitch.initializeOutput(PinSwitch.java:127)
        at tigase.iot.framework.rpi.sensors.PinSwitch.initialize(PinSwitch.java:79)
        at tigase.kernel.core.Kernel.initBean(Kernel.java:139)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:306)
        at tigase.kernel.core.Kernel.getInstance(Kernel.java:297)
        at tigase.iot.framework.runtime.DeviceManager.createDevice(DeviceManager.java:97)
        at tigase.iot.framework.runtime.adhoc.AddDeviceCommand.handle(AddDeviceCommand.java:107)
        at tigase.jaxmpp.core.client.xmpp.modules.adhoc.AdHocCommansModule.processSet(AdHocCommansModule.java:261)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:39)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:31)
        at tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule.process(AbstractStanzaModule.java:73)
        at tigase.jaxmpp.core.client.Processor$1.process(Processor.java:130)
        at tigase.jaxmpp.core.client.AbstractStanzaHandler.run(AbstractStanzaHandler.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

However, while pin 7 I am unable to see the device on the client, Pin 8 I can AND I can operate the devices/receive data.

Also, adding devices to pin 24 they do not show on any client, yet they do seem to cause any errors. For example if I add a 2nd device to pin 24 I do get a similar issue:

2018-07-07 01:46:41.743 [pool-4-thread-1]  DeviceManager.createDevice()            WARNING:  failed creation of device tigase.iot.framework.rpi.sensors.PinSwitch with configuration <x xmlns="jabber:x:data" type="submit"><field label="WiringPi Pin number" var="pin" type="text-single"><value>24</value></field><field label="Enable with high state" var="enableWithHigh" type="boolean" advanced="true"><value>1</value></field><field label="Initial state" var="initialValue" type="boolean"><value>0</value></field><field label="Label" var="label" type="text-single"><value>Pin 24</value></field><field var="type" type="hidden"><value>switch</value></field><field var="category" type="hidden"><value>switch</value></field><field var="deviceClass" type="hidden"><value>tigase.iot.framework.rpi.sensors.PinSwitch</value></field></x>

This should be expected error for pins 7 and 8 if they had one in use. I've tried both wiping installed pins and also re-installing the device, but these errors continue. In each case, no devices were configured previously

All pin numbers mentioned in this update are wiring pi pin numbers.

#3 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam 5 months ago

%Daniel , %andrzej.wojcik I would leave problems like this for time after Beta is released. For now, we can provide a workaround like: if Pin7 does not work, connect to a different Pin.

Please note some pins may not work for many valid reasons. It all comes down to what is installed on RPi, what kind of tools and libraries, what is activated, kernel modules, even kernel version etc....

For example Pin 8, 9 (WiringPi) are for i2c, Pin 15, 16 are for UART, and so on.

We do not intent to solve every possible problem. We want to provide a system which can be used to solve some problems. Using a different pin is completely acceptable solution.

On the other hand, Daniel, when the Tigase soft is running, have you tried to access a device/sensor on Pin 7? Can you read it using Python code or something similar?

#4 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam 5 months ago

  • Assignee changed from Andrzej Wójcik to Daniel Wisnewski

Correct me if I'm wrong, but (all pins in Wiring PI numbering scheme):

  • Pin no. 7 - it is SDA.1, so it may be used (and most likely is used) by I2C interface if I2C drivers are loaded by the linux kernel
  • Pin no. 8 - it is 1-Wire, so it may be used (and most likely is used) by 1-Wire driver if it is loaded
  • Pin no. 24 - it is a general GPIO pin, so it should be free

Due to that, it may happen that you will not be able to use pin 7 & 8 if I2C and 1-Wire drivers are loaded and if I'm correct Pi4J tries to load them as we are using them by the framework. It may also happen that 1-Wire is the non-blocking driver and will allow you to add device (it allowed me to do so) and it worked fine.

As for errors, please correct me if I'm wrong but trying to add the device to pin 7, I'm getting the same error as for the second device at pin 24:

2018-07-14 09:09:47.680 [pool-4-thread-1]  Kernel.injectDependencies()             WARNING:  Could not initialize bean a740ec32-d068-4715-b95d-429d8701c664 (class: class tigase.iot.framework.rpi.sensors.PinSwitch), skipping injection of this bean
RootCause:
   -> java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

      [com.pi4j.wiringpi.GpioUtil.export(Native Method)]
2018-07-14 09:09:47.946 [pool-4-thread-1]  Kernel.getInstance()                    SEVERE:   Exception getting instance
java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory

    at com.pi4j.wiringpi.GpioUtil.export(Native Method)
    at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
    at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:566)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:539)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:534)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:697)
    at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:707)
    at tigase.iot.framework.rpi.sensors.PinSwitch.initializeOutput(PinSwitch.java:127)
    at tigase.iot.framework.rpi.sensors.PinSwitch.initialize(PinSwitch.java:79)
    at tigase.kernel.core.Kernel.initBean(Kernel.java:139)
    at tigase.kernel.core.Kernel.getInstance(Kernel.java:305)
    at tigase.kernel.core.Kernel.getInstance(Kernel.java:296)
    at tigase.iot.framework.runtime.DeviceManager.createDevice(DeviceManager.java:97)
    at tigase.iot.framework.runtime.adhoc.AddDeviceCommand.handle(AddDeviceCommand.java:107)
    at tigase.jaxmpp.core.client.xmpp.modules.adhoc.AdHocCommansModule.processSet(AdHocCommansModule.java:261)
    at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:39)
    at tigase.jaxmpp.core.client.xmpp.modules.AbstractIQModule.process(AbstractIQModule.java:31)
    at tigase.jaxmpp.core.client.xmpp.modules.AbstractStanzaModule.process(AbstractStanzaModule.java:73)
    at tigase.jaxmpp.core.client.Processor$1.process(Processor.java:130)
    at tigase.jaxmpp.core.client.AbstractStanzaHandler.run(AbstractStanzaHandler.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
2018-07-14 09:09:48.374 [pool-4-thread-1]  DeviceManager.createDevice()            WARNING:  failed creation of device tigase.iot.framework.rpi.sensors.PinSwitch with configuration <x type="submit" xmlns="jabber:x:data"><field type="text-single" label="WiringPi Pin number" var="pin"><value>7</value></field><field type="boolean" label="Enable with high state" advanced="true" var="enableWithHigh"><value>1</value></field><field type="boolean" label="Initial state" var="initialValue"><value>0</value></field><field type="text-single" label="Label" var="label"><value>Pin Switch</value></field><field type="hidden" var="type"><value>switch</value></field><field type="hidden" var="category"><value>switch</value></field><field type="hidden" var="deviceClass"><value>tigase.iot.framework.rpi.sensors.PinSwitch</value></field></x>

From my point of view, the framework works correctly. It allows you to use any pin but you need to know what you are doing and if you try do to something wrong it informs you about it and tries to recover. In some cases recovery may fail, we cannot expect the unexpected.

Also available in: Atom PDF