1

Hoping to find solution here.

I have a controller which uses a App specific protocol over UART and this protocol works only at 14400 bps.

I have to use java code to communicate with this controller over serial port.

But i fount the API's i am using doesn't support 14400 baud rate although they call it standard!!.

I tried using javax.comm and rxtx jar's. No real hel as both of them doesn't support this baud rate.

Can any one please help me in this regard, It will be really Helpful.

Thanks!

Ok Here is the code snippet

        selectedPort = (SerialPort) portID.open("FlashProgramming",
                TIMEOUT);
        System.out.println("port " + selectedPort + " is opened");



    try {

        selectedPort.setSerialPortParams(14400,
                SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
                SerialPort.PARITY_NONE);

//Here trying to set the Baud rate to 14400, but it is rolling back to 9600, the default as 14400 is not supported!!

    }


    // no handshaking or other flow control
    try {
        selectedPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
    } catch (UnsupportedCommOperationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    // timer on any read of the serial port
    try {
        selectedPort.enableReceiveTimeout(TIMEOUT);
    } catch (UnsupportedCommOperationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    System.out.println("Comport Configeration is done");

    try {

        Serialdriver.in = selectedPort.getInputStream();
        Serialdriver.out = selectedPort.getOutputStream();

        System.out.println("i/p & o/p's are initialized");

        Serialdriver.handlerParamselScreen.displaystatus("Seleted Com port "
                + selectedPort + " is Successfully opened");
    }



        selectedPort.addEventListener(Serialdriver);



    selectedPort.notifyOnDataAvailable(true);


    return selectedPort;

}
Abhi4ever
  • 41
  • 7
  • No one is sure of the answer?? c'mon guys!! – Abhi4ever Jul 18 '13 at 09:14
  • your question is not clear enough. which API are you using??what is the exception you are getting? which IDE are you using? also post the code you wrote – Aditya Ponkshe Jul 24 '13 at 04:15
  • 1
    Its known problem on Linux: http://stackoverflow.com/questions/3192478/specifying-non-standard-baud-rate-for-ftdi-virtual-serial-port-under-linux – user2053898 Aug 24 '13 at 22:11
  • Have you found a solution? – Natalia Sep 26 '13 at 14:21
  • 1
    Yes, Changed the low level dll's from javax.comm to RXTX, Here is the link - [link](http://mfizz.com/oss/rxtx-for-java) and the best part it , Same code is supported on both x32 and x64 bit Os/java. Cheers! – Abhi4ever Sep 27 '13 at 06:58
  • Great thanks, you saved me so much time! Why don't you post an answer? – Natalia Oct 03 '13 at 11:47

1 Answers1

0

Well Here is the solution,

I replaced the low level dll's from javax.comm to rxtx.

Here is the link - rxtx latest driveres

And the best part is it supports both x32 and x64 jre's!. And porting the code from javax.comm to rxtx is just 5 min job.

I hope it is helpfull.

Cheers!

Abhi4ever
  • 41
  • 7