Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sireesha_B_Intel
Employee
1,762 Views

Not able to open tty device(MCU) in java.

Hi,

when I am trying to open ttydevice i.e Micro-controller on Intel-Edison board in java it was giving me the following exception.

javax.comm.NoSuchPortException

at javax.comm.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:105)

at TwoWaySerialComm.connect(TwoWaySerialComm.java:13)

at TwoWaySerialComm.main(TwoWaySerialComm.java:53)

I am working on a windows Laptop and I added all the necessary jars which are required for the communication API in java.

Could you please let me know if I am missing anything ?

Thanks in advance,

Sireesha.

0 Kudos
7 Replies
idata
Community Manager
72 Views

Hi Sireesha,

 

 

I would love to help you with that, can you give me more information about it?

 

 

Which code are you using?

 

 

Did you check the MCU API and its examples? Maybe you can find there something useful for you. https://software.intel.com/en-us/node/557354# Communicating_between_the_host_and_the_MCU

 

 

I will be waiting for your reply to help you more.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo
Sireesha_B_Intel
Employee
72 Views

Hi Sir,

Thanks for the reply.

I opened an ttymcu device through serial port and I was able to write data to the MCU(Led is blinking fine) in java .

So here the problem is while reading data it was giving me nothing i.e. Input Stream is empty. Below method is not getting called at all.

public synchronized void serialEvent(SerialPortEvent oEvent) {

if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {

try {

String inputLine=input.readLine();

} catch (Exception e) {

System.err.println(e.toString());

}

}

}

For reference I am following the below link.

http://playground.arduino.cc/Interfacing/Java Arduino Playground - Java

So if possible, could please let me know any thing I am missing here.

Thanks in advance,

Sireesha.

idata
Community Manager
72 Views

Hi Sireesha,

 

 

I don't understand that code, can you explain it to me a little more?

 

 

I'm not sure if it works for the ttymcu, did you check the link that I provided you? There is an example for communicating with the host using host-side C code.

 

 

Regards,

 

-Leonardo
Sireesha_B_Intel
Employee
72 Views

Hi Sir,

I went through that link what you have shared with me, it was in C language but I am working on java application so only I am following the Link what I shared with you.The code contains opening tty device through communication API in java and after that it was providing input and output streams for reading and writing data through streams.

I was able to write data to the tty device it but when I am trying to read input Stream was returning empty.

So if any thing that I am missing please let me know.

Thanks&Regards,

Sireesha.B

idata
Community Manager
72 Views

Hi Sireesha,

 

 

I know that code is in C, I provided it to you to use it as a reference.

 

 

About the code that you shared with me is very extensive. So, I recommend you to use the following library: http://fazecast.github.io/jSerialComm/, just remember that you have to use the port descriptor /dev/ttymcu0.

 

 

For more information about the library check this link: http://fazecast.github.io/jSerialComm/javadoc/index.html

 

 

I hope you find these links helpful.

 

 

Regards,

 

-Leonardo
Sireesha_B_Intel
Employee
72 Views

Hi Sir,

Thanks for the reply. Those links are very useful what you have shared with me and

I would like to use it in my application.

Thanks for the timely help.

Regards,

Sireesha.B

idata
Community Manager
72 Views

Hi Sireesha,

 

 

That's great. It is good to know that those links are useful.

 

 

Don't doubt to contact us if you have issues.

 

 

Regards,

 

-Leonardo
Reply