Giter VIP home page Giter VIP logo

bulldog's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bulldog's Issues

Cannot remove UART 'UARTX' from device tree;

Sorry for poor English

I'm using the libbulldog to control GPIO, such as LEDs and buzzer on Debian BeagleBone Black.
in a simple test using the blik LED when terminate the application, the following message is displayed:

Can not remove UART 'UART5' from device tree;
It will crash the bone

Can not remove UART 'UART4' from device tree;
It will crash the bone.

These two serial UART must be enabled to be controlled via serial rxtx lib

The libbulldog locks all enabled serial UART, even not using them?

ArrayIndexOutOfBoundsException on Beaglebone

With a beaglebone (white), an ArrayIndexOutOfBoundsException is throwed on the Board instanciation.

This is due to the difference with the BBB (no eMMC and no HDMI).

The following instructions returned -1 :

sysFs.getSlotNumber("BB-BONELT-HDMI") on line : https://github.com/Datenheld/Bulldog/blob/master/bulldog.board.beagleboneblack/src/main/java/org/bulldog/beagleboneblack/BeagleBoneBlack.java#L298
sysFs.getSlotNumber("BB-BONE-EMMC-2G") on line : https://github.com/Datenheld/Bulldog/blob/master/bulldog.board.beagleboneblack/src/main/java/org/bulldog/beagleboneblack/BeagleBoneBlack.java#L303

A quick fix by returning false when the index if -1 show that the rest of the code seems to run correctly on a beaglebone (white).
Is there any plan to support the first generation BeagleBone ?

Support for 4.X Kernels

This library doesn't work with 4.X kernels. I figured out that a small adjustment in the BBBSysFs.java fixes the problem. With the 4.X kenels the SYSFS_DEVICES_PATH must be set to "/sys/devices/platform".

I've also added those two lines at the beginning of the isSlotLoaded(int slotIndex) method to prevent an error if the HDMI cape isn't loaded:
if (slotIndex == -1)
return false;

Could you please implement this and set the SYSFS_DEVICES_PATH variable based on the kernel version?

Odroid U3

I would like to see support for the great family of Odroid devices, especially the Odroid U3. Is there a plan to support this device or will I have to implement U3-support by on own.
I got some Java experience but I'm not familiar with the details in using low level Linux APIs from Java.

Regards
David

SPI in Slave Mode

Would it be possible to add an example usage of the SPI in slave, rather than master mode?

My OS/Kernel are is:
Ubuntu 14.04.1 LTS (GNU/Linux 3.8.13-bone59 armv7l)
Linux arm 3.8.13-bone59 #1 SMP Sat Jul 5 02:59:43 UTC 2014 armv7l armv7l armv7l GNU/Linux

Wish List:

A complete example with SPI0 on the BBB acting as a master and SPI1 on the BBB acting as a slave (with wiring diagram for P9). Two java programs -on acitng as a client (slave) - the other one as a server (master) mode - showing the ability to pass text back and forth.

DigitalOutputTest error

I was testing DigitalOutputTest.

  1. Setup path:
    export LD_LIBRARY_PATH=/root/usr/lib/bulldoglib/libbulldog-linux:$LD_LIBRARY_PATH
    export CLASSPATH=$CLASSPATH:/root/usr/lib/bulldoglib/bulldog.beagleboneblack.hardfp.jar

  2. Run program:
    root@beaglebone:~/RemoteDigitalOutputTest/bin# java DigitalOutputTest

The result and error are in the following:=======
Digital output test!!!
Classpath=:/root/usr/lib/bulldoglib/bulldog.beagleboneblack.hardfp.jar
libarypath=/root/usr/lib/bulldoglib/libbulldog-linux::/usr/java/packages/lib/arm:/lib:/usr/lib
Exception in thread "main" java.lang.NoClassDefFoundError: org/bulldog/core/platform/Platform
at DigitalOutputTest.main(DigitalOutputTest.java:38)
Caused by: java.lang.ClassNotFoundException: org.bulldog.core.platform.Platform
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more

What is the problem? Thanks.
Eugene

BUG

  • listing properties --
    beagleboneblack.emmc.enabled=true
    beagleboneblack.hdmi.enabled=true
    beagleboneblack.dogtag=BeagleBoard.org Debian Image 2015-03-01

iolib_setdir: PortSet_ptr P9.13
iolib_setdir: PortSet_ptr P9.14
iolib_setdir: PortSet_ptr P9.15
iolib_setdir: PortSet_ptr P9.16
iolib_setdir: PortSet_ptr P8.7
iolib_setdir: PortSet_ptr P8.8
iolib_setdir: PortSet_ptr P8.9
iolib_setdir: PortSet_ptr P8.10
iolib_setdir: PortSet_ptr P8.11
iolib_setdir: PortSet_ptr P8.12
iolib_setdir: PortSet_ptr P8.13
iolib_setdir: PortSet_ptr P8.14
iolib_setdir: PortSet_ptr P8.15
iolib_setdir: PortSet_ptr P8.16
iolib_setdir: PortSet_ptr P8.17
iolib_setdir: PortSet_ptr P8.18
iolib_setdir: PortSet_ptr P8.19
iolib_setdir: PortSet_ptr P9.18
iolib_setdir: PortSet_ptr P9.21
iolib_setdir: PortSet_ptr P9.22
iolib_setdir: PortSet_ptr P9.23
iolib_setdir: PortSet_ptr P9.24

