1

I want to develop a Java application to communicate with the device based on Xilinx Spartan 3E Starter Kit. The board is connected to my PC with USB-to-COM cable (COM is on the board).

What I need is to send some sequences of bytes to the device and than receive the response from it. It is the same way the serial terminals (hyperterminal, minicom, etc) do.

I'm kinda new to Java, so what classes do i need to implement this?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Andrey Pesoshin
  • 1,136
  • 1
  • 14
  • 30

1 Answers1

2

I'm not exactly sure what you mean by "USB-to-COM". Do you mean that the USB connection is accessible as an RS232 serial port on the PC (aka COM port on windows) ?

If so, you should look at the RXTX library here: http://rxtx.qbang.org . It provides support for Java serial port communications on a number of platforms. If you are new to Java, you might not find serial port programming the easiest way to learn Java, but the examples included with RXTX should be clear otherwise.

kaliatech
  • 17,579
  • 5
  • 72
  • 84
  • It is the next cable, or to be more exact adaptor: http://www.gmb.nl/default.aspx?ref=UAS111&op=products&op2=item&id=1326 – Andrey Pesoshin Oct 14 '10 at 18:53
  • Then yes, RXTX is what you want. The USB-Serial adapter's driver will create a virtual COM port (assuming you are on windows). You can use RXTX with Java to write and read from the virtual serial port that the USB driver creates. – kaliatech Oct 14 '10 at 18:59
  • and what if i'm on ubuntu? :) the device is initialized in OS like /dev/ttyUSB0 – Andrey Pesoshin Oct 14 '10 at 19:03
  • Same approach because your USB-Serial adapter includes a linux driver. Instead of the virtual serial port being named "COM0", it is named "/dev/ttyUSB0". RXTX is available for various linux flavors. (There might even be a prebuilt Ubuntu package for it.) – kaliatech Oct 14 '10 at 19:13