Skip to main content



      Home
Home » Eclipse Projects » Kura » LED not blinking on RPI3(gpio library)
LED not blinking on RPI3 [message #1782792] Thu, 01 March 2018 09:19 Go to next message
Eclipse UserFriend
Hello,

I am starting with Kura, and I wanted to turn on simple LEDs, I wrote this program in java and when I upload it to my PI it did't work.

Can anyone help me please.

protected void activate(ComponentContext componentContext) {

try {
KuraGPIOPin p = this.gpioService.getPinByTerminal(27, KuraGPIODirection.OUTPUT,
KuraGPIOMode.OUTPUT_OPEN_DRAIN, KuraGPIOTrigger.NONE);
p.open();
p.setValue(true);
System.out.println("=============LED is ON===================");

} catch (KuraGPIODeviceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KuraUnavailableDeviceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KuraClosedDeviceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Re: LED not blinking on RPI3 [message #1782793 is a reply to message #1782792] Thu, 01 March 2018 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
do you see any error in the log files?
The application is effectively running in the framework?
What is the status of the framework, accessing the OSGi console?

Best regards,
Matteo
Re: LED not blinking on RPI3 [message #1782797 is a reply to message #1782793] Thu, 01 March 2018 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Dear Matteo,

Thank you for your fast reply.

I didn't see any errors in the log, and I have attached a text file with the log ouput.
The state of the bundle is active.
I couldn't figure out the problem

Thank you for your helping
  • Attachment: log.txt
    (Size: 90.40KB, Downloaded 221 times)
Re: LED not blinking on RPI3 [message #1782800 is a reply to message #1782797] Thu, 01 March 2018 10:34 Go to previous messageGo to next message
Eclipse UserFriend
I'm sorry, but the first thing I see from your log is an exception:
!MESSAGE [SCR] Exception while activating instance org.eclipse.kura.blink.Blink@6446d5 of component org.eclipse.kura.blink.Blink  
!STACK 0
java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:235)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
	at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
	at org.eclipse.equinox.internal.ds.ServiceReg.getService(ServiceReg.java:53)
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210)
	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111)
	at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:496)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:619)
	at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:39)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
	at org.eclipse.equinox.internal.ds.InstanceProcess.registerService(InstanceProcess.java:536)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:260)
	at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
	at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
	at org.eclipse.equinox.metatype.impl.Activator$SAXParserFactoryTrackerCustomizer.registerMetaTypeService(Activator.java:229)
	at org.eclipse.equinox.metatype.impl.Activator$SAXParserFactoryTrackerCustomizer.swapFactories(Activator.java:143)
	at org.eclipse.equinox.metatype.impl.Activator$SAXParserFactoryTrackerCustomizer.addingService(Activator.java:137)
	at org.eclipse.equinox.metatype.impl.Activator$SAXParserFactoryTrackerCustomizer.addingService(Activator.java:1)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
	at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
	at org.eclipse.equinox.metatype.impl.Activator.start(Activator.java:69)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
	at org.eclipse.osgi.container.Module.doStart(Module.java:581)
	at org.eclipse.osgi.container.Module.start(Module.java:449)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1620)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1600)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1571)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1514)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NullPointerException
	at org.eclipse.kura.blink.Blink.activate(Blink.java:52)
	... 71 more


It seems that your bundle throws a NullPointerException.

Best regards,
Matteo
Re: LED not blinking on RPI3 [message #1782801 is a reply to message #1782800] Thu, 01 March 2018 10:55 Go to previous messageGo to next message
Eclipse UserFriend
any suggestions what can cause that or how to solve it ?
Re: LED not blinking on RPI3 [message #1782803 is a reply to message #1782801] Thu, 01 March 2018 11:05 Go to previous messageGo to next message
Eclipse UserFriend
No idea what corresponds to your line 52.
I would suggest to have a look and start protecting against null pointers.

Best regards,
Matteo
Re: LED not blinking on RPI3 [message #1782805 is a reply to message #1782803] Thu, 01 March 2018 11:27 Go to previous messageGo to next message
Eclipse UserFriend
Dea Matteo,

Thank you very much for your fast replies

The line 53 :

KuraGPIOPin p = this.gpioService.getPinByTerminal(27, KuraGPIODirection.OUTPUT, KuraGPIOMode.OUTPUT_OPEN_DRAIN, KuraGPIOTrigger.NONE);

it looks fine for me;
can you help me please
Re: LED not blinking on RPI3 [message #1782806 is a reply to message #1782805] Thu, 01 March 2018 11:35 Go to previous message
Eclipse UserFriend
I believe that the exception is thrown because this.gpioService is null.
Please give it a check and verify that you are correctly getting the gpioService.

Best regards,
Matteo
Previous Topic:how to resolve jdk.dio-CloseDeviceException
Next Topic:How to get advertisement data via new "BluetoothLeAdapter"
Goto Forum:
  


Current Time: Wed Jul 30 18:48:51 EDT 2025

Powered by FUDForum. Page generated in 0.03319 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top