在Java中使用wiringPiISR核心转储

时间:2015-10-04 00:38:41

标签: java gpio

我正在使用wiringPiISR获得核心转储 #

Java运行时环境检测到致命错误: #   内部错误(os_linux_zero.cpp:254),pid = 6552,tid = 1866855520   致命错误:抓住未处理的信号11

#  JRE版本:OpenJDK运行时环境(8.0_66-b01)(内部版本1.8.0_66-internal-b01)

Java VM:OpenJDK Zero VM(25.66-b01解释模式linux-arm)  无法编写核心转储。核心转储已被禁用。

要启用核心转储,请在再次启动Java之前尝试“ulimit -c unlimited” #  如果您想提交错误报告,请访问:

http://bugreport.java.com/bugreport/crash.jsp

我该如何解决这个问题?

我的代码是:

import com.na7kr.GPIOController.GPIOController;
import com.na7kr.Utils.Utils;
import com.na7kr.rpi_gpio_controller.Rpi_gpio_controllerApplicationUI;

import com.pi4j.wiringpi.Gpio;
import com.pi4j.wiringpi.GpioInterruptCallback;

public class Interrupt {
Rpi_gpio_controllerApplicationUI mApplication = new      Rpi_gpio_controllerApplicationUI(); // NO_UCD
                                                                                        // (use
                                                                                        // private)

// ***************************************
public synchronized void GetInput1(int trigerpin, int outputpin) throws InterruptedException {
    System.out.println("<--Pi4J--> GPIO interrupt test program");

    // setup wiringPi
    if (Gpio.wiringPiSetup() == -1) {
        System.out.println(" ==>> GPIO SETUP FAILED");
        return;
    }

    Gpio.pinMode(1, Gpio.INPUT);
    Gpio.pinMode(2, Gpio.INPUT);

    Gpio.pullUpDnControl(1, Gpio.PUD_UP);
    Gpio.pullUpDnControl(2, Gpio.PUD_UP);

    Gpio.wiringPiISR(1, Gpio.INT_EDGE_FALLING, new GpioInterruptCallback() {
        @Override
        public void callback(int pin) {
            System.out.println(" ==>> GPIO PIN " + pin + " - INTERRUPT DETECTED");
            Utils.Output_WriteDebug(true, "1");
            GPIOController.INSTANCE.mGPIOPins[outputpin].toggle();
            mApplication.refreshGPIOPinState();
            Utils.Output_WriteDebug(true, "2");
        }
    });
    Gpio.wiringPiISR(2, Gpio.INT_EDGE_FALLING, new GpioInterruptCallback() {
        @Override
        public void callback(int pin) {
            System.out.println(" ==>> GPIO PIN " + pin + " - INTERRUPT DETECTED");
            Utils.Output_WriteDebug(true, "3");
            GPIOController.INSTANCE.mGPIOPins[outputpin].toggle();
            mApplication.refreshGPIOPinState();
            Utils.Output_WriteDebug(true, "4");
        }
    });
}
}

我的代码中存在此问题,还是需要发送给Java?

---------------  T H R E A D  ---------------

Current thread (0x017210c0):  JavaThread "Thread-4" [_thread_in_vm, id=7296, stack(0x6ec61000,0x6f460000)]

Stack: [0x6ec61000,0x6f460000],  sp=0x6f45e708,  free space=8181k

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
=>0x017210c0 JavaThread "Thread-4" [_thread_in_vm, id=7296, stack(0x6ec61000,0x6f460000)]
  0x71cf8a88 JavaThread "http-bio-8080-exec-10" daemon [_thread_blocked, id=6582, stack(0x6fd60000,0x6fee0000)]
  0x63c19bd8 JavaThread "http-bio-8080-exec-9" daemon [_thread_in_native, id=6581, stack(0x6fee0000,0x70060000)]
  0x73407170 JavaThread "http-bio-8080-exec-8" daemon [_thread_in_native, id=6580, stack(0x70060000,0x701e0000)]
  0x74069a48 JavaThread "http-bio-8080-exec-7" daemon [_thread_in_native, id=6579, stack(0x701e0000,0x70360000)]
  0x73e3b720 JavaThread "http-bio-8080-exec-6" daemon [_thread_in_native, id=6578, stack(0x70460000,0x705e0000)]
  0x734058a0 JavaThread "http-bio-8080-exec-5" daemon [_thread_blocked, id=6577, stack(0x70818000,0x70998000)]
  0x734045a0 JavaThread "http-bio-8080-exec-4" daemon [_thread_in_native, id=6576, stack(0x70998000,0x70b18000)]
  0x734032a0 JavaThread "http-bio-8080-exec-3" daemon [_thread_in_native, id=6575, stack(0x70b18000,0x70c98000)]
  0x73402110 JavaThread "http-bio-8080-exec-2" daemon [_thread_in_native, id=6574, stack(0x70c98000,0x70e18000)]
  0x73400a98 JavaThread "http-bio-8080-exec-1" daemon [_thread_blocked, id=6573, stack(0x70e18000,0x70f98000)]
  0x72b80b20 JavaThread "http-bio-8080-AsyncTimeout" daemon [_thread_blocked, id=6572, stack(0x70f98000,0x71118000)]
  0x72b7fa90 JavaThread "http-bio-8080-Acceptor-0" daemon [_thread_in_native, id=6571, stack(0x71118000,0x71298000)]
  0x71f8a4a8 JavaThread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon [_thread_blocked, id=6570, stack(0x71298000,0x71418000)]
  0x71c373f0 JavaThread "GC Daemon" daemon [_thread_blocked, id=6567, stack(0x71a80000,0x71c00000)]
  0x72c3e9d8 JavaThread "Service Thread" daemon [_thread_blocked, id=6564, stack(0x720f7000,0x72277000)]
  0x72c3d058 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6563, stack(0x72277000,0x723f7000)]
  0x72c3bd30 JavaThread "Surrogate Locker Thread (Concurrent GC)" daemon [_thread_blocked, id=6562, stack(0x723f7000,0x72577000)]
  0x72c1fe58 JavaThread "Finalizer" daemon [_thread_blocked, id=6561, stack(0x72700000,0x72880000)]
  0x72c1ea18 JavaThread "Reference Handler" daemon [_thread_blocked, id=6560, stack(0x72880000,0x72a00000)]
  0x76505f78 JavaThread "main" [_thread_in_native, id=6553, stack(0x76660000,0x767df000)] 

1 个答案:

答案 0 :(得分:0)

我改为PI-J的1.1-SNAPSHOT,问题就消失了。