A fatal error has been detected by the Java Runtime Environment:

SIGSEGV (0xb) at pc=0xb420cfa2, pid=2154, tid=3057489008

JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)

Java VM: Java HotSpot(TM) Client VM (25.60-b23 mixed mode linux-arm )

Problematic frame:

C [libbulldog-linux.so+0x3fa2] iolib_setdir+0x8d

Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" befo

re starting Java again

An error report file with more information is saved as:

/tmp/hs_err_pid2154.log

If you would like to submit a bug report, please visit:

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

The crash happened outside the Java Virtual Machine in native code.

See problematic frame for where to report the bug.

Problems using SPI

After configuring spi on BBB rev. C (Debian Image Used) this exception is thrown from Bulldog lib

java.io.IOException: Bus '/dev/spidev0.0' could not be opened
2015-05-27 21:00:33,665 ERROR [stderr](default task-16) at org.bulldog.linux.io.AbstractLinuxBus.open(AbstractLinuxBus.java:72)
2015-05-27 21:00:33,678 ERROR [stderr](default task-16) at org.bulldog.core.io.bus.spi.SpiConnection.acquireBus(SpiConnection.java:40)
2015-05-27 21:00:33,690 ERROR [stderr](default task-16) at org.bulldog.core.io.bus.BusConnection.writeByte(BusConnection.java:26)

after searching in google I found this post same issue

https://groups.google.com/forum/#!msg/libbulldog/T4oM9KFoZcs/pXfWrbzXkw4J

Can you rename in org.bulldog.beagleboneblack.BeagleBoneBlack

This
private void createSpiBuses() {
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_0_CS0, "/dev/spidev0.0", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_0_CS1, "/dev/spidev0.1", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_1_CS0, "/dev/spidev1.0", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_1_CS1, "/dev/spidev1.1", this));
}

To
private void createSpiBuses() {
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_0_CS0, "/dev/spidev1.0", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_0_CS1, "/dev/spidev1.1", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_1_CS0, "/dev/spidev2.0", this));
getSpiBuses().add(new LinuxSpiBus(BBBNames.SPI_1_CS1, "/dev/spidev2.1", this));
}

Running Bulldog on Kernel 3.16 WITHOUT capemanager

Hello,
I am running BBB with kernel 3.16 which does not support capemanager anymore.
When I tried to run your samples I got the the following error:

java.lang.ArrayIndexOutOfBoundsException: 0
        at org.bulldog.beagleboneblack.sysfs.BBBSysFs.getCapeManager(BBBSysFs.java:23)
        at org.bulldog.beagleboneblack.sysfs.BBBSysFs.getCapeManagerSlots(BBBSysFs.java:27)
        at org.bulldog.beagleboneblack.sysfs.BBBSysFs.readSlots(BBBSysFs.java:51)
        at org.bulldog.beagleboneblack.sysfs.BBBSysFs.getSlotNumber(BBBSysFs.java:31)
        at org.bulldog.beagleboneblack.BeagleBoneBlack.isHdmiEnabled(BeagleBoneBlack.java:298)
        at org.bulldog.beagleboneblack.BeagleBoneBlack.createPins(BeagleBoneBlack.java:137)
        at org.bulldog.beagleboneblack.BeagleBoneBlack.<init>(BeagleBoneBlack.java:31)
        at org.bulldog.beagleboneblack.BeagleBoneBlackBoardFactory.createBoard(BeagleBoneBlackBoardFactory.java:17)
        at org.bulldog.core.platform.Platform.createBoard(Platform.java:13)
        at abfuelltest.AbfuellTest.main(AbfuellTest.java:25)

... so it looks like you are using the capemanager.

Is this correct? Is it possible to use Bulldog with neuer kernels?

Thank you,
Best regards,
Hannes

Serial Listener Leak

After using the serial listener for some time java kills the process because of memory leak. ()
package bbb;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import org.bulldog.beagleboneblack.BBBNames;
import org.bulldog.core.io.serial.SerialDataEventArgs;
import org.bulldog.core.io.serial.SerialDataListener;
import org.bulldog.core.io.serial.SerialPort;
import org.bulldog.core.platform.Board;
import org.bulldog.core.platform.Platform;
//import org.bulldog.core.util.BulldogUtil;

