Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Problem using SPI with Kura on a Raspberry Pi
Problem using SPI with Kura on a Raspberry Pi [message #1608758] Mon, 09 February 2015 18:49 Go to next message
Franz Schnyder is currently offline Franz SchnyderFriend
Messages: 8
Registered: February 2015
Junior Member
Hi

I try to use SPI (jdk.dio.spibus.SPIDevice) with Kura on a raspberry pi like this:

SPIDeviceConfig config = new SPIDeviceConfig(0, 0,
	SPIDeviceConfig.CS_ACTIVE_LOW,
	8000000,
	3,  
	8,
	Device.BIG_ENDIAN);
SPIDevice spi = DeviceManager.open(SPIDevice.class, config);


But i always get an AccessControlException:

java.security.AccessControlException: access denied jdk.dio.spibus.SPIPermission '0:0' open
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:364)
	at java.security.AccessController.checkPermission(AccessController.java:555)
	at com.oracle.dio.spibus.impl.SPISlaveImpl.<init>(SPISlaveImpl.java:78)
	at com.oracle.dio.spibus.impl.SPIDeviceFactory.create(SPIDeviceFactory.java:46)
	at com.oracle.dio.spibus.impl.SPIDeviceFactory.create(SPIDeviceFactory.java:37)
	at jdk.dio.DeviceManager.openWithConfig(DeviceManager.java:290)
	at jdk.dio.DeviceManager.open(DeviceManager.java:610)
	at jdk.dio.DeviceManager.open(DeviceManager.java:560)
...


I checked the jdk.dio.policy inside the kura folder on my pi:

grant {
	permission jdk.dio.DeviceMgmtPermission "*:*", "open";

	permission jdk.dio.gpio.GPIOPinPermission "*:*", "open,setdirection";
	permission jdk.dio.gpio.GPIOPortPermission "*:*";
	permission jdk.dio.i2cbus.I2CPermission "*:*";
	permission jdk.dio.spi.SPIPermission "*:*";
	permission jdk.dio.uart.UARTPermission "*:*";
	permission jdk.dio.watchdog.WatchdogTimerPermission "*:*";
};


This should allow the usage of the SPI as far as I understood it.

Has anybody a already used SPI with Kura?
What do I need to change to get permission to access the SPI?

Thanks and regards
- Franz
Re: Problem using SPI with Kura on a Raspberry Pi [message #1610511 is a reply to message #1608758] Tue, 10 February 2015 21:13 Go to previous messageGo to next message
Franz Schnyder is currently offline Franz SchnyderFriend
Messages: 8
Registered: February 2015
Junior Member
Hi

I found the solution to my SPI problem. There is an error in the jdk.dio.policy shipped with Kura. The permission for SPI must be

permission jdk.dio.spibus.SPIPermission "*:*";


and not

permission jdk.dio.spi.SPIPermission "*:*";


as it is in the jdk.dio.policy shipped with Kura. So when I change the spi to spibus in the jdk.dio.policy on my raspberry pi, I can open and use the SPI device Smile .

I should have seen it right from the exception, but took me quite a while to figure it out.

Shall I enter a bug for this in the Kura Bugzilla?

Regards
- Franz


Re: Problem using SPI with Kura on a Raspberry Pi [message #1616378 is a reply to message #1610511] Sat, 14 February 2015 14:35 Go to previous message
Franz Schnyder is currently offline Franz SchnyderFriend
Messages: 8
Registered: February 2015
Junior Member
I created a bug for this (bugs.eclipse.org/bugs/show_bug.cgi?id=459830) and also a Pull Request to fix it (github.com/eclipse/kura/pull/30).

And the Pull Request already got merged Thumbs Up.
Previous Topic:Gpio pin already exist Exception
Next Topic:Error loading latest snapshot
Goto Forum:
  


Current Time: Sat Apr 27 01:10:05 GMT 2024

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

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

Back to the top