2014年4月4日 星期五

JNI 呼叫C, 由C控制 DHT11讀取溫濕度 (未完成版)

今天嘗試使用JNI 呼叫C, 由C控制 DHT11讀取溫濕度的值.
不過遇到一個奇怪的錯誤.


pi@raspberrypi ~/jni $ sudo java -Djava.library.path=. JavaDHT
DEBUG theStr--> Java_JavaDHT_readDHTfromC
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xa8cb239c, pid=2663, tid=3057022064
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) Client VM (23.21-b01 mixed mode linux-arm )
# Problematic frame:
# C  [libJavaDHT.so+0x239c]  bcm2835_peri_read+0x18
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/pi/jni/hs_err_pid2663.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

這裡有個日本人也有類似問題, 不過夜深了, 明天再來研究好了
http://broadbeans.blog.so-net.ne.jp/2013-08-27