3 Replies Latest reply on Feb 24, 2016 9:50 AM by CMata_Intel

    Problem accessing ttyMFD1 in Java

    Ted_l

      Hello,

       

      I'm having the following problem and hoping to get some help here:

       

      I'm running a java program (Openhab,see www.openhab.org)  on Edison using weekly-159.devkit-2.0 image and java version "1.8.0_72". The openhab program can access USB serial port (e.g., /dev/ttyUSB0) just fine. However, it can not open /dev/ttyMDF1.

      I have tried the tricks here (How to enable PIN0/PIN1 for UART usage (TX/RX)) to open the UART port and can indeed write/receive data from ttyMDF1 from console. However, the Java program still can not open the port. Any suggestions?

        • 1. Re: Problem accessing ttyMFD1 in Java
          CMata_Intel

          Hi Ted,

           

          I would like to know which jdk version are you using and how are you installing it. I’m assuming you are compiling the code in the board with javac, is this right?

          I checked the Openhab.org website but I was unable to find the example you are using, could you post the direct link of the code? Or can you add it in a .txt file?

          Are you getting error messages? If you do please post them.

           

          Let us know as much information you can so we could replicate your environment.

           

          Regards,

          Charlie

          • 2. Re: Problem accessing ttyMFD1 in Java
            Ted_l

            Thanks! I downloaded jdf from Java.com (ver 1.8.0_72). The openhab program (runtime core) was downloaded from here: openHAB - Getting Started - Downloads

            I then installed the serial binding (like an addon) following the instruction here: https://github.com/openhab/openhab/wiki/Serial-Binding   In my particular case, I created an item file (test.items) in the /configurations/items folder; it has the following line:

             

            String Arduino "Arduino" { serial="/dev/ttyMFD1@115200" }

             

            The serial binding recognizes a usb-based serial device (/dev/ttyUSB0, which connects to an arduino nano) just fine, but can not use /dev/ttyMFD1. The error message is something like the following:

            "2016-02-23 13:48:54.570 [ERROR] [i.internal.GenericItemProvider] - Binding configuration of type 'serial' of item ?Arduino? could not be parsed correctly.

            org.openhab.model.item.binding.BindingConfigParseException: Could not open serial port /dev/ttyMFD1: Serial port '/dev/ttyMFD1' could not be found. Available ports are:"

             

            Thanks again and let me know if you need any other information!

             

             

            Edit: I think I may have figured out the problem. It appears that openhab requires explicit reference of "uncommon" serial port in the command line. Now the program can open the port.

            • 3. Re: Problem accessing ttyMFD1 in Java
              CMata_Intel

              Hi Ted,

               

              I'm glad to know that you have been able to use the port with Java on your board.

               

              Regards,

              Charlie