0

i'm trying to connect to CP2102 UART Bridge to send and receive data how can i implement that in java

C.e. Abdullah
  • 33
  • 1
  • 8

1 Answers1

2

In general you cannot (or should not) do that in Java - CP2102 is a USB-to-serial device and Java is not very good at talking to USB devices, at least not out-of-the-box, portably and without reliability issues.

Admittedly, a large part of that has to do with the difficulties of userspace USB drivers in general, but Java makes quite a few things even more difficult. In addition, you would have to write a Java driver for your bridge chip, which is generally not an easy task.

In your place I would just install the CP2102 drivers for my operating system and use the device as a normal serial port, e.g. with RXTX.

If you do insist of talking to the USB chip directly, you could prepare yourself for a long and tiring process and have a look at these:

Community
  • 1
  • 1
thkala
  • 84,049
  • 23
  • 157
  • 201
  • mmm what i'm trying to do exactly is to pass sequence of bytes to a pic with the CP2102 so do you think that i shouldn't do it with java directly ? – C.e. Abdullah Jan 13 '13 at 13:06
  • @C.e.Abdullah: no, install the driver for your OS and use it as a serial port - that should be more than sufficient – thkala Jan 13 '13 at 13:09