/**

  • @author Datenheld
    *
    */
    public class SerialExample {
    public static StringBuilder sb = new StringBuilder();
    public static void main(String... args) throws IOException {

    //Get your platform
    final Board board = Platform.createBoard();
    
    //Retrieve a serial port (UART2) and configure it
    SerialPort serial2 = board.getSerialPort(BBBNames.UART2);
    serial2.setBaudRate(9600);
    serial2.setBlocking(false);
    serial2.open();
    
    
    final String host = "192.168.17.44" ;// inner range device host ip adddress
    final int port = 7575;
    
    
    serial2.addListener(new SerialDataListener() {
    
        @Override
        public void onSerialDataAvailable(SerialDataEventArgs args) {
    
             //String hex_buff = args.getDataAsString();
           /* for (byte b : args.getData()) {
                sb.append(String.format("%02X ", b));
            }
           */
             for (byte b : args.getData()) {
                 sb.append(String.format("%02X ", b));
    
             }
             //sb.append(hex_buff);
             System.out.println("POLON MESSGE " + sb);
            if (sb.length() >= 7 ){
             System.out.println("char at " + sb.charAt(sb.length() - 1));
             System.out.println("char at " + sb.charAt(sb.length() - 2));
             System.out.println("char at " + sb.charAt(sb.length() - 3));
             System.out.println("char at " + sb.charAt(sb.length() - 4));
             System.out.println("char at " + sb.charAt(sb.length() - 5));
             System.out.println("char at " + sb.charAt(sb.length() - 6));
    
            }
             if(        (sb.length()>=7)
                 &&
                        (sb.charAt(sb.length() - 2) == 'A')
                 &&
                        (sb.charAt(sb.length() - 3) == '0')
                 &&
                        (sb.charAt(sb.length() - 4) == ' ')
                 &&
                        (sb.charAt(sb.length() - 5) == 'A')
                 &&
                        (sb.charAt(sb.length() - 6) == '0')
                 &&
                        (sb.charAt(sb.length() - 7) == ' '))
                 {
                        System.out.println("log ok");
    
                         System.out.println(" Time milis =====>>>>>"+System.currentTimeMillis() );      
    
                        SendOverTCPIP(sb.toString());
    
                        sb = new StringBuilder();
                 }
    
            // TO DO use delimiter 0A 0A  position last from sb-1 and last from sb 
            System.out.println(sb.toString());
            System.out.println(sb.length());
    
    
         //   System.out.println(args.getDataAsString());
        //  SendOverTCPIP(args.getDataAsString());
        }
    
        private void SendOverTCPIP(String dataAsString) 
        {
    
            Socket innerrangesocket = null;
    
            try{
                InetAddress inetAddressIR = InetAddress.getByName(host);
                innerrangesocket = new Socket(inetAddressIR, port);
                PrintWriter myprintwriter = new PrintWriter(innerrangesocket.getOutputStream(), true );
                String userinput = dataAsString;
    
                myprintwriter.println(userinput);
    
            } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
                if(innerrangesocket != null)
                    try {
                        innerrangesocket.close();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
    
            }
    
        }
    
    });;
    

    serial2.writeString("0331123491\r\n");
    //BulldogUtil.sleepMs(3000);
    try {
    Thread.sleep(3000);
    } catch (InterruptedException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    }
    serial2.writeString("00191\r\n");
    //serialPort.writeString("0331123491\r\n"); ARMARE
    // serialPort.writeString("040112348F\r\n"); DEZARMARE

         serial2.writeString("00191\r\n");
        try {
            Thread.sleep(8000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    
        //System.out.println("Sleep 500 Ms");
    
        //BulldogUtil.sleepMs(500);
    }
    
    //serial2.close();
    //serial1.close();
    

    }
    // public void main(String args){}do here
    }

setting baudrate UART beaglebone

Hi,
if I want to set the baudrate of my beaglebone black, I get the following error:
error setting baudrate - unknown speed: -1231931436
I want to set the baudrate at 100.000 bits/s.

Any solutions for this problem?

Regards,
Stein

NPE when one of two apps listening for GPIO interrupts is closed

I started two apps listening for interrupts of the same GPIO port
When one of them is closed - other prints exception

Exception in thread "Thread-14" java.lang.NullPointerException
at org.bulldog.linux.gpio.LinuxDigitalInput.getEdge(LinuxDigitalInput.java:115)
at org.bulldog.linux.gpio.LinuxDigitalInput.processEpollResults(LinuxDigitalInput.java:99)
at org.bulldog.linux.io.LinuxEpollThread.fireEpollEvent(LinuxEpollThread.java:88)
at org.bulldog.linux.io.LinuxEpollThread.run(LinuxEpollThread.java:57)
at java.lang.Thread.run(Thread.java:744)

I2CBusConnection needs an available() method

Currently, the I2CBusConnection allows reading and writing data. But I see no way to check if data is available before invoking the readByte() method.

I tried using the connection.getInputStream().available() method, but that always throws an IOException about an invalid seek.

If the slave device doesn't respond almost instantly, the readByte() method throws a timeout IOException.

(Otherwise -- you have a great library here! Thanks!)

Support for more UART speeds

Please add support for higher speeds, AM335x seems to support up to 3686400bps, although this looks like a custom max values.

147 #define B460800 0010004
148 #define B500000 0010005
149 #define B576000 0010006
150 #define B921600 0010007
151 #define B1000000 0010010
152 #define B1152000 0010011
153 #define B1500000 0010012
154 #define B2000000 0010013
155 #define B2500000 0010014
156 #define B3000000 0010015
157 #define B3500000 0010016
158 #define B4000000 0010017

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.