tags:

views:

28

answers:

1

Hi! 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?

+1  A: 

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 http://www.rxtx.org library. 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 includes with RXTX should be clear otherwise.

kaliatech
Andrey Pesoshin
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
and what if i'm on ubuntu? :) the device is initialized in OS like /dev/ttyUSB0
Andrey Pesoshin
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