From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From Kustaa.Nyholm at planmeca.com Mon Mar 15 03:36:22 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 15 Mar 2010 11:36:22 +0200 Subject: [Rxtx] Virtual serial port (USB CDC ACM) timeout not working...cross posted In-Reply-To: <1080422816.3127.6.camel@localhost.localdomain> Message-ID: Hi, cross posting this as I'm not sure where to turn to for the answer. I've implemented a USB CDC ACM device which appears modem in Mac OS X (and Linux and Windows, but so far I'm concentrating on Mac OS X), in '/dev/tty.usbmodemxxx' . I open the modem, enable the timeouts and with FTDI serial port dongle, reads timeout if there is not (enough) data. However with my own device (a PIC18F4550 with my own USB CDC ACM firmware) reads block until the requested amount of bytes have been read. So this is probably my firmware. I guess this hangs (pun intended) around the fact that my firmware does not setup data and turn the IN endpoint over to the SIE unless the device has something to send. I'm not sure if the SIE responds with ACK or NACK to the host in this situation, and I'm not sure how this should be handled on the device side to get the host driver to return a timeout to the calling application. So any thought are appreciated. br Kusti From nandors125 at gmail.com Mon Mar 15 06:22:14 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Mon, 15 Mar 2010 12:22:14 +0000 Subject: [Rxtx] Problem librxtxSerial.so Mipsel Message-ID: <6b0f5ade1003150522qc42ee3ar190d61db62ffd76@mail.gmail.com> Hi. I need to use the librxtxSerial.so in my Mipsel router. But it seems there is a problem with the file in Toybox because I can't open it. My router: uname -a Linux OpenWrt 2.6.26.8 #2 Sat Mar 6 18:21:48 WET 2010 mips unknown I downloaded the file on Toybox: http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/mipsel-unknown-linux-gnu/librxtxSerial.so And when I run on my PC: file librxtxSerial.so librxtxSerial.so: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, not stripped That seems to be correct. What libraries are needed to get this working?? I can't open the library on my router. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From Kustaa.Nyholm at planmeca.com Mon Mar 15 03:36:22 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 15 Mar 2010 11:36:22 +0200 Subject: [Rxtx] Virtual serial port (USB CDC ACM) timeout not working...cross posted In-Reply-To: <1080422816.3127.6.camel@localhost.localdomain> Message-ID: Hi, cross posting this as I'm not sure where to turn to for the answer. I've implemented a USB CDC ACM device which appears modem in Mac OS X (and Linux and Windows, but so far I'm concentrating on Mac OS X), in '/dev/tty.usbmodemxxx' . I open the modem, enable the timeouts and with FTDI serial port dongle, reads timeout if there is not (enough) data. However with my own device (a PIC18F4550 with my own USB CDC ACM firmware) reads block until the requested amount of bytes have been read. So this is probably my firmware. I guess this hangs (pun intended) around the fact that my firmware does not setup data and turn the IN endpoint over to the SIE unless the device has something to send. I'm not sure if the SIE responds with ACK or NACK to the host in this situation, and I'm not sure how this should be handled on the device side to get the host driver to return a timeout to the calling application. So any thought are appreciated. br Kusti From nandors125 at gmail.com Mon Mar 15 06:22:14 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Mon, 15 Mar 2010 12:22:14 +0000 Subject: [Rxtx] Problem librxtxSerial.so Mipsel Message-ID: <6b0f5ade1003150522qc42ee3ar190d61db62ffd76@mail.gmail.com> Hi. I need to use the librxtxSerial.so in my Mipsel router. But it seems there is a problem with the file in Toybox because I can't open it. My router: uname -a Linux OpenWrt 2.6.26.8 #2 Sat Mar 6 18:21:48 WET 2010 mips unknown I downloaded the file on Toybox: http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/mipsel-unknown-linux-gnu/librxtxSerial.so And when I run on my PC: file librxtxSerial.so librxtxSerial.so: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, not stripped That seems to be correct. What libraries are needed to get this working?? I can't open the library on my router. -------------- next part -------------- An HTML attachment was scrubbed... URL: From george.dma at gmail.com Mon Mar 15 08:32:45 2010 From: george.dma at gmail.com (George H) Date: Mon, 15 Mar 2010 16:32:45 +0200 Subject: [Rxtx] Ring detection on modem is not working Message-ID: Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com From andy at crowbird.com Fri Mar 12 10:26:42 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:26:42 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: <6ece9bcc1003120926r3fceda8ag45ac6e0a15a57c3b@mail.gmail.com> http://rxtx.qbang.org/wiki/index.php/FAQ#On_MacOS_X_I_get_a_.27PortInUseException.27.2C_even_though_it_isn.27t.3F On MacOS X I get a 'PortInUseException', even though it isn't? Versions prior to 2.1-8 use lock files, which is not the Mac OS X way of doing things, and therefore has issues. For this reason make sure that you have version 2.1-8 or higher, which makes use of I/O Kit. At this point in time 2.1-8 is only available from CVS, in source form. See the section Retrieving Source Code, on getting the latest code - be sure to get the code from the 'gnu.io' branch. *RXTX 2.2 pre2 Binaries:* http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip On Thu, Mar 11, 2010 at 10:30 PM, Andre-John Mas wrote: > Check to see if the serial device is really in use. If you know which > device (in the /dev directory) the serial port is represented by, then in > then in the terminal you can use 'lsof': > > lsof /dev/myserialdev > > where myserialdev is the name of your serial device. > > Andr?-John > > On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > > > > > ---------- Forwarded message ---------- > > From: Juan Vicente Lopez Gutierrez > > Date: 2010/2/13 > > Subject: RXTX in macmini OSX 10.5 > > To: rxtx at qbang.org > > > > > > Hello. > > > > My name is Juanvi and I'm from Spain. > > I tried to launch a software created by me in the library CXR java to > send information through the serial port and I can not make it work. In > windows if I've done but not mac. I have a mac mini with OSX 10.5 and have > read in the list of web mail that you CXR if you have managed to make it > work on that operating system. > > > > I need you help me please. Do I make the mistake that shows me java: > > > > run: Stable Library =============================== Native lib Version = > RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow > Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at > TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad > called. GENERACION CORRECTA (total time: 0 seconds) > > > > I do not have permission to access the serial port, do not know. > > Os agradeceria much to sit down. > > > > A greeting and thanks. > > Pardon my English. > > > > Juanvi. > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at crowbird.com Fri Mar 12 10:59:00 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:59:00 -0500 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: Message-ID: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Native libraries can only be loaded from JARs when you are using Java Webstart (see http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native library must be located at the root of the jar. Instead of putting the native libraries into your JDK/JRE you can specified -Djava.library.path= as an argument to the JVM when you start your application. Andrew On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > Hi, > I am using rxtx as a library and currently it is not very easy to include > it to other libraries. The problem is that the current distribution contains > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > that it would be much better to provide platform specific jars with native > libraries (for example rxtx-2.1-7-win32.jar would contain files > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > maybe the second option is to provide one jar for all platform libraries and > RXTXcomm.jar would open the one that is needed based on platform it runs on. > I am not experienced at all in running native libraries in Java so please > tell me if I am asking for nonsense. > > Thank you, > sax > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivmai at mail.ru Mon Mar 15 13:19:20 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Mon, 15 Mar 2010 22:19:20 +0300 Subject: [Rxtx] =?koi8-r?b?TmF0aXZlIGxpYnJhcmllcyBpbiBwbGF0Zm9ybSBzcGVj?= =?koi8-r?b?aWZpYyBqYXJz?= In-Reply-To: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: Fri, 12 Mar 2010 12:59:00 -0500 letter from Andrew Kroh : > Native libraries can only be loaded from JARs when you are using Java > Webstart (see > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > library must be located at the root of the jar. Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so files to temp folder before loading them). > > Instead of putting the native libraries into your JDK/JRE you can specified > -Djava.library.path= as an argument > to the JVM when you start your application. > > Andrew > > On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > > > Hi, > > I am using rxtx as a library and currently it is not very easy to include > > it to other libraries. The problem is that the current distribution contains > > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > > that it would be much better to provide platform specific jars with native > > libraries (for example rxtx-2.1-7-win32.jar would contain files > > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > > maybe the second option is to provide one jar for all platform libraries and > > RXTXcomm.jar would open the one that is needed based on platform it runs on. > > I am not experienced at all in running native libraries in Java so please > > tell me if I am asking for nonsense. > > > > Thank you, > > sax From bschlining at gmail.com Mon Mar 15 14:26:56 2010 From: bschlining at gmail.com (Brian Schlining) Date: Mon, 15 Mar 2010 13:26:56 -0700 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: > > > > Native libraries can only be loaded from JARs when you are using Java > > Webstart (see > > > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > > library must be located at the root of the jar. > > Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so > files to temp folder before loading them). JNA can also extract and use native libraries (same as SWT), I don't know if this extraction technique works in JWS though. To see how JNA does it go to https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/Native.java?view=markup and look at the loadNativeLibrary and loadNativeLibraryFromJar methods. Cheers -- B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlining at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ravishankar.N at automotiveinfotronics.com Mon Mar 15 22:06:11 2010 From: Ravishankar.N at automotiveinfotronics.com (Ravishankar N) Date: Tue, 16 Mar 2010 09:36:11 +0530 Subject: [Rxtx] Ring detection on modem is not working Message-ID: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> ----------------------------- Message: 7 Date: Mon, 15 Mar 2010 16:32:45 +0200 From: George H To: rxtx at qbang.org Subject: [Rxtx] Ring detection on modem is not working Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com ------------------------------ Hi, According to the API documentation for javax.comm (which is compatible with RxTx), SerialPort. public abstract void notifyOnRingIndicator(boolean enable) This notification is hardware dependent and may not be supported by all implementations. You may want to check if your modem supports it with SerialPort.isRI() Internally in the C library(RawImp.c), this is what is being done: //........ unsigned int result = 0; //..... ioctl( fd, TIOCMGET, &result ); if( result & TIOCM_RI ) return JNI_TRUE; else return JNI_FALSE; // Hope this helps Ravi. From andy at g0poy.com Tue Mar 16 05:27:57 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 16 Mar 2010 11:27:57 +0000 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> Message-ID: <20100316112757.65458aaf@workstation.site> On Tue, 16 Mar 2010 09:36:11 +0530 Ravishankar N wrote: > ----------------------------- > Message: 7 > Date: Mon, 15 Mar 2010 16:32:45 +0200 > From: George H > To: rxtx at qbang.org > Subject: [Rxtx] Ring detection on modem is not working > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I am using RXTX v2.2-pre2 > > I have it attached to a USB serial port /dev/ttyUSB0 which is > connected to a US Robotics 5631A serial modem. I have turned on the > event listener so that I can detect DATA_AVAILABLE and RI > > So I hook up my modem to my phone line and I execute these commands > > AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 > OK > AT+FCLASS=8 > OK > AT+VCID=1 > OK > AT+VRID=1 > OK > > Then I call the modem and wait. The SerialPortEvent.RI is not being > received... instead I am getting '.R' or 'RING' from the inputstream > to detect the rings. > > Is this normal not to get SerialPortEvent.RI events? or am I supposed > to but i'm not getting them for some reason, but I am sure an RXTX > developer can explain to me :) > > Thank you > -- > George H > george.dma at gmail.com > > > ------------------------------ > > Hi, > > According to the API documentation for javax.comm (which is compatible with RxTx), > > SerialPort. public abstract void notifyOnRingIndicator(boolean enable) > This notification is hardware dependent and may not be supported by all implementations. > > You may want to check if your modem supports it with > SerialPort.isRI() > > Internally in the C library(RawImp.c), this is what is being done: > > //........ > unsigned int result = 0; > //..... > ioctl( fd, TIOCMGET, &result ); > if( result & TIOCM_RI ) return JNI_TRUE; > else return JNI_FALSE; > // > > Hope this helps > > Ravi. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Also, RING or result code 2 (I think) if you have selected codes rather than text, is the Hayes modem standard response. RI is a signal that is generated by a modem when an incoming call is detected It does this by raising pin 22 (RI) of the full serial interface RS232C, 25 way D type, as the normal PC connector is a bit lacking in pins, it's not available. The 9 way D type is only a limited subset of the full spec. So call detection has to be done in a different way. You can use the Hayes RING or result code then tell the modem to answer, or you can set the modem to auto answer and look for the CONNECT string. Andy Andy From george.dma at gmail.com Tue Mar 16 05:44:02 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 13:44:02 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <20100316112757.65458aaf@workstation.site> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> Message-ID: Hi thanks for replies. I'm in a bit of a weird situation. I am developing software on a PC that has no serial ports so I use a USB to serial port connector. The machine that will be using it has proper serial ports but its impossible to develop the program on it. And deploying the app to the target machine for a test is very time consuming.. eh not to mention its a big app. I kinda did a dirty workaround. Since in my case I am only using the modem to detect rings and show caller id, I initialize the modem synchronously then I turn on ON_DATA_AVAILABLE events. So when it rings I get ".R" line triggering a serial event. Then I can display it on the screen and the user can choose to pick up the call or wait a bit. btw. I don't know if you guys know modem stuff really well. I have a question on answering the line using the modem. I put the modem in AT+FCLASS=8 (voice) and Its connected to a telephone and the telephone to the line. When it rings the press on the application "answer" that sends "AT+VLS=1" and then they pickup the headset and talk. I seen some people using AT+VLS=0 and ATA. I don't know which one is actually better to use. Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 1:27 PM, Andy Eskelson wrote: > > > > On Tue, 16 Mar 2010 09:36:11 +0530 > Ravishankar N wrote: > >> ----------------------------- >> Message: 7 >> Date: Mon, 15 Mar 2010 16:32:45 +0200 >> From: George H >> To: rxtx at qbang.org >> Subject: [Rxtx] Ring detection on modem is not working >> Message-ID: >> ? ? ? ? >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hi, >> >> I am using RXTX v2.2-pre2 >> >> I have it attached to a USB serial port ?/dev/ttyUSB0 which is >> connected to a US Robotics 5631A serial modem. I have turned on the >> event listener so that I can detect DATA_AVAILABLE and RI >> >> So I hook up my modem to my phone line and I execute these commands >> >> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 >> OK >> AT+FCLASS=8 >> OK >> AT+VCID=1 >> OK >> AT+VRID=1 >> OK >> >> Then I call the modem and wait. The SerialPortEvent.RI is not being >> received... instead I am getting '.R' or 'RING' from the inputstream >> to detect the rings. >> >> Is this normal not to get SerialPortEvent.RI events? or am I supposed >> to but i'm not getting them for some reason, but I am sure an RXTX >> developer can explain to me :) >> >> Thank you >> -- >> George H >> george.dma at gmail.com >> >> >> ------------------------------ >> >> Hi, >> >> According to the API documentation for javax.comm (which is compatible with RxTx), >> >> ?SerialPort. public abstract void notifyOnRingIndicator(boolean enable) >> ?This notification is hardware dependent and may not be supported by all implementations. >> >> You may want to check if your modem supports it with >> SerialPort.isRI() >> >> Internally in the C library(RawImp.c), this is what is being done: >> >> //........ >> unsigned int result = 0; >> //..... >> ioctl( fd, TIOCMGET, &result ); >> if( result & TIOCM_RI ) return JNI_TRUE; >> ? ? ? ? else return JNI_FALSE; >> // >> >> Hope this helps >> >> Ravi. >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > > > Also, RING or result code 2 (I think) if you have selected codes rather > than text, is the Hayes modem standard response. > > RI is a signal that is generated by a modem when an incoming call is > detected It does this by raising pin 22 (RI) of the full serial interface > RS232C, ?25 way D type, as the normal PC connector is a bit lacking in > pins, it's not available. The 9 way D type is only a limited subset of > the full spec. So call detection has to be done in a different way. > > You ?can use the Hayes RING or result code then tell the modem to answer, > or you can set the modem to auto answer and look for the CONNECT string. > > Andy > > > > Andy > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From mariusz.dec at gmail.com Tue Mar 16 06:06:04 2010 From: mariusz.dec at gmail.com (M.Dec-Gazeta) Date: Tue, 16 Mar 2010 13:06:04 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> Message-ID: <9EF082A64E834367AB04DF00251BB67D@mdam2> Hi George [...] Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? Try to understand pick-up and hang-up of the phone. It works so: Your line (when not in use) is completely open (very big resistance). If you pick up phone (or modem) you make the short-circuit on the line and you have to "pull" current from the line (value depends of Telcom and country). Therefore and only from this event ("short circuit") tel exchange knows that you want to talk (except ISDN of course). If you have telephone and modem connected to one line parallely (only way to work for both devices), ther is no way to disconnect line making short-circuit off for one device only. WHY? Because disconnecting means: remove "short-circuit" from the line. Regards Mariusz Dec From george.dma at gmail.com Tue Mar 16 06:19:01 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 14:19:01 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <9EF082A64E834367AB04DF00251BB67D@mdam2> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: Thanks Mariusz for the explanation. So I guess there is no way for me to escape this. The user has to hangup the phone and I send ATH. I thought maybe there was a special way to do it or something :) maybe I need a better telephone with bluetooth control. I just tried my modem on a machine with regular serial ports, the ring indicator didn't work. I guess this modem just doesn't support it. I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 2:06 PM, M.Dec-Gazeta wrote: > Hi George > [...] > Also to hangup, sending ATH doesn't completely hangup the phone, I > have to close the headset to get it fully closed. Is there a command > that can fully close the line? kinda like press the hungup button for > a few secs without putting down the head set? > > > Try to understand pick-up and hang-up of the phone. > > It works so: > > Your line (when not in use) is completely open (very big resistance). > If you pick up phone (or modem) you make the short-circuit on the line and > you have to "pull" current from the line (value depends of ?Telcom and > country). > Therefore and only from this event ("short circuit") tel exchange knows that > you want to talk (except ISDN of course). > If you have telephone and modem connected to one line parallely (only way to > work for both devices), ther is no way to disconnect line making > short-circuit off for one device only. > WHY? ?Because disconnecting means: remove "short-circuit" from the line. > Regards > Mariusz Dec > > > > From mariusz.dec at gmail.com Tue Mar 16 06:42:40 2010 From: mariusz.dec at gmail.com (M.Dec-GMail) Date: Tue, 16 Mar 2010 13:42:40 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: <9D2E7610ADC84223A8E21E02D91AB66A@mdam2> ----- Original Message ----- From: "George H" To: "rxtx" Sent: Tuesday, March 16, 2010 1:19 PM Subject: Re: [Rxtx] Ring detection on modem is not working [..] I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com Hi, 1. Answer UNDER posts is recommended for future readers! 2. I have seen in the past modems with output for phone (I am not using modems from couple of years) In this case you connect phone "after" the modem. Relay in the modem disconnects phone when modem picks-up the line and connects back after modem's hang-up. This is most elegant and ONLY GOOD from technical reason, way to solve conflicts between phone and modem. If you have phone "before" or parrallel to modem you may have unpredictable results of the transmissions because of phone circuits. In most cases phone needs power for work from telco line and therefore has filters in power circuit or somewhat what disturbs very well when fast transmission is going. So - generally - if you expecting good work of modem there SHOULD BE NOTHING on the line except this modem. regards Mariusz From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From Kustaa.Nyholm at planmeca.com Mon Mar 15 03:36:22 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 15 Mar 2010 11:36:22 +0200 Subject: [Rxtx] Virtual serial port (USB CDC ACM) timeout not working...cross posted In-Reply-To: <1080422816.3127.6.camel@localhost.localdomain> Message-ID: Hi, cross posting this as I'm not sure where to turn to for the answer. I've implemented a USB CDC ACM device which appears modem in Mac OS X (and Linux and Windows, but so far I'm concentrating on Mac OS X), in '/dev/tty.usbmodemxxx' . I open the modem, enable the timeouts and with FTDI serial port dongle, reads timeout if there is not (enough) data. However with my own device (a PIC18F4550 with my own USB CDC ACM firmware) reads block until the requested amount of bytes have been read. So this is probably my firmware. I guess this hangs (pun intended) around the fact that my firmware does not setup data and turn the IN endpoint over to the SIE unless the device has something to send. I'm not sure if the SIE responds with ACK or NACK to the host in this situation, and I'm not sure how this should be handled on the device side to get the host driver to return a timeout to the calling application. So any thought are appreciated. br Kusti From nandors125 at gmail.com Mon Mar 15 06:22:14 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Mon, 15 Mar 2010 12:22:14 +0000 Subject: [Rxtx] Problem librxtxSerial.so Mipsel Message-ID: <6b0f5ade1003150522qc42ee3ar190d61db62ffd76@mail.gmail.com> Hi. I need to use the librxtxSerial.so in my Mipsel router. But it seems there is a problem with the file in Toybox because I can't open it. My router: uname -a Linux OpenWrt 2.6.26.8 #2 Sat Mar 6 18:21:48 WET 2010 mips unknown I downloaded the file on Toybox: http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/mipsel-unknown-linux-gnu/librxtxSerial.so And when I run on my PC: file librxtxSerial.so librxtxSerial.so: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, not stripped That seems to be correct. What libraries are needed to get this working?? I can't open the library on my router. -------------- next part -------------- An HTML attachment was scrubbed... URL: From george.dma at gmail.com Mon Mar 15 08:32:45 2010 From: george.dma at gmail.com (George H) Date: Mon, 15 Mar 2010 16:32:45 +0200 Subject: [Rxtx] Ring detection on modem is not working Message-ID: Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com From andy at crowbird.com Fri Mar 12 10:26:42 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:26:42 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: <6ece9bcc1003120926r3fceda8ag45ac6e0a15a57c3b@mail.gmail.com> http://rxtx.qbang.org/wiki/index.php/FAQ#On_MacOS_X_I_get_a_.27PortInUseException.27.2C_even_though_it_isn.27t.3F On MacOS X I get a 'PortInUseException', even though it isn't? Versions prior to 2.1-8 use lock files, which is not the Mac OS X way of doing things, and therefore has issues. For this reason make sure that you have version 2.1-8 or higher, which makes use of I/O Kit. At this point in time 2.1-8 is only available from CVS, in source form. See the section Retrieving Source Code, on getting the latest code - be sure to get the code from the 'gnu.io' branch. *RXTX 2.2 pre2 Binaries:* http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip On Thu, Mar 11, 2010 at 10:30 PM, Andre-John Mas wrote: > Check to see if the serial device is really in use. If you know which > device (in the /dev directory) the serial port is represented by, then in > then in the terminal you can use 'lsof': > > lsof /dev/myserialdev > > where myserialdev is the name of your serial device. > > Andr?-John > > On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > > > > > ---------- Forwarded message ---------- > > From: Juan Vicente Lopez Gutierrez > > Date: 2010/2/13 > > Subject: RXTX in macmini OSX 10.5 > > To: rxtx at qbang.org > > > > > > Hello. > > > > My name is Juanvi and I'm from Spain. > > I tried to launch a software created by me in the library CXR java to > send information through the serial port and I can not make it work. In > windows if I've done but not mac. I have a mac mini with OSX 10.5 and have > read in the list of web mail that you CXR if you have managed to make it > work on that operating system. > > > > I need you help me please. Do I make the mistake that shows me java: > > > > run: Stable Library =============================== Native lib Version = > RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow > Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at > TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad > called. GENERACION CORRECTA (total time: 0 seconds) > > > > I do not have permission to access the serial port, do not know. > > Os agradeceria much to sit down. > > > > A greeting and thanks. > > Pardon my English. > > > > Juanvi. > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at crowbird.com Fri Mar 12 10:59:00 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:59:00 -0500 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: Message-ID: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Native libraries can only be loaded from JARs when you are using Java Webstart (see http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native library must be located at the root of the jar. Instead of putting the native libraries into your JDK/JRE you can specified -Djava.library.path= as an argument to the JVM when you start your application. Andrew On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > Hi, > I am using rxtx as a library and currently it is not very easy to include > it to other libraries. The problem is that the current distribution contains > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > that it would be much better to provide platform specific jars with native > libraries (for example rxtx-2.1-7-win32.jar would contain files > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > maybe the second option is to provide one jar for all platform libraries and > RXTXcomm.jar would open the one that is needed based on platform it runs on. > I am not experienced at all in running native libraries in Java so please > tell me if I am asking for nonsense. > > Thank you, > sax > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivmai at mail.ru Mon Mar 15 13:19:20 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Mon, 15 Mar 2010 22:19:20 +0300 Subject: [Rxtx] =?koi8-r?b?TmF0aXZlIGxpYnJhcmllcyBpbiBwbGF0Zm9ybSBzcGVj?= =?koi8-r?b?aWZpYyBqYXJz?= In-Reply-To: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: Fri, 12 Mar 2010 12:59:00 -0500 letter from Andrew Kroh : > Native libraries can only be loaded from JARs when you are using Java > Webstart (see > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > library must be located at the root of the jar. Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so files to temp folder before loading them). > > Instead of putting the native libraries into your JDK/JRE you can specified > -Djava.library.path= as an argument > to the JVM when you start your application. > > Andrew > > On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > > > Hi, > > I am using rxtx as a library and currently it is not very easy to include > > it to other libraries. The problem is that the current distribution contains > > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > > that it would be much better to provide platform specific jars with native > > libraries (for example rxtx-2.1-7-win32.jar would contain files > > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > > maybe the second option is to provide one jar for all platform libraries and > > RXTXcomm.jar would open the one that is needed based on platform it runs on. > > I am not experienced at all in running native libraries in Java so please > > tell me if I am asking for nonsense. > > > > Thank you, > > sax From bschlining at gmail.com Mon Mar 15 14:26:56 2010 From: bschlining at gmail.com (Brian Schlining) Date: Mon, 15 Mar 2010 13:26:56 -0700 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: > > > > Native libraries can only be loaded from JARs when you are using Java > > Webstart (see > > > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > > library must be located at the root of the jar. > > Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so > files to temp folder before loading them). JNA can also extract and use native libraries (same as SWT), I don't know if this extraction technique works in JWS though. To see how JNA does it go to https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/Native.java?view=markup and look at the loadNativeLibrary and loadNativeLibraryFromJar methods. Cheers -- B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlining at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ravishankar.N at automotiveinfotronics.com Mon Mar 15 22:06:11 2010 From: Ravishankar.N at automotiveinfotronics.com (Ravishankar N) Date: Tue, 16 Mar 2010 09:36:11 +0530 Subject: [Rxtx] Ring detection on modem is not working Message-ID: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> ----------------------------- Message: 7 Date: Mon, 15 Mar 2010 16:32:45 +0200 From: George H To: rxtx at qbang.org Subject: [Rxtx] Ring detection on modem is not working Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com ------------------------------ Hi, According to the API documentation for javax.comm (which is compatible with RxTx), SerialPort. public abstract void notifyOnRingIndicator(boolean enable) This notification is hardware dependent and may not be supported by all implementations. You may want to check if your modem supports it with SerialPort.isRI() Internally in the C library(RawImp.c), this is what is being done: //........ unsigned int result = 0; //..... ioctl( fd, TIOCMGET, &result ); if( result & TIOCM_RI ) return JNI_TRUE; else return JNI_FALSE; // Hope this helps Ravi. From andy at g0poy.com Tue Mar 16 05:27:57 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 16 Mar 2010 11:27:57 +0000 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> Message-ID: <20100316112757.65458aaf@workstation.site> On Tue, 16 Mar 2010 09:36:11 +0530 Ravishankar N wrote: > ----------------------------- > Message: 7 > Date: Mon, 15 Mar 2010 16:32:45 +0200 > From: George H > To: rxtx at qbang.org > Subject: [Rxtx] Ring detection on modem is not working > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I am using RXTX v2.2-pre2 > > I have it attached to a USB serial port /dev/ttyUSB0 which is > connected to a US Robotics 5631A serial modem. I have turned on the > event listener so that I can detect DATA_AVAILABLE and RI > > So I hook up my modem to my phone line and I execute these commands > > AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 > OK > AT+FCLASS=8 > OK > AT+VCID=1 > OK > AT+VRID=1 > OK > > Then I call the modem and wait. The SerialPortEvent.RI is not being > received... instead I am getting '.R' or 'RING' from the inputstream > to detect the rings. > > Is this normal not to get SerialPortEvent.RI events? or am I supposed > to but i'm not getting them for some reason, but I am sure an RXTX > developer can explain to me :) > > Thank you > -- > George H > george.dma at gmail.com > > > ------------------------------ > > Hi, > > According to the API documentation for javax.comm (which is compatible with RxTx), > > SerialPort. public abstract void notifyOnRingIndicator(boolean enable) > This notification is hardware dependent and may not be supported by all implementations. > > You may want to check if your modem supports it with > SerialPort.isRI() > > Internally in the C library(RawImp.c), this is what is being done: > > //........ > unsigned int result = 0; > //..... > ioctl( fd, TIOCMGET, &result ); > if( result & TIOCM_RI ) return JNI_TRUE; > else return JNI_FALSE; > // > > Hope this helps > > Ravi. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Also, RING or result code 2 (I think) if you have selected codes rather than text, is the Hayes modem standard response. RI is a signal that is generated by a modem when an incoming call is detected It does this by raising pin 22 (RI) of the full serial interface RS232C, 25 way D type, as the normal PC connector is a bit lacking in pins, it's not available. The 9 way D type is only a limited subset of the full spec. So call detection has to be done in a different way. You can use the Hayes RING or result code then tell the modem to answer, or you can set the modem to auto answer and look for the CONNECT string. Andy Andy From george.dma at gmail.com Tue Mar 16 05:44:02 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 13:44:02 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <20100316112757.65458aaf@workstation.site> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> Message-ID: Hi thanks for replies. I'm in a bit of a weird situation. I am developing software on a PC that has no serial ports so I use a USB to serial port connector. The machine that will be using it has proper serial ports but its impossible to develop the program on it. And deploying the app to the target machine for a test is very time consuming.. eh not to mention its a big app. I kinda did a dirty workaround. Since in my case I am only using the modem to detect rings and show caller id, I initialize the modem synchronously then I turn on ON_DATA_AVAILABLE events. So when it rings I get ".R" line triggering a serial event. Then I can display it on the screen and the user can choose to pick up the call or wait a bit. btw. I don't know if you guys know modem stuff really well. I have a question on answering the line using the modem. I put the modem in AT+FCLASS=8 (voice) and Its connected to a telephone and the telephone to the line. When it rings the press on the application "answer" that sends "AT+VLS=1" and then they pickup the headset and talk. I seen some people using AT+VLS=0 and ATA. I don't know which one is actually better to use. Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 1:27 PM, Andy Eskelson wrote: > > > > On Tue, 16 Mar 2010 09:36:11 +0530 > Ravishankar N wrote: > >> ----------------------------- >> Message: 7 >> Date: Mon, 15 Mar 2010 16:32:45 +0200 >> From: George H >> To: rxtx at qbang.org >> Subject: [Rxtx] Ring detection on modem is not working >> Message-ID: >> ? ? ? ? >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hi, >> >> I am using RXTX v2.2-pre2 >> >> I have it attached to a USB serial port ?/dev/ttyUSB0 which is >> connected to a US Robotics 5631A serial modem. I have turned on the >> event listener so that I can detect DATA_AVAILABLE and RI >> >> So I hook up my modem to my phone line and I execute these commands >> >> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 >> OK >> AT+FCLASS=8 >> OK >> AT+VCID=1 >> OK >> AT+VRID=1 >> OK >> >> Then I call the modem and wait. The SerialPortEvent.RI is not being >> received... instead I am getting '.R' or 'RING' from the inputstream >> to detect the rings. >> >> Is this normal not to get SerialPortEvent.RI events? or am I supposed >> to but i'm not getting them for some reason, but I am sure an RXTX >> developer can explain to me :) >> >> Thank you >> -- >> George H >> george.dma at gmail.com >> >> >> ------------------------------ >> >> Hi, >> >> According to the API documentation for javax.comm (which is compatible with RxTx), >> >> ?SerialPort. public abstract void notifyOnRingIndicator(boolean enable) >> ?This notification is hardware dependent and may not be supported by all implementations. >> >> You may want to check if your modem supports it with >> SerialPort.isRI() >> >> Internally in the C library(RawImp.c), this is what is being done: >> >> //........ >> unsigned int result = 0; >> //..... >> ioctl( fd, TIOCMGET, &result ); >> if( result & TIOCM_RI ) return JNI_TRUE; >> ? ? ? ? else return JNI_FALSE; >> // >> >> Hope this helps >> >> Ravi. >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > > > Also, RING or result code 2 (I think) if you have selected codes rather > than text, is the Hayes modem standard response. > > RI is a signal that is generated by a modem when an incoming call is > detected It does this by raising pin 22 (RI) of the full serial interface > RS232C, ?25 way D type, as the normal PC connector is a bit lacking in > pins, it's not available. The 9 way D type is only a limited subset of > the full spec. So call detection has to be done in a different way. > > You ?can use the Hayes RING or result code then tell the modem to answer, > or you can set the modem to auto answer and look for the CONNECT string. > > Andy > > > > Andy > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From mariusz.dec at gmail.com Tue Mar 16 06:06:04 2010 From: mariusz.dec at gmail.com (M.Dec-Gazeta) Date: Tue, 16 Mar 2010 13:06:04 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> Message-ID: <9EF082A64E834367AB04DF00251BB67D@mdam2> Hi George [...] Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? Try to understand pick-up and hang-up of the phone. It works so: Your line (when not in use) is completely open (very big resistance). If you pick up phone (or modem) you make the short-circuit on the line and you have to "pull" current from the line (value depends of Telcom and country). Therefore and only from this event ("short circuit") tel exchange knows that you want to talk (except ISDN of course). If you have telephone and modem connected to one line parallely (only way to work for both devices), ther is no way to disconnect line making short-circuit off for one device only. WHY? Because disconnecting means: remove "short-circuit" from the line. Regards Mariusz Dec From george.dma at gmail.com Tue Mar 16 06:19:01 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 14:19:01 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <9EF082A64E834367AB04DF00251BB67D@mdam2> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: Thanks Mariusz for the explanation. So I guess there is no way for me to escape this. The user has to hangup the phone and I send ATH. I thought maybe there was a special way to do it or something :) maybe I need a better telephone with bluetooth control. I just tried my modem on a machine with regular serial ports, the ring indicator didn't work. I guess this modem just doesn't support it. I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 2:06 PM, M.Dec-Gazeta wrote: > Hi George > [...] > Also to hangup, sending ATH doesn't completely hangup the phone, I > have to close the headset to get it fully closed. Is there a command > that can fully close the line? kinda like press the hungup button for > a few secs without putting down the head set? > > > Try to understand pick-up and hang-up of the phone. > > It works so: > > Your line (when not in use) is completely open (very big resistance). > If you pick up phone (or modem) you make the short-circuit on the line and > you have to "pull" current from the line (value depends of ?Telcom and > country). > Therefore and only from this event ("short circuit") tel exchange knows that > you want to talk (except ISDN of course). > If you have telephone and modem connected to one line parallely (only way to > work for both devices), ther is no way to disconnect line making > short-circuit off for one device only. > WHY? ?Because disconnecting means: remove "short-circuit" from the line. > Regards > Mariusz Dec > > > > From mariusz.dec at gmail.com Tue Mar 16 06:42:40 2010 From: mariusz.dec at gmail.com (M.Dec-GMail) Date: Tue, 16 Mar 2010 13:42:40 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: <9D2E7610ADC84223A8E21E02D91AB66A@mdam2> ----- Original Message ----- From: "George H" To: "rxtx" Sent: Tuesday, March 16, 2010 1:19 PM Subject: Re: [Rxtx] Ring detection on modem is not working [..] I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com Hi, 1. Answer UNDER posts is recommended for future readers! 2. I have seen in the past modems with output for phone (I am not using modems from couple of years) In this case you connect phone "after" the modem. Relay in the modem disconnects phone when modem picks-up the line and connects back after modem's hang-up. This is most elegant and ONLY GOOD from technical reason, way to solve conflicts between phone and modem. If you have phone "before" or parrallel to modem you may have unpredictable results of the transmissions because of phone circuits. In most cases phone needs power for work from telco line and therefore has filters in power circuit or somewhat what disturbs very well when fast transmission is going. So - generally - if you expecting good work of modem there SHOULD BE NOTHING on the line except this modem. regards Mariusz From nandors125 at gmail.com Tue Mar 16 11:07:01 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Tue, 16 Mar 2010 17:07:01 +0000 Subject: [Rxtx] Need Help Buiding RXTX uClibc OpenWrt Message-ID: <6b0f5ade1003161007u31b32d31me47ebd5c7c2cca6@mail.gmail.com> Hi! I need to build librxtxSerial against uclibc and not against gllibc like the file in Toybox. How to do this?? I am having trouble buiding rxtx from source too: /usr/lib/jvm/java-6-sun configure: WARNING: using JAVA_HOME environmental variable adjusted java.home is /usr/lib/jvm/java-6-sun checking os.name Exception in thread "main" java.lang.NoClassDefFoundError: conftest Caused by: java.lang.ClassNotFoundException: conftest at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: conftest. Program will exit. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From nsayer at kfu.com Tue Mar 16 11:31:23 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:31:23 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues Message-ID: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple loadLibrary("rxtxSerial") This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. The fix is to change the call to loadLibrary like this: boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); try { System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); } catch(UnsatisfiedLinkException ex) { System.loadLibrary("rxtxSerial"); } This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. From ivmai at mail.ru Tue Mar 16 11:36:27 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 20:36:27 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > > loadLibrary("rxtxSerial") > > This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. This was already discussed in this ML. Fetch the latest rxtx CVS. > > For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. > > For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. > > The fix is to change the call to loadLibrary like this: > > boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); > > try { > System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); > } > catch(UnsatisfiedLinkException ex) { > System.loadLibrary("rxtxSerial"); > } > > This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). > > There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 11:52:42 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:52:42 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java 4c4 < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who --- > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who 467,474c467,468 < String err_msg; < try { < err_msg = native_psmisc_report_owner(PortName); < } catch (Throwable t) < { < err_msg = "Port " + PortName + " already owned... unable to open."; < } < throw new gnu.io.PortInUseException( err_msg ); --- > throw new gnu.io.PortInUseException( > native_psmisc_report_owner(PortName)); So exactly how is the latest CVS supposed to help? On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple >> >> loadLibrary("rxtxSerial") >> >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > This was already discussed in this ML. Fetch the latest rxtx CVS. > From ivmai at mail.ru Tue Mar 16 12:12:56 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 21:12:56 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: References: Message-ID: Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: > > [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. > Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS > diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java > 4c4 > < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who > --- > > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel > 467,474c467,468 > < String err_msg; > < try { > < err_msg = native_psmisc_report_owner(PortName); > < } catch (Throwable t) > < { > < err_msg = "Port " + PortName + " already owned... unable to open."; > < } > < throw new gnu.io.PortInUseException( err_msg ); > --- > > throw new gnu.io.PortInUseException( > > native_psmisc_report_owner(PortName)); > > > So exactly how is the latest CVS supposed to help? > > On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > > > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > > > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > >> > >> loadLibrary("rxtxSerial") > >> > >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > > > This was already discussed in this ML. Fetch the latest rxtx CVS. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 12:20:07 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 11:20:07 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: Message-ID: <5F4EC824-E87E-4936-BA31-7B7F9EE65D72@kfu.com> On Mar 16, 2010, at 11:12 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > >> Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: >> >> [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. >> Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS >> diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java >> 4c4 >> < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who >> --- >>> | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who > > This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel That's what I did. The CVS repository listed on the wiki at qbang is dead, but searching the archives led me to :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot And that's the EXACT cvs checkout command I executed. Perhaps it's worth updating the wiki and/or website... From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From Kustaa.Nyholm at planmeca.com Mon Mar 15 03:36:22 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 15 Mar 2010 11:36:22 +0200 Subject: [Rxtx] Virtual serial port (USB CDC ACM) timeout not working...cross posted In-Reply-To: <1080422816.3127.6.camel@localhost.localdomain> Message-ID: Hi, cross posting this as I'm not sure where to turn to for the answer. I've implemented a USB CDC ACM device which appears modem in Mac OS X (and Linux and Windows, but so far I'm concentrating on Mac OS X), in '/dev/tty.usbmodemxxx' . I open the modem, enable the timeouts and with FTDI serial port dongle, reads timeout if there is not (enough) data. However with my own device (a PIC18F4550 with my own USB CDC ACM firmware) reads block until the requested amount of bytes have been read. So this is probably my firmware. I guess this hangs (pun intended) around the fact that my firmware does not setup data and turn the IN endpoint over to the SIE unless the device has something to send. I'm not sure if the SIE responds with ACK or NACK to the host in this situation, and I'm not sure how this should be handled on the device side to get the host driver to return a timeout to the calling application. So any thought are appreciated. br Kusti From nandors125 at gmail.com Mon Mar 15 06:22:14 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Mon, 15 Mar 2010 12:22:14 +0000 Subject: [Rxtx] Problem librxtxSerial.so Mipsel Message-ID: <6b0f5ade1003150522qc42ee3ar190d61db62ffd76@mail.gmail.com> Hi. I need to use the librxtxSerial.so in my Mipsel router. But it seems there is a problem with the file in Toybox because I can't open it. My router: uname -a Linux OpenWrt 2.6.26.8 #2 Sat Mar 6 18:21:48 WET 2010 mips unknown I downloaded the file on Toybox: http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/mipsel-unknown-linux-gnu/librxtxSerial.so And when I run on my PC: file librxtxSerial.so librxtxSerial.so: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, not stripped That seems to be correct. What libraries are needed to get this working?? I can't open the library on my router. -------------- next part -------------- An HTML attachment was scrubbed... URL: From george.dma at gmail.com Mon Mar 15 08:32:45 2010 From: george.dma at gmail.com (George H) Date: Mon, 15 Mar 2010 16:32:45 +0200 Subject: [Rxtx] Ring detection on modem is not working Message-ID: Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com From andy at crowbird.com Fri Mar 12 10:26:42 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:26:42 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: <6ece9bcc1003120926r3fceda8ag45ac6e0a15a57c3b@mail.gmail.com> http://rxtx.qbang.org/wiki/index.php/FAQ#On_MacOS_X_I_get_a_.27PortInUseException.27.2C_even_though_it_isn.27t.3F On MacOS X I get a 'PortInUseException', even though it isn't? Versions prior to 2.1-8 use lock files, which is not the Mac OS X way of doing things, and therefore has issues. For this reason make sure that you have version 2.1-8 or higher, which makes use of I/O Kit. At this point in time 2.1-8 is only available from CVS, in source form. See the section Retrieving Source Code, on getting the latest code - be sure to get the code from the 'gnu.io' branch. *RXTX 2.2 pre2 Binaries:* http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip On Thu, Mar 11, 2010 at 10:30 PM, Andre-John Mas wrote: > Check to see if the serial device is really in use. If you know which > device (in the /dev directory) the serial port is represented by, then in > then in the terminal you can use 'lsof': > > lsof /dev/myserialdev > > where myserialdev is the name of your serial device. > > Andr?-John > > On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > > > > > ---------- Forwarded message ---------- > > From: Juan Vicente Lopez Gutierrez > > Date: 2010/2/13 > > Subject: RXTX in macmini OSX 10.5 > > To: rxtx at qbang.org > > > > > > Hello. > > > > My name is Juanvi and I'm from Spain. > > I tried to launch a software created by me in the library CXR java to > send information through the serial port and I can not make it work. In > windows if I've done but not mac. I have a mac mini with OSX 10.5 and have > read in the list of web mail that you CXR if you have managed to make it > work on that operating system. > > > > I need you help me please. Do I make the mistake that shows me java: > > > > run: Stable Library =============================== Native lib Version = > RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow > Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at > TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad > called. GENERACION CORRECTA (total time: 0 seconds) > > > > I do not have permission to access the serial port, do not know. > > Os agradeceria much to sit down. > > > > A greeting and thanks. > > Pardon my English. > > > > Juanvi. > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at crowbird.com Fri Mar 12 10:59:00 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:59:00 -0500 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: Message-ID: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Native libraries can only be loaded from JARs when you are using Java Webstart (see http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native library must be located at the root of the jar. Instead of putting the native libraries into your JDK/JRE you can specified -Djava.library.path= as an argument to the JVM when you start your application. Andrew On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > Hi, > I am using rxtx as a library and currently it is not very easy to include > it to other libraries. The problem is that the current distribution contains > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > that it would be much better to provide platform specific jars with native > libraries (for example rxtx-2.1-7-win32.jar would contain files > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > maybe the second option is to provide one jar for all platform libraries and > RXTXcomm.jar would open the one that is needed based on platform it runs on. > I am not experienced at all in running native libraries in Java so please > tell me if I am asking for nonsense. > > Thank you, > sax > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivmai at mail.ru Mon Mar 15 13:19:20 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Mon, 15 Mar 2010 22:19:20 +0300 Subject: [Rxtx] =?koi8-r?b?TmF0aXZlIGxpYnJhcmllcyBpbiBwbGF0Zm9ybSBzcGVj?= =?koi8-r?b?aWZpYyBqYXJz?= In-Reply-To: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: Fri, 12 Mar 2010 12:59:00 -0500 letter from Andrew Kroh : > Native libraries can only be loaded from JARs when you are using Java > Webstart (see > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > library must be located at the root of the jar. Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so files to temp folder before loading them). > > Instead of putting the native libraries into your JDK/JRE you can specified > -Djava.library.path= as an argument > to the JVM when you start your application. > > Andrew > > On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > > > Hi, > > I am using rxtx as a library and currently it is not very easy to include > > it to other libraries. The problem is that the current distribution contains > > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > > that it would be much better to provide platform specific jars with native > > libraries (for example rxtx-2.1-7-win32.jar would contain files > > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > > maybe the second option is to provide one jar for all platform libraries and > > RXTXcomm.jar would open the one that is needed based on platform it runs on. > > I am not experienced at all in running native libraries in Java so please > > tell me if I am asking for nonsense. > > > > Thank you, > > sax From bschlining at gmail.com Mon Mar 15 14:26:56 2010 From: bschlining at gmail.com (Brian Schlining) Date: Mon, 15 Mar 2010 13:26:56 -0700 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: > > > > Native libraries can only be loaded from JARs when you are using Java > > Webstart (see > > > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > > library must be located at the root of the jar. > > Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so > files to temp folder before loading them). JNA can also extract and use native libraries (same as SWT), I don't know if this extraction technique works in JWS though. To see how JNA does it go to https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/Native.java?view=markup and look at the loadNativeLibrary and loadNativeLibraryFromJar methods. Cheers -- B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlining at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ravishankar.N at automotiveinfotronics.com Mon Mar 15 22:06:11 2010 From: Ravishankar.N at automotiveinfotronics.com (Ravishankar N) Date: Tue, 16 Mar 2010 09:36:11 +0530 Subject: [Rxtx] Ring detection on modem is not working Message-ID: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> ----------------------------- Message: 7 Date: Mon, 15 Mar 2010 16:32:45 +0200 From: George H To: rxtx at qbang.org Subject: [Rxtx] Ring detection on modem is not working Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com ------------------------------ Hi, According to the API documentation for javax.comm (which is compatible with RxTx), SerialPort. public abstract void notifyOnRingIndicator(boolean enable) This notification is hardware dependent and may not be supported by all implementations. You may want to check if your modem supports it with SerialPort.isRI() Internally in the C library(RawImp.c), this is what is being done: //........ unsigned int result = 0; //..... ioctl( fd, TIOCMGET, &result ); if( result & TIOCM_RI ) return JNI_TRUE; else return JNI_FALSE; // Hope this helps Ravi. From andy at g0poy.com Tue Mar 16 05:27:57 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 16 Mar 2010 11:27:57 +0000 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> Message-ID: <20100316112757.65458aaf@workstation.site> On Tue, 16 Mar 2010 09:36:11 +0530 Ravishankar N wrote: > ----------------------------- > Message: 7 > Date: Mon, 15 Mar 2010 16:32:45 +0200 > From: George H > To: rxtx at qbang.org > Subject: [Rxtx] Ring detection on modem is not working > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I am using RXTX v2.2-pre2 > > I have it attached to a USB serial port /dev/ttyUSB0 which is > connected to a US Robotics 5631A serial modem. I have turned on the > event listener so that I can detect DATA_AVAILABLE and RI > > So I hook up my modem to my phone line and I execute these commands > > AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 > OK > AT+FCLASS=8 > OK > AT+VCID=1 > OK > AT+VRID=1 > OK > > Then I call the modem and wait. The SerialPortEvent.RI is not being > received... instead I am getting '.R' or 'RING' from the inputstream > to detect the rings. > > Is this normal not to get SerialPortEvent.RI events? or am I supposed > to but i'm not getting them for some reason, but I am sure an RXTX > developer can explain to me :) > > Thank you > -- > George H > george.dma at gmail.com > > > ------------------------------ > > Hi, > > According to the API documentation for javax.comm (which is compatible with RxTx), > > SerialPort. public abstract void notifyOnRingIndicator(boolean enable) > This notification is hardware dependent and may not be supported by all implementations. > > You may want to check if your modem supports it with > SerialPort.isRI() > > Internally in the C library(RawImp.c), this is what is being done: > > //........ > unsigned int result = 0; > //..... > ioctl( fd, TIOCMGET, &result ); > if( result & TIOCM_RI ) return JNI_TRUE; > else return JNI_FALSE; > // > > Hope this helps > > Ravi. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Also, RING or result code 2 (I think) if you have selected codes rather than text, is the Hayes modem standard response. RI is a signal that is generated by a modem when an incoming call is detected It does this by raising pin 22 (RI) of the full serial interface RS232C, 25 way D type, as the normal PC connector is a bit lacking in pins, it's not available. The 9 way D type is only a limited subset of the full spec. So call detection has to be done in a different way. You can use the Hayes RING or result code then tell the modem to answer, or you can set the modem to auto answer and look for the CONNECT string. Andy Andy From george.dma at gmail.com Tue Mar 16 05:44:02 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 13:44:02 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <20100316112757.65458aaf@workstation.site> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> Message-ID: Hi thanks for replies. I'm in a bit of a weird situation. I am developing software on a PC that has no serial ports so I use a USB to serial port connector. The machine that will be using it has proper serial ports but its impossible to develop the program on it. And deploying the app to the target machine for a test is very time consuming.. eh not to mention its a big app. I kinda did a dirty workaround. Since in my case I am only using the modem to detect rings and show caller id, I initialize the modem synchronously then I turn on ON_DATA_AVAILABLE events. So when it rings I get ".R" line triggering a serial event. Then I can display it on the screen and the user can choose to pick up the call or wait a bit. btw. I don't know if you guys know modem stuff really well. I have a question on answering the line using the modem. I put the modem in AT+FCLASS=8 (voice) and Its connected to a telephone and the telephone to the line. When it rings the press on the application "answer" that sends "AT+VLS=1" and then they pickup the headset and talk. I seen some people using AT+VLS=0 and ATA. I don't know which one is actually better to use. Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 1:27 PM, Andy Eskelson wrote: > > > > On Tue, 16 Mar 2010 09:36:11 +0530 > Ravishankar N wrote: > >> ----------------------------- >> Message: 7 >> Date: Mon, 15 Mar 2010 16:32:45 +0200 >> From: George H >> To: rxtx at qbang.org >> Subject: [Rxtx] Ring detection on modem is not working >> Message-ID: >> ? ? ? ? >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hi, >> >> I am using RXTX v2.2-pre2 >> >> I have it attached to a USB serial port ?/dev/ttyUSB0 which is >> connected to a US Robotics 5631A serial modem. I have turned on the >> event listener so that I can detect DATA_AVAILABLE and RI >> >> So I hook up my modem to my phone line and I execute these commands >> >> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 >> OK >> AT+FCLASS=8 >> OK >> AT+VCID=1 >> OK >> AT+VRID=1 >> OK >> >> Then I call the modem and wait. The SerialPortEvent.RI is not being >> received... instead I am getting '.R' or 'RING' from the inputstream >> to detect the rings. >> >> Is this normal not to get SerialPortEvent.RI events? or am I supposed >> to but i'm not getting them for some reason, but I am sure an RXTX >> developer can explain to me :) >> >> Thank you >> -- >> George H >> george.dma at gmail.com >> >> >> ------------------------------ >> >> Hi, >> >> According to the API documentation for javax.comm (which is compatible with RxTx), >> >> ?SerialPort. public abstract void notifyOnRingIndicator(boolean enable) >> ?This notification is hardware dependent and may not be supported by all implementations. >> >> You may want to check if your modem supports it with >> SerialPort.isRI() >> >> Internally in the C library(RawImp.c), this is what is being done: >> >> //........ >> unsigned int result = 0; >> //..... >> ioctl( fd, TIOCMGET, &result ); >> if( result & TIOCM_RI ) return JNI_TRUE; >> ? ? ? ? else return JNI_FALSE; >> // >> >> Hope this helps >> >> Ravi. >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > > > Also, RING or result code 2 (I think) if you have selected codes rather > than text, is the Hayes modem standard response. > > RI is a signal that is generated by a modem when an incoming call is > detected It does this by raising pin 22 (RI) of the full serial interface > RS232C, ?25 way D type, as the normal PC connector is a bit lacking in > pins, it's not available. The 9 way D type is only a limited subset of > the full spec. So call detection has to be done in a different way. > > You ?can use the Hayes RING or result code then tell the modem to answer, > or you can set the modem to auto answer and look for the CONNECT string. > > Andy > > > > Andy > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From mariusz.dec at gmail.com Tue Mar 16 06:06:04 2010 From: mariusz.dec at gmail.com (M.Dec-Gazeta) Date: Tue, 16 Mar 2010 13:06:04 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> Message-ID: <9EF082A64E834367AB04DF00251BB67D@mdam2> Hi George [...] Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? Try to understand pick-up and hang-up of the phone. It works so: Your line (when not in use) is completely open (very big resistance). If you pick up phone (or modem) you make the short-circuit on the line and you have to "pull" current from the line (value depends of Telcom and country). Therefore and only from this event ("short circuit") tel exchange knows that you want to talk (except ISDN of course). If you have telephone and modem connected to one line parallely (only way to work for both devices), ther is no way to disconnect line making short-circuit off for one device only. WHY? Because disconnecting means: remove "short-circuit" from the line. Regards Mariusz Dec From george.dma at gmail.com Tue Mar 16 06:19:01 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 14:19:01 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <9EF082A64E834367AB04DF00251BB67D@mdam2> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: Thanks Mariusz for the explanation. So I guess there is no way for me to escape this. The user has to hangup the phone and I send ATH. I thought maybe there was a special way to do it or something :) maybe I need a better telephone with bluetooth control. I just tried my modem on a machine with regular serial ports, the ring indicator didn't work. I guess this modem just doesn't support it. I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 2:06 PM, M.Dec-Gazeta wrote: > Hi George > [...] > Also to hangup, sending ATH doesn't completely hangup the phone, I > have to close the headset to get it fully closed. Is there a command > that can fully close the line? kinda like press the hungup button for > a few secs without putting down the head set? > > > Try to understand pick-up and hang-up of the phone. > > It works so: > > Your line (when not in use) is completely open (very big resistance). > If you pick up phone (or modem) you make the short-circuit on the line and > you have to "pull" current from the line (value depends of ?Telcom and > country). > Therefore and only from this event ("short circuit") tel exchange knows that > you want to talk (except ISDN of course). > If you have telephone and modem connected to one line parallely (only way to > work for both devices), ther is no way to disconnect line making > short-circuit off for one device only. > WHY? ?Because disconnecting means: remove "short-circuit" from the line. > Regards > Mariusz Dec > > > > From mariusz.dec at gmail.com Tue Mar 16 06:42:40 2010 From: mariusz.dec at gmail.com (M.Dec-GMail) Date: Tue, 16 Mar 2010 13:42:40 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: <9D2E7610ADC84223A8E21E02D91AB66A@mdam2> ----- Original Message ----- From: "George H" To: "rxtx" Sent: Tuesday, March 16, 2010 1:19 PM Subject: Re: [Rxtx] Ring detection on modem is not working [..] I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com Hi, 1. Answer UNDER posts is recommended for future readers! 2. I have seen in the past modems with output for phone (I am not using modems from couple of years) In this case you connect phone "after" the modem. Relay in the modem disconnects phone when modem picks-up the line and connects back after modem's hang-up. This is most elegant and ONLY GOOD from technical reason, way to solve conflicts between phone and modem. If you have phone "before" or parrallel to modem you may have unpredictable results of the transmissions because of phone circuits. In most cases phone needs power for work from telco line and therefore has filters in power circuit or somewhat what disturbs very well when fast transmission is going. So - generally - if you expecting good work of modem there SHOULD BE NOTHING on the line except this modem. regards Mariusz From nandors125 at gmail.com Tue Mar 16 11:07:01 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Tue, 16 Mar 2010 17:07:01 +0000 Subject: [Rxtx] Need Help Buiding RXTX uClibc OpenWrt Message-ID: <6b0f5ade1003161007u31b32d31me47ebd5c7c2cca6@mail.gmail.com> Hi! I need to build librxtxSerial against uclibc and not against gllibc like the file in Toybox. How to do this?? I am having trouble buiding rxtx from source too: /usr/lib/jvm/java-6-sun configure: WARNING: using JAVA_HOME environmental variable adjusted java.home is /usr/lib/jvm/java-6-sun checking os.name Exception in thread "main" java.lang.NoClassDefFoundError: conftest Caused by: java.lang.ClassNotFoundException: conftest at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: conftest. Program will exit. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From nsayer at kfu.com Tue Mar 16 11:31:23 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:31:23 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues Message-ID: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple loadLibrary("rxtxSerial") This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. The fix is to change the call to loadLibrary like this: boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); try { System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); } catch(UnsatisfiedLinkException ex) { System.loadLibrary("rxtxSerial"); } This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. From ivmai at mail.ru Tue Mar 16 11:36:27 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 20:36:27 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > > loadLibrary("rxtxSerial") > > This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. This was already discussed in this ML. Fetch the latest rxtx CVS. > > For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. > > For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. > > The fix is to change the call to loadLibrary like this: > > boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); > > try { > System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); > } > catch(UnsatisfiedLinkException ex) { > System.loadLibrary("rxtxSerial"); > } > > This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). > > There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 11:52:42 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:52:42 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java 4c4 < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who --- > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who 467,474c467,468 < String err_msg; < try { < err_msg = native_psmisc_report_owner(PortName); < } catch (Throwable t) < { < err_msg = "Port " + PortName + " already owned... unable to open."; < } < throw new gnu.io.PortInUseException( err_msg ); --- > throw new gnu.io.PortInUseException( > native_psmisc_report_owner(PortName)); So exactly how is the latest CVS supposed to help? On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple >> >> loadLibrary("rxtxSerial") >> >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > This was already discussed in this ML. Fetch the latest rxtx CVS. > From ivmai at mail.ru Tue Mar 16 12:12:56 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 21:12:56 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: References: Message-ID: Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: > > [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. > Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS > diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java > 4c4 > < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who > --- > > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel > 467,474c467,468 > < String err_msg; > < try { > < err_msg = native_psmisc_report_owner(PortName); > < } catch (Throwable t) > < { > < err_msg = "Port " + PortName + " already owned... unable to open."; > < } > < throw new gnu.io.PortInUseException( err_msg ); > --- > > throw new gnu.io.PortInUseException( > > native_psmisc_report_owner(PortName)); > > > So exactly how is the latest CVS supposed to help? > > On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > > > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > > > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > >> > >> loadLibrary("rxtxSerial") > >> > >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > > > This was already discussed in this ML. Fetch the latest rxtx CVS. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 12:20:07 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 11:20:07 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: Message-ID: <5F4EC824-E87E-4936-BA31-7B7F9EE65D72@kfu.com> On Mar 16, 2010, at 11:12 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > >> Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: >> >> [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. >> Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS >> diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java >> 4c4 >> < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who >> --- >>> | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who > > This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel That's what I did. The CVS repository listed on the wiki at qbang is dead, but searching the archives led me to :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot And that's the EXACT cvs checkout command I executed. Perhaps it's worth updating the wiki and/or website... From damorales at gmail.com Wed Mar 17 17:37:32 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 20:37:32 -0300 Subject: [Rxtx] Cannot access to CVS Message-ID: Hi Im trying to download the latest source code of RXTX from CVS as is described here: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code but i get a time out error so i cannot download anything. Is the CVS down ? or maybe there is some change to access ? Thanks and greetings !! -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvi at qbang.org Wed Mar 17 18:36:35 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 17 Mar 2010 18:36:35 -0600 (MDT) Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > Hi > > Im trying to download the latest source code of RXTX from CVS as is described here: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code > but i get a time out error so i cannot download anything. > > Is the CVS down ? or maybe there is some change to access ? > > Thanks and greetings? !! > The problem is resolved now. Thank you for pointing this out. I notice some are trying the older cvs server at ...milestone... which is not syncronized with qbang. Daniel has the correct link. If there are references to the older CVS server, we should update them. Any info on pages referencing the older CVS server would be appreciated. -- Trent Jarvi tjarvi at qbang.org From damorales at gmail.com Wed Mar 17 19:25:50 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 22:25:50 -0300 Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: Thanks Trent, i'm downloading now from CVS. I have one question, in the link it says that there are two branches, 2.0 and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 pre2. What version is more updated ? 2.1 from CVS or 2.2 pre2 ? Thanks and greetings !!! 2010/3/17 Trent Jarvi > On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > > Hi >> >> Im trying to download the latest source code of RXTX from CVS as is >> described here: >> http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code >> but i get a time out error so i cannot download anything. >> >> Is the CVS down ? or maybe there is some change to access ? >> >> Thanks and greetings !! >> >> > The problem is resolved now. Thank you for pointing this out. I notice > some are trying the older cvs server at ...milestone... which is not > syncronized with qbang. > > Daniel has the correct link. If there are references to the older CVS > server, we should update them. Any info on pages referencing the older CVS > server would be appreciated. > > -- > Trent Jarvi > tjarvi at qbang.org -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From damorales at gmail.com Wed Mar 17 19:47:23 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 22:47:23 -0300 Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: Never mind, i've compiled and installed rxtx-devel (gnu.io) from CVS and it is 2.2 pre2 version (native library is 2.2 pre2 too). Now my application is working perfectly. Really really thanks for the very good work. Thanks again and greetings !!! 2010/3/17 Daniel Morales Salas > Thanks Trent, i'm downloading now from CVS. > > I have one question, in the link it says that there are two branches, 2.0 > and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 > pre2. What version is more updated ? 2.1 from CVS or 2.2 pre2 ? > > Thanks and greetings !!! > > 2010/3/17 Trent Jarvi > > On Wed, 17 Mar 2010, Daniel Morales Salas wrote: >> >> Hi >>> >>> Im trying to download the latest source code of RXTX from CVS as is >>> described here: >>> http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code >>> but i get a time out error so i cannot download anything. >>> >>> Is the CVS down ? or maybe there is some change to access ? >>> >>> Thanks and greetings !! >>> >>> >> The problem is resolved now. Thank you for pointing this out. I notice >> some are trying the older cvs server at ...milestone... which is not >> syncronized with qbang. >> >> Daniel has the correct link. If there are references to the older CVS >> server, we should update them. Any info on pages referencing the older CVS >> server would be appreciated. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > > > > -- > Atte: > Daniel Dario Morales Salas > Ingeniero Civil en Computaci?n e Inform?tica > Tel?fono: 02 684 3417 > Celular: 09 643 1802 > Santiago, Chile > -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvi at qbang.org Wed Mar 17 19:22:45 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 17 Mar 2010 19:22:45 -0600 (MDT) Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > Thanks Trent, i'm downloading now from CVS. > > I have one question, in the link it says that there are two branches, 2.0 and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 pre2. What version is more > updated ? 2.1 from CVS or 2.2 pre2 ? > -r commapi-0-0-1 has the most current 2.2pre2 when you check it out. Older versions in that branch go back to 2.1. The default branch contains an older version of rxtx that works with Sun's SPI known as RXTX 2.0 and goes back to the Cretaceous period when dinosaurs roamed. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent: Tuesday, March 02, 2010 5:58 AM To: rxtx at qbang.org Subject: Re: [Rxtx] Writing Hex data to the Serial port Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From wido at pcextreme.nl Tue Mar 2 09:21:26 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 17:21:26 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> Message-ID: <1267546886.2661.105.camel@wido-desktop> Hi Mike, I'm running Linux and Windows here, the .Net application ofcourse runs on Windows and is working fine. But Java code doesn't work on Windows nor Linux. On Windows i'm using Portmon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when sniffing. In the "java.LOG" you find the code of my Java test application, the string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a game. The .Net application does something more, but it seems there is a problem with the following data: /* Java */ StopBits: 1 Parity: NONE WordLength: 8 EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 Shake:9 Replace:80 XonLimit:0 XoffLimit:0 RI:-1 RM:0 RC:0 WM:0 WC:0 /* .Net */ StopBits: 1 Parity: NONE WordLength: 8 EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 Now, my baudrate is OK the same for the parity and wordlenght, but it seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and Replace. I've been searching through the SerialPort API Docs, but i'm not able to see any settings regarding these settings. Could this be a problem? In my opinion, the data i'm sending is OK. Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net application is working fine on the same machine! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > How do you "see" the data going out? The only way to know for sure is to see > it on the serial port connector itself. > > A handy device to do this with is a serial break out box. It is a box of > lights for each serial line and jumpers. Even if you don't have one you can > connect a second serial port's receive line to the port in question transmit > or receive line and watch the data with a serial terminal program. > > Some random guesses of things to check. > > Is the data really getting out the serial port (see above)? > Is the baud rate, data bits, stop bits correct? > Is the handshaking correct? Is the serial port handshaking correctly > configured for the device? Is the serial cable correctly providing > handshaking pins to the device? > > Good luck hunting... > > Mike > > > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > Wido den Hollander > Sent: Tuesday, March 02, 2010 5:58 AM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- A non-text attachment was scrubbed... Name: java.LOG Type: text/x-log Size: 9962 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: windows.LOG Type: text/x-log Size: 7453 bytes Desc: not available URL: From andy at g0poy.com Tue Mar 2 10:23:14 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 2 Mar 2010 17:23:14 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267546886.2661.105.camel@wido-desktop> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> Message-ID: <20100302172314.615d56c9@workstation.site> I'm not a java programmer, but I am an old hand with RS232... Do not get confused with strings and hex, you need to send pure data, 0 to 255 or 0x00 0xff NOT "ff" "1a" and so on. The control in the .net setup is more correct EOF = 4 that's the code for EOT End of Transmission, there is no code for EOF in ascii so using EOT is a fairly valid thing to use. ERR = 0 BRK = 0 There are no such codes in the ascii set. BRK, Break is usually defined as holding the line in an active state for more than one character time, Used as a hardware reset type signal. EVT 1a again no such code in ascii, 1a is SUB substitute Xon = 11 DC1 Device control 1, normally Xon Xoff = 13 DC3 Device control 3, normally Xoff These are normal in band flow control, ^Q and ^S on the keyboard The Xon and Xoff limits are the points at which the flow control would cut in. I very much doubt if you are using any flow control. Modern devices can usually suck in any serial data without any problems. Obviously portmon is telling you that something is going on, if you have a spare machine available it would be useful to connect that as the receiving device (you will need a crossover cable) Run up a terminal program and capture the output. I use TeraTerm for such jobs, http://www.ayera.com/teraterm/ Then look at the file with a hex editor to see what was being sent. You can use the same method to capture the output of the .net system to verify that portmon has captured the output correctly. You can also build a file with the correct byte sequence in it and send that via teraterm just to prove that you have got the correct data sequence. The most common problems I've run into (on any system) are: Sending a string rather than raw data, strings are normally terminated with CR, LF or CRLF which messes things up wrong parity wrong speed wrong cable type, using a 1 to 1 cable rather than a crossover. another useful utility I have is VSPE, virtual serial port emulator. http://www.eterlogic.com/Products.VSPE.html With that you can set up a number of virtual ports and send the data through them to the real port. The main screen has a simple monitoring function which will show you the data. Not as advanced as portmon or SrMon , but it does the same job, and I have verified that what it shows is what is sent. Andy On Tue, 02 Mar 2010 17:21:26 +0100 Wido den Hollander wrote: > Hi Mike, > > I'm running Linux and Windows here, the .Net application ofcourse runs > on Windows and is working fine. > > But Java code doesn't work on Windows nor Linux. > > On Windows i'm using Portmon > ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) when > sniffing. > > In the "java.LOG" you find the code of my Java test application, the > string "EE FF FF 00 01 11 01 01 00 EE CC" is the data for starting a > game. > > The .Net application does something more, but it seems there is a > problem with the following data: > > /* Java */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:4 ERR:0 BRK:0 EVT:a XON:0 XOFF:0 > Shake:9 Replace:80 XonLimit:0 XoffLimit:0 > RI:-1 RM:0 RC:0 WM:0 WC:0 > > /* .Net */ > StopBits: 1 Parity: NONE WordLength: 8 > EOF:1a ERR:0 BRK:0 EVT:1a XON:11 XOFF:13 > Shake:0 Replace:0 XonLimit:1024 XoffLimit:1024 > > Now, my baudrate is OK the same for the parity and wordlenght, but it > seems that there is a difference in de EOF, EVT, XON en XOFF, Snake and > Replace. > > I've been searching through the SerialPort API Docs, but i'm not able to > see any settings regarding these settings. > > Could this be a problem? > > In my opinion, the data i'm sending is OK. > > Btw, it's a FT232RL chip, which is USB to Serial. But remember, the .Net > application is working fine on the same machine! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:46 +0000, Mike Kirkland wrote: > > How do you "see" the data going out? The only way to know for sure is to see > > it on the serial port connector itself. > > > > A handy device to do this with is a serial break out box. It is a box of > > lights for each serial line and jumpers. Even if you don't have one you can > > connect a second serial port's receive line to the port in question transmit > > or receive line and watch the data with a serial terminal program. > > > > Some random guesses of things to check. > > > > Is the data really getting out the serial port (see above)? > > Is the baud rate, data bits, stop bits correct? > > Is the handshaking correct? Is the serial port handshaking correctly > > configured for the device? Is the serial cable correctly providing > > handshaking pins to the device? > > > > Good luck hunting... > > > > Mike > > > > > > > > -----Original Message----- > > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of > > Wido den Hollander > > Sent: Tuesday, March 02, 2010 5:58 AM > > To: rxtx at qbang.org > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > Hi, > > > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > > Java code. > > > > My Java version is: > > > > wido at wido-desktop:~/Desktop$ javac -version > > javac 1.6.0_15 > > wido at wido-desktop:~/Desktop$ > > > > I've build a simple BASH script to compile my code and run it. > > > > Now i'm using: > > > > private void startGame() { > > > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > > 0x01, 0x11, > > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > > try { > > this.outputStream.write(buf); > > this.outputStream.flush(); > > System.out.println(buf); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > > > } > > > > It works (i see the right data going out), but the device doesn't > > respond.. > > > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > > right. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > > Hi, > > > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > > send lots of arrays that way through rxtx > > > > > > This seems like a warning... though I am using Eclipse and I never get > > > this warning. I guess your compiler is taking the hex values as ints. > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > > > What IDE are you using ? > > > -- > > > George H > > > george.dma at gmail.com > > > > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > > wrote: > > > Hi, > > > > > > I'm trying to port a .Net application (which was not written > > > by me!) to > > > Java so i can make it platform independent. > > > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > > > First of all, i never used serial ports before in my > > > programming > > > experience, every application i wrote were Webbased > > > applications where i > > > didn't have to worry about binary and hex data. > > > > > > Now, the system i am building is for a paintball competition, > > > we have > > > some flags in the field which have to be remote controlled, so > > > all the > > > hardware is custom made. > > > > > > On Windows i used the program "PortMon" to see what the .Net > > > program > > > does on the serial port, this gave me: > > > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > > SUCCESS Length 11: EE FF FF > > > 00 00 11 01 03 00 EE CC > > > > > > After searching through the .Net code (which was made with > > > Visual > > > Studio) has the following code: > > > > > > private void SendStartGame(byte status, byte destination) { > > > > > > byte[] sendPacket = { 0xEE, > > > 0xFF, > > > destination, //destination ALL > > > FLAGS > > > 0x00, //sender BASE > > > 0x00, //messagetype CHANGE > > > 0x11, //command gamestatus > > > 0x01, //length 6 > > > status, //data status > > > (1=start,2=stop) > > > 0x00, //CRC > > > 0xEE, > > > 0xCC}; > > > > > > if (serialPort1.IsOpen) > > > { > > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > > } > > > else > > > { > > > MessageBox.Show("Not connected to device"); > > > } > > > } > > > > > > No, i'm trying to port that piece of code to Java and i get > > > stuck.. > > > > > > In Java i created: > > > > > > private void startGame() { > > > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > > (byte) 17, > > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > > > try { > > > byte packet = Integer.toHexString(255).getBytes()[0]; > > > this.outputStream.write(buf, 0, buf.length); > > > this.outputStream.flush(); > > > } catch (Exception e) { > > > System.out.println(e.getMessage()); > > > } > > > } > > > > > > This should send a start signal to my piece of hardware, but > > > that > > > doesn't happened. > > > > > > So i'm stuck here about the hex to byte conversion and vise > > > versa. > > > > > > I also tried: > > > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > > > That doesn't work either, the compiler doesn't take it, it > > > gives: > > > > > > PBComm.java:58: possible loss of precision > > > found : int > > > required: byte > > > byte[] buf = { 0xEE, 0xFF }; > > > > > > Since this is my first time using serial ports i'm getting a > > > bit lost. > > > > > > Does somebody have a hint in the right direction? How do i do > > > this in > > > Java? > > > > > > Thank you in advance! > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx From mariusz.dec at gmail.com Tue Mar 2 12:25:21 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 2 Mar 2010 20:25:21 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100302172314.615d56c9@workstation.site> References: <1267538302.2661.19.camel@wido-desktop> <5328115605B34B8C8F53E954BC42CEC3@bengal.net> <1267546886.2661.105.camel@wido-desktop> <20100302172314.615d56c9@workstation.site> Message-ID: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Hi, What I would like suggest is to check XON/XOFF role in the protocol. This is very dangerous idea to use software flow control if you are transferring 8 bit binary, and you arn't sure that this may be NOT ONLY 7-bit ASCII data in transmission stream. And FIRST OFF ALL in this case: SECOND TERMINAL connected THROUGH CABLE until success with cable and transmission speed for simple 'ABCDEF'. Posts many hours later.... Do you did that? BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in Win/Mac/Linux. I am almost 100% sure that from this side everything is ok. Regards Mariusz -------------- next part -------------- An HTML attachment was scrubbed... URL: From HowardZ at howardz.com Tue Mar 2 16:35:33 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Tue, 02 Mar 2010 18:35:33 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8DA0C5.20207@howardz.com> Hi everyone, As I mentioned before, I am controlling a new piece of equipment which sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? characters. Every single time I receive a pound-sign character "#", the next 250 read return -1 then reads go back to normal. -1 represents an error or EOF condition. Is anyone aware of the "#" character representing EOF or causing some kind of error flag? I can ask/pay for the firmware to be changed to eliminate the # character - but I'd rather understand what is going on. Perhaps changing the firmware will not solve this? Any ideas? Howard From tjarvi at qbang.org Tue Mar 2 16:18:42 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 2 Mar 2010 16:18:42 -0700 (MST) Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8DA0C5.20207@howardz.com> References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > Hi everyone, > > As I mentioned before, I am controlling a new piece of equipment which sends > to the computer via RS232 capital letters, digits, CR, LF, #, and ? > characters. > > Every single time I receive a pound-sign character "#", the next 250 read > return -1 > then reads go back to normal. > > > -1 represents an error or EOF condition. > > Is anyone aware of the "#" character representing EOF or causing some kind of > error flag? > > I can ask/pay for the firmware to be changed to eliminate the # character - > but I'd rather understand what is going on. Perhaps changing the firmware > will not solve this? > > Any ideas? > Hi Howard, I suspect you need to change your theshold/timeout. The read(byte b) will return -1 upon timeout. http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() -- Trent Jarvi tjarvi at qbang.org From aawolfe at gmail.com Tue Mar 2 16:59:06 2010 From: aawolfe at gmail.com (Aaron Wolfe) Date: Tue, 2 Mar 2010 18:59:06 -0500 Subject: [Rxtx] read returns -1 ??? In-Reply-To: References: <4B8DA0C5.20207@howardz.com> Message-ID: On Tue, Mar 2, 2010 at 6:18 PM, Trent Jarvi wrote: > > > On Tue, 2 Mar 2010, HowardZ at howardz.com wrote: > >> Hi everyone, >> >> As I mentioned before, I am controlling a new piece of equipment which >> sends to the computer via RS232 capital letters, digits, CR, LF, #, and ? >> characters. >> >> Every single time I receive a pound-sign character "#", the next 250 read >> return -1 >> then reads go back to normal. >> >> >> -1 represents an error or EOF condition. >> >> Is anyone aware of the "#" character representing EOF or causing some kind >> of error flag? >> >> I can ask/pay for the firmware to be changed to eliminate the # character >> - but I'd rather understand what is going on. ?Perhaps changing the firmware >> will not solve this? >> >> Any ideas? >> > > Hi Howard, > > I suspect you need to change your theshold/timeout. ?The read(byte b) will > return -1 upon timeout. > i think this is probably right on target. in my own projects, I've been unable to do a true blocking read. the best I can get is a long (3+ seconds) timeout which returns -1 and loop on that. seems like i must be doing something wrong, but it works so never really got to the bottom of it. > http://java.sun.com/products/javacomm/reference/api/javax/comm/CommPort.html#getInputStream() > > -- > Trent Jarvi > tjarvi at qbang.org > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From Kustaa.Nyholm at planmeca.com Wed Mar 3 03:07:02 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 12:07:02 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY GOOD in > Win/Mac/Linux. Interestingly other people have different experience, hope this is not a breach of etiquette to quote usb at lists.apple.com: > We use USB-RS232 cables extensively and have had nothing but problems > with all of the consumer-grade products. We found these: > > http://www.moxa.com/product/usb_to_serial_converter.htm > > We tested a couple of the single & octal port versions for awhile and > found zero problems. Zero. They work flawlessly up to 921kBaud. We > recently made an order for about 20 single port, 25 quad port, and 2 > of the 32 port Ethernet to Serial products. When they came in we > handed them out and gathered up all the FTDI & Prolific-based consumer > cables and threw them in the trash. So not everyone think the FTDI works great. My experience is limited but for me they have worked ok, but there are one or two gotchas like a 16 ms delay in writing. br Kusti From andreas.eckstein at gmx.net Wed Mar 3 03:36:34 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Wed, 03 Mar 2010 11:36:34 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: Message-ID: <4B8E3BB2.1090509@gmx.net> Hi Kustaa and Johnny! Thank you for your input. I see why you don't want to pull in an external dependency, and that's fair enough. On 01.03.2010 15:02, Kustaa Nyholm wrote: >> So what do you think? Does USB access fit into the RxTx project scope? > > I don't think rxtx should be expanded to embrace anything beyond what > Javacomm 'supports'. So some other project or a new project would be > better. In a way libusb project would be 'natural' place for language > wrappers for libusb library. This of course reflects my view that > the libusb is first and foremost a cross platform usb API which just > happens to be written in C. > > Further in my view the Java wrapper should reflect the usblib API > C API as closely as possible not to introduce object orientation > to the procedural API. I've done this with libusb 0.1 using JNA, > which was a trivial two hour exercise with no C code involved accross all > JNA supported platforms and this approach allows leveraging on all the > example code and documentation with just trivial changes. I disagree. What's the point of using Java when my code is just like C after all? In fact, I have a class very much like your LibUSBInterface and the class layer wraps around that, but using it directly does not integrate well into OO code, never mind reusable code samples. Of course in the end, the _structure_ of the original and the wrapper API are not so much different, and it's a trivial exercise to translate one to the other. It's just that I think a proper java API should if possible not use IO parameters, should use exceptions instead of int return values, and should represent system state with meaningful classes rather than some opaque, method-less handle type. JNA certainly looks interesting, didn't even know it existed. Why did Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Here is what it looks like for libusb 0.1: > > public interface LibUSBInterface extends Library { > void usb_init(); > int usb_find_busses(); > int usb_find_devices(); > USB_bus usb_get_busses(); > String usb_strerror(); > USB_dev_handle usb_open(USB_device dev); > int usb_close(USB_dev_handle dev); > int usb_set_configuration(USB_dev_handle dev, int configuration); > int usb_claim_interface(USB_dev_handle dev, int interfce); > int usb_release_interface(USB_dev_handle dev, int interfce); > int usb_set_altinterface(USB_dev_handle dev, int alternate); > int usb_resetep(USB_dev_handle dev, int ep); > int usb_clear_halt(USB_dev_handle dev, int ep); > int usb_reset(USB_dev_handle dev); > int usb_set_debug(int level); > int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); > int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int > namelen); > int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] > buf, int buflen); > int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int > buflen); > int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte > type, byte index, byte[] buf, int size); > int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, > byte[] buf, int size); > int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, > int timeout); > int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int > size, int timeout); > int usb_control_msg(USB_dev_handle dev, int requesttype, int request, > int value, int index, byte[] bytes, int size, int timeout); > } > > I would expect this could be done easily for 1.0 too. Doing the JNA/JNI > is not the difficult part, getting a cross platform USB library is, > so far only libusb 0.1 has delivered but the recent activity on 1.0 > project seems very encouraging. > > But this is the wrong list for this sort of discussion. > > br Kusti > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > On 01.03.2010 23:16, Johnny Luong wrote: > Sounds pretty neat, but I think the dependency on libusb1.0 would > probably make it better for either a stand alone project, inclusion > towards libusb, or an integration where the necessary components to > build where included altogether with RXTX to avoid the ext. dependency > (in that order). Wish I had something like that a while ago... :) > > Best, > Johnny > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkuMPMgACgkQnQTBLXttTeWXUwCePMOWCspjQq0VHFTzHX8KdBdk > puYAnRhnrnVKu8WmSb7SZxR7jnTASs0y > =okut > -----END PGP SIGNATURE----- > Best regards Andreas From Kustaa.Nyholm at planmeca.com Wed Mar 3 05:21:58 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Wed, 3 Mar 2010 14:21:58 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8E3BB2.1090509@gmx.net> Message-ID: > > I disagree. What's the point of using Java when my code is just like C > after all? In fact, I have a class very much like your LibUSBInterface > and the class layer wraps around that, but using it directly does not > integrate well into OO code, never mind reusable code samples. Of course > in the end, the _structure_ of the original and the wrapper API are not > so much different, and it's a trivial exercise to translate one to the > other. It's just that I think a proper java API should if possible not > use IO parameters, should use exceptions instead of int return values, > and should represent system state with meaningful classes rather than > some opaque, method-less handle type. > > JNA certainly looks interesting, didn't even know it existed. Why did > Sun (R.I.P.) never promote this, or integrate it alongside JNI? > Yes, we disagree fundamentally on this ;-) My view is that the Java language binding should be as low level as possible and match the under laying API as closely as possible. This allows leveraging on existing experience, examples, documentation and support. Besides being almost trivial to implement and havea high probability to "just work". At this level we do not need finesse or beauty, just standards that work and that we know how they work. Trying to be more abstract or object oriented does not bring any real advantage. Witness the failure of Java Media API and Java3D and the success of JOGL. Once we have the low level language binding then this allows anyone to create as Object Oriented and fancy library as they want. However I'm not against having a more abstract library *in addition to* a low level language binding. If someone wants to create a more abstract API those should, for the common good, consider JSR-80. I don't think we need more of the same, meaning yet an other un-maintained and shortly abandoned Java USB API. The time and waste of effort that has already been invested in those APIs makes my head spin. And not much to show for it. Before 1.0 the 0.1 libusb was (and still is) IMO the only successful cross platform API for USB and by taking the JOGL approach we could have a good Java binding within days with a chance of it becoming a real strong standard. Like I said it took me just some hours to create the language binding, it took me several days to actually talk to a USB device on different platform, a process that would have been more difficult if there had been an other abstraction level with it's own kinks and twists that in all probability would not have been popular and thus I would have had very little support from the the developers. With my 1:1 mapping approach I was able to discuss the issues with the libusb user easily and reliably although I was working in Java and they in C. Maybe I should say here that I'm very Object Oriented my self, only for this type of thing I find that benefits of 1 : 1 mapping of an existing API mapping out weight the possible benefits and real disadvantages of a more abstract API. Unless someone beats me to it I will create a low level JNA binding for 1.0 as while 0.1 works great for me, I see that it will not be maintained and someday something in the OS level requires maintenance on the libusb level. I'm cross posting this as I think we should continue this, if there is a need, on libusb list where I tried already to provoke discussion on this issue. br Kusti From msemtd at googlemail.com Wed Mar 3 06:04:51 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 13:04:51 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8E3BB2.1090509@gmx.net> Message-ID: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Google says: http://libusbjava.sourceforge.net/wp/ Regards, Michael Erskine. From wido at pcextreme.nl Wed Mar 3 06:18:57 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Wed, 03 Mar 2010 14:18:57 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> Message-ID: <1267622337.2796.19.camel@wido-desktop> Hi Andy and Mariusz, Thank you for your input! I've made three screenshots of the Windows envirionment (stopt using Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ As you can see, they both run on the Windows machine and the .Net application is working. Now, i'm interested in starting a game, this is done by sending: EE FF FF 00 01 11 01 01 00 EE CC As far as i can tell my Java application (also attached) sends this correctly and both the parity and baudrate are OK. Don't mind the first data (length 10) send by the .Net application, this is for requestion scores, not needed before starting a game. Now before i keep searching and searching: Could this be a problem with the EOF, ERR or any of those settings? I've tried the programs from Andy, but the problem is that i don't have two PC's with a serial port, these days they don't ship PC's with a serialport anymore, that's why i'm using the USB to Serial converter. And i can verify that the .Net application is working fine, next to me is the hardware and i can see the LED's lighting up when i hit "start" on the app. I'm still using PortMon since this seems the best application to monitor a local COM port when you don't have the luxury to hook up two PC's with a null-modem cable. Now i'm getting paranoia, but could it be a feature that i need which is not supported by RXTX? Any help is really appreciated since this is driving me crazy at the moment :-) -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > Hi, > What I would like suggest is to check XON/XOFF role in the protocol. > > This is very dangerous idea to use software flow control if you are > transferring 8 bit binary, and you arn't sure that this may be NOT > ONLY 7-bit ASCII data in transmission stream. > > And FIRST OFF ALL in this case: > SECOND TERMINAL connected THROUGH CABLE until success with cable and > transmission speed for simple 'ABCDEF'. > > Posts many hours later.... > Do you did that? > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > GOOD in Win/Mac/Linux. > I am almost 100% sure that from this side everything is ok. > > Regards > Mariusz > > -------------- next part -------------- A non-text attachment was scrubbed... Name: PBComm.java Type: text/x-java Size: 1753 bytes Desc: not available URL: From msemtd at googlemail.com Wed Mar 3 07:07:16 2010 From: msemtd at googlemail.com (Michael Erskine) Date: Wed, 3 Mar 2010 14:07:16 +0000 Subject: [Rxtx] RxTx usb support In-Reply-To: <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> References: <4B8E3BB2.1090509@gmx.net> <785b52c51003030504g13543997g22d335bb1784fca3@mail.gmail.com> Message-ID: <785b52c51003030607o5ba2e14cqd6055d43ea21d478@mail.gmail.com> On 3 March 2010 13:04, Michael Erskine wrote: > Google says: http://libusbjava.sourceforge.net/wp/ Sorry, I didn't spot the difference between libusb 0.1 and libusb 1.0 :D From mariusz.dec at gmail.com Wed Mar 3 09:03:41 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Wed, 3 Mar 2010 17:03:41 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267626658.2796.21.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> <73a89f361003030611x7bf13bbo29e75656db899a9d@mail.gmail.com> <1267626658.2796.21.camel@wido-desktop> Message-ID: <73a89f361003030803y6c4f6493vfe821f376277d364@mail.gmail.com> 2010/3/3 Wido den Hollander > Hi, > > I've check here: > http://mailman.qbang.org/pipermail/rxtx/2009-November/thread.html > > This one http://mailman.qbang.org/pipermail/rxtx/2009-November/5832077.html read thread. Attachment is here as well. > Can't find a post about short circuiting? You mean connection my RX and > TX ports so i can see what i'm sending back? > Yes, Rx to Tx only, port configured WITHOUT ANY handshake. > > That would be a problem since i only have a USB port, no real RS232 port > on my PC's. > I don't understand!!!!! What do you would to do with RXRTX without serial port??????? I thought that you have USB-RS232 dongle or somewhat with FT232R and VCP driver <<<--- this kind of driver is needed for RS232 operation. In my Linux Ubuntu Linux"VCP" (VCP is WIndows name) software for FTDI chips is embedded in install package. On FTDI site are Linux sources as well (or link). Mariusz Dec > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 15:11 +0100, Mariusz Dec wrote: > > Look for my example in November "RXTX close problem solved" and do a > > short cicuit on the DB9 - 2 with 3. > > Rgds > > mdec > > > > > > > > 2010/3/3 Wido den Hollander > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt > > using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and > > the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by > > sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends > > this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net > > application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a > > problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i > > don't have > > two PC's with a serial port, these days they don't ship PC's > > with a > > serialport anymore, that's why i'm using the USB to Serial > > converter. > > > > And i can verify that the .Net application is working fine, > > next to me > > is the hardware and i can see the LED's lighting up when i hit > > "start" > > on the app. > > > > I'm still using PortMon since this seems the best application > > to monitor > > a local COM port when you don't have the luxury to hook up two > > PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i > > need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy > > at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the > > protocol. > > > > > > This is very dangerous idea to use software flow control if > > you are > > > transferring 8 bit binary, and you arn't sure that this may > > be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with > > cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works > > for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TwoWaySerialCommMd.zip Type: application/zip Size: 2419 bytes Desc: not available URL: From andy at g0poy.com Wed Mar 3 10:16:17 2010 From: andy at g0poy.com (Andy Eskelson) Date: Wed, 3 Mar 2010 17:16:17 +0000 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267622337.2796.19.camel@wido-desktop> References: <20100302172314.615d56c9@workstation.site> <73a89f361003021125x571b6f5p90a6cb4515f89d8@mail.gmail.com> <1267622337.2796.19.camel@wido-desktop> Message-ID: <20100303171617.54fe31cd@workstation.site> As with any comms protocol, you have to get the parameters correct. The Java setup for EOF, Xon Xoff is wrong. You have a working system, (the .net) so use the same settings. However, you are apparently not using any of the codes, I cannot see them being sent from your listings. So the first thing to do is verify that the setup code you have is correct. You also appeared to be sending the same command sequence several times. Was that just you trying several times? or did the apps send the command more than once. the traces show the .net sending the data twice, and the java 4 times. Create a binary file of the code you want to send, and then use teraterm to send that to the game control box. If that does the job then you have the correct code and the problem is within your java app. If the code does not work then perhaps you don't have the correct code (a bit unlikely but it could happen) Use VSPE and set up a couple of virtual com ports connected to each other (not quite as useful as a spare machine, but it does a good job) You can also use VSPE's port monitoring as another check. Do note that you can only monitor in one direction at a time Point the .net app at one, and teraterm at the other, make sure you have the settings correct, (4800 8N1 and then use teraterm to capture the output of the .net app. Close the capture and then examine it with a hex editor. That should confirm what is going on. You can use the same method to capture the output of your java app, the two captured files should be the same. You could also send that captured file to the game controller via teraterm and that should trigger the reset. (this should be exactly the same as sending the binary file suggested above) If this does not trigger the game controller, it may be that you have missed some other setup codes. i.e. there may be a sequence that puts the controller into command mode. Or perhaps a whole sequence of commands that initialise the controller. Once you verify that the codes are correct, you will at least know that the problem is in the app. Hope this helps a bit. Andy On Wed, 03 Mar 2010 14:18:57 +0100 Wido den Hollander wrote: > Hi Andy and Mariusz, > > Thank you for your input! > > I've made three screenshots of the Windows envirionment (stopt using > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > As you can see, they both run on the Windows machine and the .Net > application is working. > > Now, i'm interested in starting a game, this is done by sending: > > EE FF FF 00 01 11 01 01 00 EE CC > > As far as i can tell my Java application (also attached) sends this > correctly and both the parity and baudrate are OK. > > Don't mind the first data (length 10) send by the .Net application, this > is for requestion scores, not needed before starting a game. > > Now before i keep searching and searching: Could this be a problem with > the EOF, ERR or any of those settings? > > I've tried the programs from Andy, but the problem is that i don't have > two PC's with a serial port, these days they don't ship PC's with a > serialport anymore, that's why i'm using the USB to Serial converter. > > And i can verify that the .Net application is working fine, next to me > is the hardware and i can see the LED's lighting up when i hit "start" > on the app. > > I'm still using PortMon since this seems the best application to monitor > a local COM port when you don't have the luxury to hook up two PC's with > a null-modem cable. > > Now i'm getting paranoia, but could it be a feature that i need which is > not supported by RXTX? > > Any help is really appreciated since this is driving me crazy at the > moment :-) > > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > Hi, > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > This is very dangerous idea to use software flow control if you are > > transferring 8 bit binary, and you arn't sure that this may be NOT > > ONLY 7-bit ASCII data in transmission stream. > > > > And FIRST OFF ALL in this case: > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > transmission speed for simple 'ABCDEF'. > > > > Posts many hours later.... > > Do you did that? > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > GOOD in Win/Mac/Linux. > > I am almost 100% sure that from this side everything is ok. > > > > Regards > > Mariusz > > > > From wido at pcextreme.nl Wed Mar 3 11:49:20 2010 From: wido at pcextreme.nl (=?windows-1252?Q?Wido_den_Hollander?=) Date: Wed, 3 Mar 2010 19:49:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <20100303171617.54fe31cd@workstation.site> References: <20100303171617.54fe31cd@workstation.site> Message-ID: Hi Andy, Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. Source: http://java.sun.com/products/javacomm/reference/api/index.html I've tried "setFlowControlMode" but that didn't seem to work either. Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. Thank you again for your input! I hope i'll find it soon. Wido -----Original message----- From: Andy Eskelson Sent: Wed 03-03-2010 18:27 To: rxtx at qbang.org; Subject: Re: [Rxtx] Writing Hex data to the Serial port > > As with any comms protocol, you have to get the parameters correct. The > Java setup for EOF, Xon Xoff is wrong. > You have a working system, (the .net) so use the same settings. > > > However, you are apparently not using any of the codes, I cannot see them > being sent from your listings. So the first thing to do is verify that > the setup code you have is correct. > > > You also appeared to be sending the same command sequence several times. > Was that just you trying several times? or did the apps send the command > more than once. the traces show the .net sending the data twice, and the > java 4 times. > > > Create a binary file of the code you want to send, and then use teraterm > to send that to the game control box. If that does the job then you have > the correct code and the problem is within your java app. > > If the code does not work then perhaps you don't have the correct code (a > bit unlikely but it could happen) > > Use VSPE and set up a couple of virtual com ports connected to each other > (not quite as useful as a spare machine, but it does a good job) > You can also use VSPE's port monitoring as another check. Do note that > you can only monitor in one direction at a time > > Point the .net app at one, and teraterm at the other, make sure you have > the settings correct, (4800 8N1 and then use teraterm to capture the > output of the .net app. > > Close the capture and then examine it with a hex editor. > > That should confirm what is going on. > > > You can use the same method to capture the output of your java app, the > two captured files should be the same. > > > You could also send that captured file to the game controller via teraterm > and that should trigger the reset. (this should be exactly the same as > sending the binary file suggested above) > > > If this does not trigger the game controller, it may be that you have > missed some other setup codes. i.e. there may be a sequence that puts the > controller into command mode. Or perhaps a whole sequence of commands > that initialise the controller. > > Once you verify that the codes are correct, you will at least know that > the problem is in the app. > > > Hope this helps a bit. > > Andy > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > Wido den Hollander wrote: > > > Hi Andy and Mariusz, > > > > Thank you for your input! > > > > I've made three screenshots of the Windows envirionment (stopt using > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > As you can see, they both run on the Windows machine and the .Net > > application is working. > > > > Now, i'm interested in starting a game, this is done by sending: > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > As far as i can tell my Java application (also attached) sends this > > correctly and both the parity and baudrate are OK. > > > > Don't mind the first data (length 10) send by the .Net application, this > > is for requestion scores, not needed before starting a game. > > > > Now before i keep searching and searching: Could this be a problem with > > the EOF, ERR or any of those settings? > > > > I've tried the programs from Andy, but the problem is that i don't have > > two PC's with a serial port, these days they don't ship PC's with a > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > And i can verify that the .Net application is working fine, next to me > > is the hardware and i can see the LED's lighting up when i hit "start" > > on the app. > > > > I'm still using PortMon since this seems the best application to monitor > > a local COM port when you don't have the luxury to hook up two PC's with > > a null-modem cable. > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > not supported by RXTX? > > > > Any help is really appreciated since this is driving me crazy at the > > moment :-) > > > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > Hi, > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > This is very dangerous idea to use software flow control if you are > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > And FIRST OFF ALL in this case: > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > transmission speed for simple 'ABCDEF'. > > > > > > Posts many hours later.... > > > Do you did that? > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > GOOD in Win/Mac/Linux. > > > I am almost 100% sure that from this side everything is ok. > > > > > > Regards > > > Mariusz > > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Thu Mar 4 01:02:35 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:02:35 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) References: <20100303171617.54fe31cd@workstation.site> Message-ID: <1267689755.2656.9.camel@wido-desktop> Hi, It's still keeping me busy and i think i'm running into a problem with RXTX. I told Andy in a mail directly to him that i'm working wireless, that's not the fact here, in the production setup it uses wireless RS232, but right now i'm using a USB cable, see: http://zooi.widodh.nl/rxtx/20100304_001.jpg Yeseterday evening i found the non-free tool Serial Port Monitor, see this screenshot: http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png Now, that is working! I hear the relais clicking and the game is starting. So on my Windows platform: * .Net application: Works * Java application: Does not work * Serial Port Monitor: Works Now the problem remains with the Java application, while other software on the same peace of hardware and OS are working (using them concurrent here). As you can see, the difference stays the EOF, XON and XOFF. I have been playing with a lot of Java settings, but i can't seem to be able to edit these variables. Could it be that this is not supported by RXTX? Of could i be hitting a bug here? It confuses me that the other applications are all working and that Java/RXTX keeps giving problems while everything seems fine. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > Hi Andy, > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > I've tried "setFlowControlMode" but that didn't seem to work either. > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > Thank you again for your input! I hope i'll find it soon. > > Wido > > -----Original message----- > From: Andy Eskelson > Sent: Wed 03-03-2010 18:27 > To: rxtx at qbang.org; > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > As with any comms protocol, you have to get the parameters correct. The > > Java setup for EOF, Xon Xoff is wrong. > > You have a working system, (the .net) so use the same settings. > > > > > > However, you are apparently not using any of the codes, I cannot see them > > being sent from your listings. So the first thing to do is verify that > > the setup code you have is correct. > > > > > > You also appeared to be sending the same command sequence several times. > > Was that just you trying several times? or did the apps send the command > > more than once. the traces show the .net sending the data twice, and the > > java 4 times. > > > > > > Create a binary file of the code you want to send, and then use teraterm > > to send that to the game control box. If that does the job then you have > > the correct code and the problem is within your java app. > > > > If the code does not work then perhaps you don't have the correct code (a > > bit unlikely but it could happen) > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > (not quite as useful as a spare machine, but it does a good job) > > You can also use VSPE's port monitoring as another check. Do note that > > you can only monitor in one direction at a time > > > > Point the .net app at one, and teraterm at the other, make sure you have > > the settings correct, (4800 8N1 and then use teraterm to capture the > > output of the .net app. > > > > Close the capture and then examine it with a hex editor. > > > > That should confirm what is going on. > > > > > > You can use the same method to capture the output of your java app, the > > two captured files should be the same. > > > > > > You could also send that captured file to the game controller via teraterm > > and that should trigger the reset. (this should be exactly the same as > > sending the binary file suggested above) > > > > > > If this does not trigger the game controller, it may be that you have > > missed some other setup codes. i.e. there may be a sequence that puts the > > controller into command mode. Or perhaps a whole sequence of commands > > that initialise the controller. > > > > Once you verify that the codes are correct, you will at least know that > > the problem is in the app. > > > > > > Hope this helps a bit. > > > > Andy > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > Wido den Hollander wrote: > > > > > Hi Andy and Mariusz, > > > > > > Thank you for your input! > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > As you can see, they both run on the Windows machine and the .Net > > > application is working. > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > As far as i can tell my Java application (also attached) sends this > > > correctly and both the parity and baudrate are OK. > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > is for requestion scores, not needed before starting a game. > > > > > > Now before i keep searching and searching: Could this be a problem with > > > the EOF, ERR or any of those settings? > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > two PC's with a serial port, these days they don't ship PC's with a > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > And i can verify that the .Net application is working fine, next to me > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > on the app. > > > > > > I'm still using PortMon since this seems the best application to monitor > > > a local COM port when you don't have the luxury to hook up two PC's with > > > a null-modem cable. > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > not supported by RXTX? > > > > > > Any help is really appreciated since this is driving me crazy at the > > > moment :-) > > > > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > Hi, > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > And FIRST OFF ALL in this case: > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > Posts many hours later.... > > > > Do you did that? > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > GOOD in Win/Mac/Linux. > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > Regards > > > > Mariusz > > > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 01:15:24 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 11:15:24 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267689755.2656.9.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> Message-ID: Hi! Wido den Hollander wrote: > Hi, > > It's still keeping me busy and i think i'm running into a problem with > RXTX. Did you also try Sun Comm API implementation? > > I told Andy in a mail directly to him that i'm working wireless, that's > not the fact here, in the production setup it uses wireless RS232, but > right now i'm using a USB cable, see: > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > Yesterday evening i found the non-free tool Serial Port Monitor, see > this screenshot: > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > Now, that is working! I hear the relais clicking and the game is > starting. > > So on my Windows platform: > > * .Net application: Works > * Java application: Does not work > * Serial Port Monitor: Works > > Now the problem remains with the Java application, while other software > on the same peace of hardware and OS are working (using them concurrent > here). > > As you can see, the difference stays the EOF, XON and XOFF. > > I have been playing with a lot of Java settings, but i can't seem to be > able to edit these variables. > > Could it be that this is not supported by RXTX? Of could i be hitting a > bug here? > > It confuses me that the other applications are all working and that > Java/RXTX keeps giving problems while everything seems fine. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > Hi Andy, > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > Thank you again for your input! I hope i'll find it soon. > > > > Wido > > > > -----Original message----- > > From: Andy Eskelson > > Sent: Wed 03-03-2010 18:27 > > To: rxtx at qbang.org; > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > Java setup for EOF, Xon Xoff is wrong. > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > being sent from your listings. So the first thing to do is verify that > > > the setup code you have is correct. > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > Was that just you trying several times? or did the apps send the command > > > more than once. the traces show the .net sending the data twice, and the > > > java 4 times. > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > to send that to the game control box. If that does the job then you have > > > the correct code and the problem is within your java app. > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > bit unlikely but it could happen) > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > (not quite as useful as a spare machine, but it does a good job) > > > You can also use VSPE's port monitoring as another check. Do note that > > > you can only monitor in one direction at a time > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > output of the .net app. > > > > > > Close the capture and then examine it with a hex editor. > > > > > > That should confirm what is going on. > > > > > > > > > You can use the same method to capture the output of your java app, the > > > two captured files should be the same. > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > and that should trigger the reset. (this should be exactly the same as > > > sending the binary file suggested above) > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > controller into command mode. Or perhaps a whole sequence of commands > > > that initialise the controller. > > > > > > Once you verify that the codes are correct, you will at least know that > > > the problem is in the app. > > > > > > > > > Hope this helps a bit. > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > Wido den Hollander wrote: > > > > > > > Hi Andy and Mariusz, > > > > > > > > Thank you for your input! > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > application is working. > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > correctly and both the parity and baudrate are OK. > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > is for requestion scores, not needed before starting a game. > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > the EOF, ERR or any of those settings? > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > on the app. > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > a null-modem cable. > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > not supported by RXTX? > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > moment :-) > > > > > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > Hi, > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > Posts many hours later.... > > > > > Do you did that? > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > GOOD in Win/Mac/Linux. > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > Regards > > > > > Mariusz > > > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From David.Escalona at digi.com Thu Mar 4 01:24:08 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 09:24:08 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Hello, I am developing an application in java that writes data to an USB port mapped as serial port using Rxtx library. I am experimenting some JVM crashes randomly while writing the data, and don't understand the reason. Here is a crash log so you can take a look and give me any clue. Regards. -- David Escalona -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hs_err_pid2932.log Type: application/octet-stream Size: 12565 bytes Desc: hs_err_pid2932.log URL: From wido at pcextreme.nl Thu Mar 4 01:43:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 09:43:23 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> Message-ID: <1267692203.2656.27.camel@wido-desktop> Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From David.Escalona at digi.com Thu Mar 4 02:04:24 2010 From: David.Escalona at digi.com (Escalona, David) Date: Thu, 4 Mar 2010 10:04:24 +0100 Subject: [Rxtx] Unnexplicable and random JVM crashes while writing to port. In-Reply-To: <1267692203.2656.27.camel@wido-desktop> References: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCA@dor-sms-exch01.digi.com> <1267692203.2656.27.camel@wido-desktop> Message-ID: <1FD68CB59C3190408725722FDA3E2C7301580D92DDCB@dor-sms-exch01.digi.com> Hello, I am using RxTx 2.1.7.4, which is the one with Eclipse plugins in the web. We would like to upgrade to 2.2 but have not found eclipse plugins compiled for that version yet. -- David Escalona -----Original Message----- From: Wido den Hollander [mailto:wido at pcextreme.nl] Sent: Thursday, March 04, 2010 09:43 To: Escalona, David Cc: 'rxtx at qbang.org' Subject: Re: [Rxtx] Unnexplicable and random JVM crashes while writing to port. Hi David, Which version of RXTX are you using? I experienced the same with RXTX 2.1, after upgrading to version 2.2 the crashes where gone. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 09:24 +0100, Escalona, David wrote: > Hello, I am developing an application in java that writes data to an > USB port mapped as serial port using Rxtx library. I am experimenting > some JVM crashes randomly while writing the data, and don?t understand > the reason. Here is a crash log so you can take a look and give me > any clue. > > > > Regards. > > -- > > David Escalona > > > > From wido at pcextreme.nl Thu Mar 4 03:10:23 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Thu, 04 Mar 2010 11:10:23 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: References: <1267689755.2656.9.camel@wido-desktop> Message-ID: <1267697423.2656.33.camel@wido-desktop> Hi, Well, yes. I just got the original win32comm.dll working and it seems to be working just fine? I'm really stunned here, a dll from 2002 is working fine right now? My Java app is now working on Windows, Linux is still a problem. Really weird.. I'll search for a answer somewhere, because there has to be a reason why it isn't working with RXTX. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > Hi! > Wido den Hollander wrote: > > Hi, > > > > It's still keeping me busy and i think i'm running into a problem with > > RXTX. > > Did you also try Sun Comm API implementation? > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > not the fact here, in the production setup it uses wireless RS232, but > > right now i'm using a USB cable, see: > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > this screenshot: > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > Now, that is working! I hear the relais clicking and the game is > > starting. > > > > So on my Windows platform: > > > > * .Net application: Works > > * Java application: Does not work > > * Serial Port Monitor: Works > > > > Now the problem remains with the Java application, while other software > > on the same peace of hardware and OS are working (using them concurrent > > here). > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > I have been playing with a lot of Java settings, but i can't seem to be > > able to edit these variables. > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > bug here? > > > > It confuses me that the other applications are all working and that > > Java/RXTX keeps giving problems while everything seems fine. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > Hi Andy, > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > Wido > > > > > > -----Original message----- > > > From: Andy Eskelson > > > Sent: Wed 03-03-2010 18:27 > > > To: rxtx at qbang.org; > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > Java setup for EOF, Xon Xoff is wrong. > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > being sent from your listings. So the first thing to do is verify that > > > > the setup code you have is correct. > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > Was that just you trying several times? or did the apps send the command > > > > more than once. the traces show the .net sending the data twice, and the > > > > java 4 times. > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > to send that to the game control box. If that does the job then you have > > > > the correct code and the problem is within your java app. > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > bit unlikely but it could happen) > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > (not quite as useful as a spare machine, but it does a good job) > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > you can only monitor in one direction at a time > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > output of the .net app. > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > two captured files should be the same. > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > and that should trigger the reset. (this should be exactly the same as > > > > sending the binary file suggested above) > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > that initialise the controller. > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > the problem is in the app. > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > Wido den Hollander wrote: > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > Thank you for your input! > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > application is working. > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > on the app. > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > a null-modem cable. > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > not supported by RXTX? > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > moment :-) > > > > > > > > > > > > > > > -- > > > > > Met vriendelijke groet, > > > > > > > > > > Wido den Hollander > > > > > Hoofd Systeembeheer / CSO > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > Fax: +31 (0)20 50 60 111 > > > > > E-mail: support at pcextreme.nl > > > > > Website: http://www.pcextreme.nl > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > Hi, > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > Posts many hours later.... > > > > > > Do you did that? > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > GOOD in Win/Mac/Linux. > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > Regards > > > > > > Mariusz > > > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > From ivmai at mail.ru Thu Mar 4 03:20:28 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Thu, 04 Mar 2010 13:20:28 +0300 Subject: [Rxtx] =?utf-8?q?Writing_Hex_data_to_the_Serial_port_=28Could_it_?= =?utf-8?q?be_a_bug=3F=29?= In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267697423.2656.33.camel@wido-desktop> Message-ID: Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? It's interesting to debug two variants of your app (with rxtx and sun comm) and find out why rxtx isn't working in your case. > > My Java app is now working on Windows, Linux is still a problem. You mean Sun Comm API for Windows works for you unlike Sun Comm API for Linux, right? > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > From andy at g0poy.com Thu Mar 4 03:53:32 2010 From: andy at g0poy.com (Andy Eskelson) Date: Thu, 4 Mar 2010 10:53:32 +0000 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <1267697423.2656.33.camel@wido-desktop> References: <1267689755.2656.9.camel@wido-desktop> <1267697423.2656.33.camel@wido-desktop> Message-ID: <20100304105332.6ffb858d@workstation.site> Don't forget that on many Linux distros that the permissions on /dev/ttyUSBn devices don't normally allow for user access. Andy On Thu, 04 Mar 2010 11:10:23 +0100 Wido den Hollander wrote: > Hi, > > Well, yes. I just got the original win32comm.dll working and it seems to > be working just fine? > > I'm really stunned here, a dll from 2002 is working fine right now? > > My Java app is now working on Windows, Linux is still a problem. > > Really weird.. I'll search for a answer somewhere, because there has to > be a reason why it isn't working with RXTX. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > Hi! > > Wido den Hollander wrote: > > > Hi, > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > RXTX. > > > > Did you also try Sun Comm API implementation? > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > not the fact here, in the production setup it uses wireless RS232, but > > > right now i'm using a USB cable, see: > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > this screenshot: > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > Now, that is working! I hear the relais clicking and the game is > > > starting. > > > > > > So on my Windows platform: > > > > > > * .Net application: Works > > > * Java application: Does not work > > > * Serial Port Monitor: Works > > > > > > Now the problem remains with the Java application, while other software > > > on the same peace of hardware and OS are working (using them concurrent > > > here). > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > able to edit these variables. > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > bug here? > > > > > > It confuses me that the other applications are all working and that > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > -- > > > Met vriendelijke groet, > > > > > > Wido den Hollander > > > Hoofd Systeembeheer / CSO > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > Fax: +31 (0)20 50 60 111 > > > E-mail: support at pcextreme.nl > > > Website: http://www.pcextreme.nl > > > Kennisbank: http://support.pcextreme.nl/ > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > Hi Andy, > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > Wido > > > > > > > > -----Original message----- > > > > From: Andy Eskelson > > > > Sent: Wed 03-03-2010 18:27 > > > > To: rxtx at qbang.org; > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > being sent from your listings. So the first thing to do is verify that > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > Was that just you trying several times? or did the apps send the command > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > java 4 times. > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > to send that to the game control box. If that does the job then you have > > > > > the correct code and the problem is within your java app. > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > bit unlikely but it could happen) > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > you can only monitor in one direction at a time > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > output of the .net app. > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > two captured files should be the same. > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > that initialise the controller. > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > the problem is in the app. > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > Wido den Hollander wrote: > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > application is working. > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > on the app. > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > a null-modem cable. > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > not supported by RXTX? > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > moment :-) > > > > > > > > > > > > > > > > > > -- > > > > > > Met vriendelijke groet, > > > > > > > > > > > > Wido den Hollander > > > > > > Hoofd Systeembeheer / CSO > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > E-mail: support at pcextreme.nl > > > > > > Website: http://www.pcextreme.nl > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > Hi, > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > Do you did that? > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > Regards > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > Rxtx mailing list > > > > > Rxtx at qbang.org > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > _______________________________________________ > > > Rxtx mailing list > > > Rxtx at qbang.org > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From sandmankz at yahoo.com Thu Mar 4 12:51:47 2010 From: sandmankz at yahoo.com (Elliott Park) Date: Thu, 4 Mar 2010 11:51:47 -0800 (PST) Subject: [Rxtx] Not reading any responses Message-ID: <185998.17702.qm@web112002.mail.gq1.yahoo.com> Hi, everyone. I'm new to rxtx, and I'm having a weird problem. I've been trying to send AT commands to my phone and read its responses. I copied some sample code from another forum, corrected it a bit and started playing around with it. At first everything worked fine. I took about a month off this project, during which time my computer died and I upgraded to Windows 7 and had to download new drivers for my phone. Ever since then, I can't read any responses, not even on other windows machines. I was testing the program in Netbeans, but I tried running it from the command line as well. Not even python code is working for me. And none of the examples from the main rxtx site work for me.My best guess is that some other program is in the way, somehow. Why would this code work a month ago and not now? Other programs can read data from my serial ports. Please help. I'm at a loss. The code I've been using is included below: import gnu.io.*; import java.io.*; public class rxtxtest { ??? public static void main(String[] args) ??? { ??????????? try ??????????? { ??????????????? CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier("COM5"); ??????????????? System.out.println(portIdentifier.getName()); ??????????????? if(portIdentifier.isCurrentlyOwned()) ??????????????? { ??????????????????? System.out.println("Port is owned"); ??????????????? } ??????????????? else ??????????????? { ??????????????????? System.out.println("Port is not owned"); ??????????????????? try ??????????????????? { ??????????????????????? SerialPort serialPort = (SerialPort) portIdentifier.open("rxtxtest", 300); ??????????????????????? System.out.println("Name: " + serialPort.getName()); ??????????????????????? int baudRate = serialPort.getBaudRate(); ??????????????????????? System.out.println("BaudRate: " + Integer.toString(baudRate)); ??????????????????????? try ??????????????????????? { ??????????????????????????? serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); ??????????????????????????? ??????????????????????????? ??????????????????????????? try ??????????????????????????? { ??????????????????????????????? OutputStream mOutputToPort = serialPort.getOutputStream(); ??????????????????????????????? InputStream mInputFromPort = serialPort.getInputStream(); ??????????????????????????????? String mValue = "AT\r"; // AT Command ??????????????????????????????? ??????????????????????????????? System.out.println("beginning to Write " + mValue + "\r\n"); ??????????????????????????????? mOutputToPort.write(mValue.getBytes()); ??????????????????????????????? mOutputToPort.flush(); ??????????????????????????????? System.out.println("Waiting for Reply \r\n"); ??????????????????????????????? try ??????????????????????????????? { ??????????????????????????????????? Thread.sleep(500); ??????????????????????????????????? byte mBytesIn [] = new byte[20]; ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? mInputFromPort.read(mBytesIn); ??????????????????????????????????? String value = new String(mBytesIn); ??????????????????????????????????? System.out.println("Response from Serial Device: "+value); ??????????????????????????????????? mOutputToPort.close(); ??????????????????????????????????? mInputFromPort.close(); ??????????????????????????????????? ??????????????????????????????? } ??????????????????????????????? catch (InterruptedException ex) ??????????????????????????????? { ??????????????????????????????????? System.out.println(ex.getMessage()); ??????????????????????????????? } ?????????????????????????????????? ??????????????????????????????? serialPort.close(); ??????????????????????????? } ??????????????????????????? catch(IOException ex) ??????????????????????????? { ??????????????????????????????? System.out.println("IOException" + ex.getMessage()); ??????????????????????????? } ??????????????????????? } ??????????????????????? catch (UnsupportedCommOperationException ex) ??????????????????????? { ??????????????????????????? System.out.println("UnsupportedCommOperationException " + ex.getMessage()); ??????????????????????? } ??????????????????????? ??????????????????? } ??????????????????? catch(PortInUseException ex) ??????????????????? { ??????????????????????? System.out.println("Port in use"); ??????????????????? } ??????????????? } ??????????? } catch (NoSuchPortException ex) ??????????? { ??????????????? System.out.println("Exception: NoSuchPortException " + ex.getMessage()); ??????????? } ??????? } ? } -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Fri Mar 5 03:11:20 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Fri, 05 Mar 2010 11:11:20 +0100 Subject: [Rxtx] Writing Hex data to the Serial port (Could it be a bug?) In-Reply-To: <20100304105332.6ffb858d@workstation.site> References: <1267697423.2656.33.camel@wido-desktop> <20100304105332.6ffb858d@workstation.site> Message-ID: <1267783880.2704.2.camel@wido-desktop> Hi Andy, Yes, i'm aware of that. I think it was not RXTX to blame, but a bug in de C code on the receiver side. Don't know what it exactly was, but that's what i heard of the programmer. It works now, thank you all! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Thu, 2010-03-04 at 10:53 +0000, Andy Eskelson wrote: > Don't forget that on many Linux distros that the permissions > on /dev/ttyUSBn devices don't normally allow for user access. > > Andy > > > On Thu, 04 Mar 2010 11:10:23 +0100 > Wido den Hollander wrote: > > > Hi, > > > > Well, yes. I just got the original win32comm.dll working and it seems to > > be working just fine? > > > > I'm really stunned here, a dll from 2002 is working fine right now? > > > > My Java app is now working on Windows, Linux is still a problem. > > > > Really weird.. I'll search for a answer somewhere, because there has to > > be a reason why it isn't working with RXTX. > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > On Thu, 2010-03-04 at 08:15 +0000, Ivan Maidanski wrote: > > > Hi! > > > Wido den Hollander wrote: > > > > Hi, > > > > > > > > It's still keeping me busy and i think i'm running into a problem with > > > > RXTX. > > > > > > Did you also try Sun Comm API implementation? > > > > > > > > > > > I told Andy in a mail directly to him that i'm working wireless, that's > > > > not the fact here, in the production setup it uses wireless RS232, but > > > > right now i'm using a USB cable, see: > > > > http://zooi.widodh.nl/rxtx/20100304_001.jpg > > > > > > > > Yesterday evening i found the non-free tool Serial Port Monitor, see > > > > this screenshot: > > > > http://zooi.widodh.nl/rxtx/serial_port_monitor_works.png > > > > > > > > Now, that is working! I hear the relais clicking and the game is > > > > starting. > > > > > > > > So on my Windows platform: > > > > > > > > * .Net application: Works > > > > * Java application: Does not work > > > > * Serial Port Monitor: Works > > > > > > > > Now the problem remains with the Java application, while other software > > > > on the same peace of hardware and OS are working (using them concurrent > > > > here). > > > > > > > > As you can see, the difference stays the EOF, XON and XOFF. > > > > > > > > I have been playing with a lot of Java settings, but i can't seem to be > > > > able to edit these variables. > > > > > > > > Could it be that this is not supported by RXTX? Of could i be hitting a > > > > bug here? > > > > > > > > It confuses me that the other applications are all working and that > > > > Java/RXTX keeps giving problems while everything seems fine. > > > > > > > > -- > > > > Met vriendelijke groet, > > > > > > > > Wido den Hollander > > > > Hoofd Systeembeheer / CSO > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > Fax: +31 (0)20 50 60 111 > > > > E-mail: support at pcextreme.nl > > > > Website: http://www.pcextreme.nl > > > > Kennisbank: http://support.pcextreme.nl/ > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > On Wed, 2010-03-03 at 18:49 +0000, Wido den Hollander wrote: > > > > > Hi Andy, > > > > > > > > > > Yes, i'm aware of the fact that some settings are not the same, like EOF, Xon en Xoff, but with RXTX i can't find a way to set those settings. > > > > > > > > > > Source: http://java.sun.com/products/javacomm/reference/api/index.html > > > > > > > > > > I've tried "setFlowControlMode" but that didn't seem to work either. > > > > > > > > > > Right now i'm trying to make the bridge with VSPE and capture the ourput with terraterm. > > > > > > > > > > Thank you again for your input! I hope i'll find it soon. > > > > > > > > > > Wido > > > > > > > > > > -----Original message----- > > > > > From: Andy Eskelson > > > > > Sent: Wed 03-03-2010 18:27 > > > > > To: rxtx at qbang.org; > > > > > Subject: Re: [Rxtx] Writing Hex data to the Serial port > > > > > > > > > > > > > > > > > As with any comms protocol, you have to get the parameters correct. The > > > > > > Java setup for EOF, Xon Xoff is wrong. > > > > > > You have a working system, (the .net) so use the same settings. > > > > > > > > > > > > > > > > > > However, you are apparently not using any of the codes, I cannot see them > > > > > > being sent from your listings. So the first thing to do is verify that > > > > > > the setup code you have is correct. > > > > > > > > > > > > > > > > > > You also appeared to be sending the same command sequence several times. > > > > > > Was that just you trying several times? or did the apps send the command > > > > > > more than once. the traces show the .net sending the data twice, and the > > > > > > java 4 times. > > > > > > > > > > > > > > > > > > Create a binary file of the code you want to send, and then use teraterm > > > > > > to send that to the game control box. If that does the job then you have > > > > > > the correct code and the problem is within your java app. > > > > > > > > > > > > If the code does not work then perhaps you don't have the correct code (a > > > > > > bit unlikely but it could happen) > > > > > > > > > > > > Use VSPE and set up a couple of virtual com ports connected to each other > > > > > > (not quite as useful as a spare machine, but it does a good job) > > > > > > You can also use VSPE's port monitoring as another check. Do note that > > > > > > you can only monitor in one direction at a time > > > > > > > > > > > > Point the .net app at one, and teraterm at the other, make sure you have > > > > > > the settings correct, (4800 8N1 and then use teraterm to capture the > > > > > > output of the .net app. > > > > > > > > > > > > Close the capture and then examine it with a hex editor. > > > > > > > > > > > > That should confirm what is going on. > > > > > > > > > > > > > > > > > > You can use the same method to capture the output of your java app, the > > > > > > two captured files should be the same. > > > > > > > > > > > > > > > > > > You could also send that captured file to the game controller via teraterm > > > > > > and that should trigger the reset. (this should be exactly the same as > > > > > > sending the binary file suggested above) > > > > > > > > > > > > > > > > > > If this does not trigger the game controller, it may be that you have > > > > > > missed some other setup codes. i.e. there may be a sequence that puts the > > > > > > controller into command mode. Or perhaps a whole sequence of commands > > > > > > that initialise the controller. > > > > > > > > > > > > Once you verify that the codes are correct, you will at least know that > > > > > > the problem is in the app. > > > > > > > > > > > > > > > > > > Hope this helps a bit. > > > > > > > > > > > > Andy > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 03 Mar 2010 14:18:57 +0100 > > > > > > Wido den Hollander wrote: > > > > > > > > > > > > > Hi Andy and Mariusz, > > > > > > > > > > > > > > Thank you for your input! > > > > > > > > > > > > > > I've made three screenshots of the Windows envirionment (stopt using > > > > > > > Linux for now, just to be sure): http://zooi.widodh.nl/rxtx/ > > > > > > > > > > > > > > As you can see, they both run on the Windows machine and the .Net > > > > > > > application is working. > > > > > > > > > > > > > > Now, i'm interested in starting a game, this is done by sending: > > > > > > > > > > > > > > EE FF FF 00 01 11 01 01 00 EE CC > > > > > > > > > > > > > > As far as i can tell my Java application (also attached) sends this > > > > > > > correctly and both the parity and baudrate are OK. > > > > > > > > > > > > > > Don't mind the first data (length 10) send by the .Net application, this > > > > > > > is for requestion scores, not needed before starting a game. > > > > > > > > > > > > > > Now before i keep searching and searching: Could this be a problem with > > > > > > > the EOF, ERR or any of those settings? > > > > > > > > > > > > > > I've tried the programs from Andy, but the problem is that i don't have > > > > > > > two PC's with a serial port, these days they don't ship PC's with a > > > > > > > serialport anymore, that's why i'm using the USB to Serial converter. > > > > > > > > > > > > > > And i can verify that the .Net application is working fine, next to me > > > > > > > is the hardware and i can see the LED's lighting up when i hit "start" > > > > > > > on the app. > > > > > > > > > > > > > > I'm still using PortMon since this seems the best application to monitor > > > > > > > a local COM port when you don't have the luxury to hook up two PC's with > > > > > > > a null-modem cable. > > > > > > > > > > > > > > Now i'm getting paranoia, but could it be a feature that i need which is > > > > > > > not supported by RXTX? > > > > > > > > > > > > > > Any help is really appreciated since this is driving me crazy at the > > > > > > > moment :-) > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Met vriendelijke groet, > > > > > > > > > > > > > > Wido den Hollander > > > > > > > Hoofd Systeembeheer / CSO > > > > > > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > > > > > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > > > > > > Telefoon Direct: (+31) (0)20 50 60 104 > > > > > > > Fax: +31 (0)20 50 60 111 > > > > > > > E-mail: support at pcextreme.nl > > > > > > > Website: http://www.pcextreme.nl > > > > > > > Kennisbank: http://support.pcextreme.nl/ > > > > > > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > > > > > > > > > > > > > > On Tue, 2010-03-02 at 19:25 +0000, Mariusz Dec wrote: > > > > > > > > Hi, > > > > > > > > What I would like suggest is to check XON/XOFF role in the protocol. > > > > > > > > > > > > > > > > This is very dangerous idea to use software flow control if you are > > > > > > > > transferring 8 bit binary, and you arn't sure that this may be NOT > > > > > > > > ONLY 7-bit ASCII data in transmission stream. > > > > > > > > > > > > > > > > And FIRST OFF ALL in this case: > > > > > > > > SECOND TERMINAL connected THROUGH CABLE until success with cable and > > > > > > > > transmission speed for simple 'ABCDEF'. > > > > > > > > > > > > > > > > Posts many hours later.... > > > > > > > > Do you did that? > > > > > > > > > > > > > > > > BTW: FT232R is wondefull chip and drivers from FTDI works for me VERY > > > > > > > > GOOD in Win/Mac/Linux. > > > > > > > > I am almost 100% sure that from this side everything is ok. > > > > > > > > > > > > > > > > Regards > > > > > > > > Mariusz > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Rxtx mailing list > > > > > > Rxtx at qbang.org > > > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > > > > > > > _______________________________________________ > > > > Rxtx mailing list > > > > Rxtx at qbang.org > > > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From franz.lemberg at gmx.net Fri Mar 5 10:06:29 2010 From: franz.lemberg at gmx.net (Franz Lemberg) Date: Fri, 05 Mar 2010 18:06:29 +0100 Subject: [Rxtx] more than 255 serial ports on MS Windows using RXTX? Message-ID: <20100305170629.11950@gmx.net> Hi, I use the following environment: OS: Win XP RXTX: 2.1.7r2 JAVA: 1.6 and 1.5 I try to access more than 255 serial ports from one machine. The reason ist that I have to communicate with a huge number of COM-Servers (DIGI COnnect ES). These are serial to network devices. In this case 8 serial ports per COM-Server. The COM-Server are connected by using a driver called 'RealPort' provided by DIGI. This driver provides the serial ports as virtual serial ports and the number of these ports can be configured from COM1 up to COM4096. This means potential 4096 COM-Ports. Unfortunately RXTX supports only 255 COM-Ports. I looked a little bit into the source code and finde this in "RXTXCommDriver.java" in method "registerScannedPorts(int PortType)": if(osName.toLowerCase().indexOf("windows") != -1 ){ String[] temp = new String[259]; for( int i = 1; i <= 256; i++ ){ temp[i - 1] = "COM" + i; } for( int i = 1; i <= 3; i++ ){ temp[i + 255] = "LPT" + i; } CandidateDeviceNames=temp; } The limit of the array CandidateDeviceNames is the reason for the limitation. The I try to change the limit to 4096 and it works. So far so good. Then I looked into the source code of version '2.2pre2' and find the same limitation. Is there a real reason for this limitation? Is it planned in the future to remove this limitation? I hope this is not only a problem of myself because there are not so many solutions to access serial ports using java - imho only RXTX and this is pretty stable and runs without problems. best regards Franz -- GMX DSL: Internet, Telefon und Entertainment f?r nur 19,99 EUR/mtl.! http://portal.gmx.net/de/go/dsl02 From andreas.eckstein at gmx.net Sat Mar 6 15:35:48 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Sat, 06 Mar 2010 23:35:48 +0100 Subject: [Rxtx] RxTx usb support In-Reply-To: References: <4B8BBD88.4@gmx.net> Message-ID: <4B92D8C4.8080609@gmx.net> Hi Trent! On 02.03.2010 04:56, Trent Jarvi wrote: > > Hi Andreas, > > It could fit into rxtx in the sense that rxtx is a project someplace > between an API for hobbiests and an API in the JSR process. If the > native code fits into an existing open source project, it makes sense to > leverage and contribute to that project for the native portion. The native part of the my USB API is only JNI glue code and some convenience functions, no reason to have this upstream in libusb. > I think it would make more sense to keep it a seperate CVS tree/project > if kept on rxtx.org but it sounds reasonable to do if you like. Ok, cool, let's do this. I'll go over the code once more before I upload. What namespace should I use? How about gnu.io.usb? Best regards Andreas From tjarvi at qbang.org Sat Mar 6 15:42:48 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 6 Mar 2010 15:42:48 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B92D8C4.8080609@gmx.net> References: <4B8BBD88.4@gmx.net> <4B92D8C4.8080609@gmx.net> Message-ID: On Sat, 6 Mar 2010, Andreas Eckstein wrote: > Hi Trent! > > On 02.03.2010 04:56, Trent Jarvi wrote: >> >> Hi Andreas, >> >> It could fit into rxtx in the sense that rxtx is a project someplace >> between an API for hobbiests and an API in the JSR process. If the >> native code fits into an existing open source project, it makes sense to >> leverage and contribute to that project for the native portion. > > The native part of the my USB API is only JNI glue code and some convenience > functions, no reason to have this upstream in libusb. > >> I think it would make more sense to keep it a seperate CVS tree/project >> if kept on rxtx.org but it sounds reasonable to do if you like. > > Ok, cool, let's do this. I'll go over the code once more before I upload. > What namespace should I use? How about gnu.io.usb? > Sure. Contact me when you want to upload and I'll make srue that goes well. -- Trent Jarvi tjarvi at qbang.org From mariusz.dec at gmail.com Tue Mar 9 05:47:42 2010 From: mariusz.dec at gmail.com (Mariusz Dec) Date: Tue, 9 Mar 2010 13:47:42 +0100 Subject: [Rxtx] RXTX and FTDI chips Message-ID: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Hi all, Inside another thread we did a small discussion about FTDI chips. There are my favorite because of: availability in Poland, package (not QFN), price, good drivers for each Windows and Windows Servers systems, Mac and Linux.. Nothing more for sure :). Kustaa Nyholm has written about very big delay using FT232R. This is truth, but only by default! !!!!!!!! Everybody can change this parameter during installation of VCP drivers !!!!! This value is written in ftdiport.inf: [FtdiPort232.NT.HW.AddReg] ..... HKR,,"LatencyTimer",0x00010001,16 '16' means 16ms as mentioned as Kustaa, but available values are from 1 to 255. Details are inside: http://www.ftdichip.com/Documents/AppNotes/AN232B-04_DataLatencyFlow.pdf If you have drivers already installed, you may clean installation using tools from FTDI site: http://www.ftdichip.com/Resources/Utilities.htm There are utilities which may be usefull to change initial name of the USB-RS232 hardware (when self made like by myself) as well. One of my friends said me that in the past was a utility software to change this latency inside the chip but currently I can't find it (maybe in older versions). Regards Mariusz Dec -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Thu Mar 11 19:38:07 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Thu, 11 Mar 2010 18:38:07 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> References: <73a89f361003090447x1a2341a9jc7c104c433f80882@mail.gmail.com> Message-ID: <4B99A90F.2080102@gmail.com> An HTML attachment was scrubbed... URL: From ajmas at sympatico.ca Thu Mar 11 20:30:11 2010 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 11 Mar 2010 22:30:11 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: Check to see if the serial device is really in use. If you know which device (in the /dev directory) the serial port is represented by, then in then in the terminal you can use 'lsof': lsof /dev/myserialdev where myserialdev is the name of your serial device. Andr?-John On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > ---------- Forwarded message ---------- > From: Juan Vicente Lopez Gutierrez > Date: 2010/2/13 > Subject: RXTX in macmini OSX 10.5 > To: rxtx at qbang.org > > > Hello. > > My name is Juanvi and I'm from Spain. > I tried to launch a software created by me in the library CXR java to send information through the serial port and I can not make it work. In windows if I've done but not mac. I have a mac mini with OSX 10.5 and have read in the list of web mail that you CXR if you have managed to make it work on that operating system. > > I need you help me please. Do I make the mistake that shows me java: > > run: Stable Library =============================== Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad called. GENERACION CORRECTA (total time: 0 seconds) > > I do not have permission to access the serial port, do not know. > Os agradeceria much to sit down. > > A greeting and thanks. > Pardon my English. > > Juanvi. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From Kustaa.Nyholm at planmeca.com Thu Mar 11 23:42:19 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Fri, 12 Mar 2010 08:42:19 +0200 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: <4B99A90F.2080102@gmail.com> Message-ID: > What your looking for is FT_GetLatencyTimer / FT_SetLatencyTimer, 0 - 255 > byte. > > Quote : d2xx progamming pdf : > "In the FT8U232AM and FT8U245AM devices, the receive buffer timeout that is > used to flush > remaining data from the receive buffer was fixed at 16 ms. In all other FTDI > devices, this timeout is > programmable and can be set at 1 ms intervals between 2ms and 255 ms. This > allows the device > to be better optimized for protocols requiring faster response times from > short data packets." Hi thanks for posting, this is very interesting information, it appears that the FTDI support engineer that I talked to was probably right, ie my dongle has a chip where the flush timeout is fixed. Good to know that there are devices where you can set the timeout, although 2 ms can still degrade a protocol performance at high baudrates, on the other hand, I suppose that a non-high speed USB serial port dongle has an inherent limitation on how fast you can do a send/receive round trip because of the inherent 1 ms polling period. Using FT_SetLatencyTimer requires the use of JNA/JNI which has some cross platform and installation/packaging implications where as opening a serial port with Javacomm/RXTX, almost just works out of the package. I'm not sure if to be able to use FT_SetLatencyTimer needs the FTDI drivers (I suppose so), whereas I would expect the some dongles (maybe not the FTDI?) to work with the built in drivers of the OS? All good information, thanks for sharing. br Kusti From saxicek at gmail.com Fri Mar 12 02:18:58 2010 From: saxicek at gmail.com (sax) Date: Fri, 12 Mar 2010 10:18:58 +0100 Subject: [Rxtx] Native libraries in platform specific jars Message-ID: Hi, I am using rxtx as a library and currently it is not very easy to include it to other libraries. The problem is that the current distribution contains native libraries (*.dll, *.so) that are meant to be copied to JRE. I think that it would be much better to provide platform specific jars with native libraries (for example rxtx-2.1-7-win32.jar would contain files rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or maybe the second option is to provide one jar for all platform libraries and RXTXcomm.jar would open the one that is needed based on platform it runs on. I am not experienced at all in running native libraries in Java so please tell me if I am asking for nonsense. Thank you, sax -------------- next part -------------- An HTML attachment was scrubbed... URL: From hakcenter at gmail.com Fri Mar 12 19:16:43 2010 From: hakcenter at gmail.com (Curtis Hacker) Date: Fri, 12 Mar 2010 18:16:43 -0800 Subject: [Rxtx] RXTX and FTDI chips In-Reply-To: References: Message-ID: <4B9AF58B.1060101@gmail.com> An HTML attachment was scrubbed... URL: From Kustaa.Nyholm at planmeca.com Mon Mar 15 03:36:22 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 15 Mar 2010 11:36:22 +0200 Subject: [Rxtx] Virtual serial port (USB CDC ACM) timeout not working...cross posted In-Reply-To: <1080422816.3127.6.camel@localhost.localdomain> Message-ID: Hi, cross posting this as I'm not sure where to turn to for the answer. I've implemented a USB CDC ACM device which appears modem in Mac OS X (and Linux and Windows, but so far I'm concentrating on Mac OS X), in '/dev/tty.usbmodemxxx' . I open the modem, enable the timeouts and with FTDI serial port dongle, reads timeout if there is not (enough) data. However with my own device (a PIC18F4550 with my own USB CDC ACM firmware) reads block until the requested amount of bytes have been read. So this is probably my firmware. I guess this hangs (pun intended) around the fact that my firmware does not setup data and turn the IN endpoint over to the SIE unless the device has something to send. I'm not sure if the SIE responds with ACK or NACK to the host in this situation, and I'm not sure how this should be handled on the device side to get the host driver to return a timeout to the calling application. So any thought are appreciated. br Kusti From nandors125 at gmail.com Mon Mar 15 06:22:14 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Mon, 15 Mar 2010 12:22:14 +0000 Subject: [Rxtx] Problem librxtxSerial.so Mipsel Message-ID: <6b0f5ade1003150522qc42ee3ar190d61db62ffd76@mail.gmail.com> Hi. I need to use the librxtxSerial.so in my Mipsel router. But it seems there is a problem with the file in Toybox because I can't open it. My router: uname -a Linux OpenWrt 2.6.26.8 #2 Sat Mar 6 18:21:48 WET 2010 mips unknown I downloaded the file on Toybox: http://rxtx.qbang.org/ToyBox/2.1-7-build1/Linux/glibc-2.3.5/mipsel-unknown-linux-gnu/librxtxSerial.so And when I run on my PC: file librxtxSerial.so librxtxSerial.so: ELF 32-bit LSB shared object, MIPS, MIPS-I version 1 (SYSV), dynamically linked, not stripped That seems to be correct. What libraries are needed to get this working?? I can't open the library on my router. -------------- next part -------------- An HTML attachment was scrubbed... URL: From george.dma at gmail.com Mon Mar 15 08:32:45 2010 From: george.dma at gmail.com (George H) Date: Mon, 15 Mar 2010 16:32:45 +0200 Subject: [Rxtx] Ring detection on modem is not working Message-ID: Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com From andy at crowbird.com Fri Mar 12 10:26:42 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:26:42 -0500 Subject: [Rxtx] Fwd: RXTX in macmini OSX 10.5 In-Reply-To: References: <29405e5c1002130344k7ad6d21dxf38934b0989bb8c5@mail.gmail.com> <29405e5c1002131339m2059d169sdc8549ed9706a1af@mail.gmail.com> Message-ID: <6ece9bcc1003120926r3fceda8ag45ac6e0a15a57c3b@mail.gmail.com> http://rxtx.qbang.org/wiki/index.php/FAQ#On_MacOS_X_I_get_a_.27PortInUseException.27.2C_even_though_it_isn.27t.3F On MacOS X I get a 'PortInUseException', even though it isn't? Versions prior to 2.1-8 use lock files, which is not the Mac OS X way of doing things, and therefore has issues. For this reason make sure that you have version 2.1-8 or higher, which makes use of I/O Kit. At this point in time 2.1-8 is only available from CVS, in source form. See the section Retrieving Source Code, on getting the latest code - be sure to get the code from the 'gnu.io' branch. *RXTX 2.2 pre2 Binaries:* http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip On Thu, Mar 11, 2010 at 10:30 PM, Andre-John Mas wrote: > Check to see if the serial device is really in use. If you know which > device (in the /dev directory) the serial port is represented by, then in > then in the terminal you can use 'lsof': > > lsof /dev/myserialdev > > where myserialdev is the name of your serial device. > > Andr?-John > > On 13-Feb-2010, at 16:39, Juan Vicente Lopez Gutierrez wrote: > > > > > > > ---------- Forwarded message ---------- > > From: Juan Vicente Lopez Gutierrez > > Date: 2010/2/13 > > Subject: RXTX in macmini OSX 10.5 > > To: rxtx at qbang.org > > > > > > Hello. > > > > My name is Juanvi and I'm from Spain. > > I tried to launch a software created by me in the library CXR java to > send information through the serial port and I can not make it work. In > windows if I've done but not mac. I have a mac mini with OSX 10.5 and have > read in the list of web mail that you CXR if you have managed to make it > work on that operating system. > > > > I need you help me please. Do I make the mistake that shows me java: > > > > run: Stable Library =============================== Native lib Version = > RXTX-2.1-7 Java lib Version = RXTX-2.1-7 gnu.io.PortInUseException: Unknow > Application at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354) > at TwoWaySerialComm.connect(TwoWaySerialComm.java:26) at > TwoWatSerialComm.main(TwoWaySerialComm.java:106) Experimental: JNI_OnLoad > called. GENERACION CORRECTA (total time: 0 seconds) > > > > I do not have permission to access the serial port, do not know. > > Os agradeceria much to sit down. > > > > A greeting and thanks. > > Pardon my English. > > > > Juanvi. > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andy at crowbird.com Fri Mar 12 10:59:00 2010 From: andy at crowbird.com (Andrew Kroh) Date: Fri, 12 Mar 2010 12:59:00 -0500 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: Message-ID: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Native libraries can only be loaded from JARs when you are using Java Webstart (see http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native library must be located at the root of the jar. Instead of putting the native libraries into your JDK/JRE you can specified -Djava.library.path= as an argument to the JVM when you start your application. Andrew On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > Hi, > I am using rxtx as a library and currently it is not very easy to include > it to other libraries. The problem is that the current distribution contains > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > that it would be much better to provide platform specific jars with native > libraries (for example rxtx-2.1-7-win32.jar would contain files > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > maybe the second option is to provide one jar for all platform libraries and > RXTXcomm.jar would open the one that is needed based on platform it runs on. > I am not experienced at all in running native libraries in Java so please > tell me if I am asking for nonsense. > > Thank you, > sax > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivmai at mail.ru Mon Mar 15 13:19:20 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Mon, 15 Mar 2010 22:19:20 +0300 Subject: [Rxtx] =?koi8-r?b?TmF0aXZlIGxpYnJhcmllcyBpbiBwbGF0Zm9ybSBzcGVj?= =?koi8-r?b?aWZpYyBqYXJz?= In-Reply-To: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: Fri, 12 Mar 2010 12:59:00 -0500 letter from Andrew Kroh : > Native libraries can only be loaded from JARs when you are using Java > Webstart (see > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > library must be located at the root of the jar. Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so files to temp folder before loading them). > > Instead of putting the native libraries into your JDK/JRE you can specified > -Djava.library.path= as an argument > to the JVM when you start your application. > > Andrew > > On Fri, Mar 12, 2010 at 4:18 AM, sax wrote: > > > Hi, > > I am using rxtx as a library and currently it is not very easy to include > > it to other libraries. The problem is that the current distribution contains > > native libraries (*.dll, *.so) that are meant to be copied to JRE. I think > > that it would be much better to provide platform specific jars with native > > libraries (for example rxtx-2.1-7-win32.jar would contain files > > rxtxSerial.dll and rxtxParallel.dll) which can be added to class path. Or > > maybe the second option is to provide one jar for all platform libraries and > > RXTXcomm.jar would open the one that is needed based on platform it runs on. > > I am not experienced at all in running native libraries in Java so please > > tell me if I am asking for nonsense. > > > > Thank you, > > sax From bschlining at gmail.com Mon Mar 15 14:26:56 2010 From: bschlining at gmail.com (Brian Schlining) Date: Mon, 15 Mar 2010 13:26:56 -0700 Subject: [Rxtx] Native libraries in platform specific jars In-Reply-To: References: <6ece9bcc1003120959i76484484k61671399fbb5e56d@mail.gmail.com> Message-ID: > > > > Native libraries can only be loaded from JARs when you are using Java > > Webstart (see > > > http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#resourcesand > > http://rxtx.qbang.org/wiki/index.php/WebStart). When doing so the native > > library must be located at the root of the jar. > > Not only JWS - e.g. Eclipse SWT does the same thing (by extracting .dll/so > files to temp folder before loading them). JNA can also extract and use native libraries (same as SWT), I don't know if this extraction technique works in JWS though. To see how JNA does it go to https://jna.dev.java.net/source/browse/jna/trunk/jnalib/src/com/sun/jna/Native.java?view=markup and look at the loadNativeLibrary and loadNativeLibraryFromJar methods. Cheers -- B ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining bschlining at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ravishankar.N at automotiveinfotronics.com Mon Mar 15 22:06:11 2010 From: Ravishankar.N at automotiveinfotronics.com (Ravishankar N) Date: Tue, 16 Mar 2010 09:36:11 +0530 Subject: [Rxtx] Ring detection on modem is not working Message-ID: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> ----------------------------- Message: 7 Date: Mon, 15 Mar 2010 16:32:45 +0200 From: George H To: rxtx at qbang.org Subject: [Rxtx] Ring detection on modem is not working Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Hi, I am using RXTX v2.2-pre2 I have it attached to a USB serial port /dev/ttyUSB0 which is connected to a US Robotics 5631A serial modem. I have turned on the event listener so that I can detect DATA_AVAILABLE and RI So I hook up my modem to my phone line and I execute these commands AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 OK AT+FCLASS=8 OK AT+VCID=1 OK AT+VRID=1 OK Then I call the modem and wait. The SerialPortEvent.RI is not being received... instead I am getting '.R' or 'RING' from the inputstream to detect the rings. Is this normal not to get SerialPortEvent.RI events? or am I supposed to but i'm not getting them for some reason, but I am sure an RXTX developer can explain to me :) Thank you -- George H george.dma at gmail.com ------------------------------ Hi, According to the API documentation for javax.comm (which is compatible with RxTx), SerialPort. public abstract void notifyOnRingIndicator(boolean enable) This notification is hardware dependent and may not be supported by all implementations. You may want to check if your modem supports it with SerialPort.isRI() Internally in the C library(RawImp.c), this is what is being done: //........ unsigned int result = 0; //..... ioctl( fd, TIOCMGET, &result ); if( result & TIOCM_RI ) return JNI_TRUE; else return JNI_FALSE; // Hope this helps Ravi. From andy at g0poy.com Tue Mar 16 05:27:57 2010 From: andy at g0poy.com (Andy Eskelson) Date: Tue, 16 Mar 2010 11:27:57 +0000 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> Message-ID: <20100316112757.65458aaf@workstation.site> On Tue, 16 Mar 2010 09:36:11 +0530 Ravishankar N wrote: > ----------------------------- > Message: 7 > Date: Mon, 15 Mar 2010 16:32:45 +0200 > From: George H > To: rxtx at qbang.org > Subject: [Rxtx] Ring detection on modem is not working > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I am using RXTX v2.2-pre2 > > I have it attached to a USB serial port /dev/ttyUSB0 which is > connected to a US Robotics 5631A serial modem. I have turned on the > event listener so that I can detect DATA_AVAILABLE and RI > > So I hook up my modem to my phone line and I execute these commands > > AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 > OK > AT+FCLASS=8 > OK > AT+VCID=1 > OK > AT+VRID=1 > OK > > Then I call the modem and wait. The SerialPortEvent.RI is not being > received... instead I am getting '.R' or 'RING' from the inputstream > to detect the rings. > > Is this normal not to get SerialPortEvent.RI events? or am I supposed > to but i'm not getting them for some reason, but I am sure an RXTX > developer can explain to me :) > > Thank you > -- > George H > george.dma at gmail.com > > > ------------------------------ > > Hi, > > According to the API documentation for javax.comm (which is compatible with RxTx), > > SerialPort. public abstract void notifyOnRingIndicator(boolean enable) > This notification is hardware dependent and may not be supported by all implementations. > > You may want to check if your modem supports it with > SerialPort.isRI() > > Internally in the C library(RawImp.c), this is what is being done: > > //........ > unsigned int result = 0; > //..... > ioctl( fd, TIOCMGET, &result ); > if( result & TIOCM_RI ) return JNI_TRUE; > else return JNI_FALSE; > // > > Hope this helps > > Ravi. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx Also, RING or result code 2 (I think) if you have selected codes rather than text, is the Hayes modem standard response. RI is a signal that is generated by a modem when an incoming call is detected It does this by raising pin 22 (RI) of the full serial interface RS232C, 25 way D type, as the normal PC connector is a bit lacking in pins, it's not available. The 9 way D type is only a limited subset of the full spec. So call detection has to be done in a different way. You can use the Hayes RING or result code then tell the modem to answer, or you can set the modem to auto answer and look for the CONNECT string. Andy Andy From george.dma at gmail.com Tue Mar 16 05:44:02 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 13:44:02 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <20100316112757.65458aaf@workstation.site> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> Message-ID: Hi thanks for replies. I'm in a bit of a weird situation. I am developing software on a PC that has no serial ports so I use a USB to serial port connector. The machine that will be using it has proper serial ports but its impossible to develop the program on it. And deploying the app to the target machine for a test is very time consuming.. eh not to mention its a big app. I kinda did a dirty workaround. Since in my case I am only using the modem to detect rings and show caller id, I initialize the modem synchronously then I turn on ON_DATA_AVAILABLE events. So when it rings I get ".R" line triggering a serial event. Then I can display it on the screen and the user can choose to pick up the call or wait a bit. btw. I don't know if you guys know modem stuff really well. I have a question on answering the line using the modem. I put the modem in AT+FCLASS=8 (voice) and Its connected to a telephone and the telephone to the line. When it rings the press on the application "answer" that sends "AT+VLS=1" and then they pickup the headset and talk. I seen some people using AT+VLS=0 and ATA. I don't know which one is actually better to use. Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 1:27 PM, Andy Eskelson wrote: > > > > On Tue, 16 Mar 2010 09:36:11 +0530 > Ravishankar N wrote: > >> ----------------------------- >> Message: 7 >> Date: Mon, 15 Mar 2010 16:32:45 +0200 >> From: George H >> To: rxtx at qbang.org >> Subject: [Rxtx] Ring detection on modem is not working >> Message-ID: >> ? ? ? ? >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hi, >> >> I am using RXTX v2.2-pre2 >> >> I have it attached to a USB serial port ?/dev/ttyUSB0 which is >> connected to a US Robotics 5631A serial modem. I have turned on the >> event listener so that I can detect DATA_AVAILABLE and RI >> >> So I hook up my modem to my phone line and I execute these commands >> >> AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 >> OK >> AT+FCLASS=8 >> OK >> AT+VCID=1 >> OK >> AT+VRID=1 >> OK >> >> Then I call the modem and wait. The SerialPortEvent.RI is not being >> received... instead I am getting '.R' or 'RING' from the inputstream >> to detect the rings. >> >> Is this normal not to get SerialPortEvent.RI events? or am I supposed >> to but i'm not getting them for some reason, but I am sure an RXTX >> developer can explain to me :) >> >> Thank you >> -- >> George H >> george.dma at gmail.com >> >> >> ------------------------------ >> >> Hi, >> >> According to the API documentation for javax.comm (which is compatible with RxTx), >> >> ?SerialPort. public abstract void notifyOnRingIndicator(boolean enable) >> ?This notification is hardware dependent and may not be supported by all implementations. >> >> You may want to check if your modem supports it with >> SerialPort.isRI() >> >> Internally in the C library(RawImp.c), this is what is being done: >> >> //........ >> unsigned int result = 0; >> //..... >> ioctl( fd, TIOCMGET, &result ); >> if( result & TIOCM_RI ) return JNI_TRUE; >> ? ? ? ? else return JNI_FALSE; >> // >> >> Hope this helps >> >> Ravi. >> _______________________________________________ >> Rxtx mailing list >> Rxtx at qbang.org >> http://mailman.qbang.org/mailman/listinfo/rxtx > > > > Also, RING or result code 2 (I think) if you have selected codes rather > than text, is the Hayes modem standard response. > > RI is a signal that is generated by a modem when an incoming call is > detected It does this by raising pin 22 (RI) of the full serial interface > RS232C, ?25 way D type, as the normal PC connector is a bit lacking in > pins, it's not available. The 9 way D type is only a limited subset of > the full spec. So call detection has to be done in a different way. > > You ?can use the Hayes RING or result code then tell the modem to answer, > or you can set the modem to auto answer and look for the CONNECT string. > > Andy > > > > Andy > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From mariusz.dec at gmail.com Tue Mar 16 06:06:04 2010 From: mariusz.dec at gmail.com (M.Dec-Gazeta) Date: Tue, 16 Mar 2010 13:06:04 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> Message-ID: <9EF082A64E834367AB04DF00251BB67D@mdam2> Hi George [...] Also to hangup, sending ATH doesn't completely hangup the phone, I have to close the headset to get it fully closed. Is there a command that can fully close the line? kinda like press the hungup button for a few secs without putting down the head set? Try to understand pick-up and hang-up of the phone. It works so: Your line (when not in use) is completely open (very big resistance). If you pick up phone (or modem) you make the short-circuit on the line and you have to "pull" current from the line (value depends of Telcom and country). Therefore and only from this event ("short circuit") tel exchange knows that you want to talk (except ISDN of course). If you have telephone and modem connected to one line parallely (only way to work for both devices), ther is no way to disconnect line making short-circuit off for one device only. WHY? Because disconnecting means: remove "short-circuit" from the line. Regards Mariusz Dec From george.dma at gmail.com Tue Mar 16 06:19:01 2010 From: george.dma at gmail.com (George H) Date: Tue, 16 Mar 2010 14:19:01 +0200 Subject: [Rxtx] Ring detection on modem is not working In-Reply-To: <9EF082A64E834367AB04DF00251BB67D@mdam2> References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com> <20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: Thanks Mariusz for the explanation. So I guess there is no way for me to escape this. The user has to hangup the phone and I send ATH. I thought maybe there was a special way to do it or something :) maybe I need a better telephone with bluetooth control. I just tried my modem on a machine with regular serial ports, the ring indicator didn't work. I guess this modem just doesn't support it. I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com On Tue, Mar 16, 2010 at 2:06 PM, M.Dec-Gazeta wrote: > Hi George > [...] > Also to hangup, sending ATH doesn't completely hangup the phone, I > have to close the headset to get it fully closed. Is there a command > that can fully close the line? kinda like press the hungup button for > a few secs without putting down the head set? > > > Try to understand pick-up and hang-up of the phone. > > It works so: > > Your line (when not in use) is completely open (very big resistance). > If you pick up phone (or modem) you make the short-circuit on the line and > you have to "pull" current from the line (value depends of ?Telcom and > country). > Therefore and only from this event ("short circuit") tel exchange knows that > you want to talk (except ISDN of course). > If you have telephone and modem connected to one line parallely (only way to > work for both devices), ther is no way to disconnect line making > short-circuit off for one device only. > WHY? ?Because disconnecting means: remove "short-circuit" from the line. > Regards > Mariusz Dec > > > > From mariusz.dec at gmail.com Tue Mar 16 06:42:40 2010 From: mariusz.dec at gmail.com (M.Dec-GMail) Date: Tue, 16 Mar 2010 13:42:40 +0100 Subject: [Rxtx] Ring detection on modem is not working References: <3E7F2F2A885AA84997FE3DFF6C2B101F69277B35E7@aimail.automotiveinfotronics.com><20100316112757.65458aaf@workstation.site> <9EF082A64E834367AB04DF00251BB67D@mdam2> Message-ID: <9D2E7610ADC84223A8E21E02D91AB66A@mdam2> ----- Original Message ----- From: "George H" To: "rxtx" Sent: Tuesday, March 16, 2010 1:19 PM Subject: Re: [Rxtx] Ring detection on modem is not working [..] I'll have to be more careful next time in picking a proper and good modem. -- George H george.dma at gmail.com Hi, 1. Answer UNDER posts is recommended for future readers! 2. I have seen in the past modems with output for phone (I am not using modems from couple of years) In this case you connect phone "after" the modem. Relay in the modem disconnects phone when modem picks-up the line and connects back after modem's hang-up. This is most elegant and ONLY GOOD from technical reason, way to solve conflicts between phone and modem. If you have phone "before" or parrallel to modem you may have unpredictable results of the transmissions because of phone circuits. In most cases phone needs power for work from telco line and therefore has filters in power circuit or somewhat what disturbs very well when fast transmission is going. So - generally - if you expecting good work of modem there SHOULD BE NOTHING on the line except this modem. regards Mariusz From nandors125 at gmail.com Tue Mar 16 11:07:01 2010 From: nandors125 at gmail.com (Fernando Lopes) Date: Tue, 16 Mar 2010 17:07:01 +0000 Subject: [Rxtx] Need Help Buiding RXTX uClibc OpenWrt Message-ID: <6b0f5ade1003161007u31b32d31me47ebd5c7c2cca6@mail.gmail.com> Hi! I need to build librxtxSerial against uclibc and not against gllibc like the file in Toybox. How to do this?? I am having trouble buiding rxtx from source too: /usr/lib/jvm/java-6-sun configure: WARNING: using JAVA_HOME environmental variable adjusted java.home is /usr/lib/jvm/java-6-sun checking os.name Exception in thread "main" java.lang.NoClassDefFoundError: conftest Caused by: java.lang.ClassNotFoundException: conftest at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) Could not find the main class: conftest. Program will exit. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From nsayer at kfu.com Tue Mar 16 11:31:23 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:31:23 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues Message-ID: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple loadLibrary("rxtxSerial") This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. The fix is to change the call to loadLibrary like this: boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); try { System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); } catch(UnsatisfiedLinkException ex) { System.loadLibrary("rxtxSerial"); } This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. From ivmai at mail.ru Tue Mar 16 11:36:27 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 20:36:27 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > > loadLibrary("rxtxSerial") > > This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. This was already discussed in this ML. Fetch the latest rxtx CVS. > > For one thing, os.arch on Windows is the same for 32 and 64 bits. What you're supposed to do is check the value of the "sun.arch.data.model" property for 32 vs 64 bit. This fails utterly, however, in JNLP files, since the only thing you can check against is os.name and os.arch - meaning you can only have one native lib jar, which will need to contain separate 32 and 64 bit DLLs if you want to support both. > > For Linux, you also need separate 32 and 64 bit .so files, but they both need to have the same name (lilbrxtxSerial.so). This means that they need to be kept in separate directories and a script needs to set java.library.path as appropriate for the local architecture. This is a pain in the neck. > > The fix is to change the call to loadLibrary like this: > > boolean is64bit = System.getProperty("sun.arch.data.model").contains("64"); > > try { > System.loadLibrary("rxtxSerial-" + (is64bit?"64":"32")); > } > catch(UnsatisfiedLinkException ex) { > System.loadLibrary("rxtxSerial"); > } > > This will attempt to load a specific data-model DLL/so file for those platforms where it is required (Windows and Linux), but will fall back to attempting to load a non-specific one for platforms that don't (like MacOS X, where the jnilib can be a universal binary for all 3 architectures). > > There are 3 calls to load rxtxSerial in the code. The calls in RXTXCommDriver and RXTXPort probably should be removed and replaced by some sort of check against RXTXVersion, which would do the loading. But there probably ought to be some sort of static utility method somewhere to load the other libraries (I2C, Parallel, RS485, Raw and Zystem) using this same methodology. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 11:52:42 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 10:52:42 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: <82BD6845-5294-426B-9574-C2F318266248@kfu.com> Message-ID: Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java 4c4 < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who --- > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who 467,474c467,468 < String err_msg; < try { < err_msg = native_psmisc_report_owner(PortName); < } catch (Throwable t) < { < err_msg = "Port " + PortName + " already owned... unable to open."; < } < throw new gnu.io.PortInUseException( err_msg ); --- > throw new gnu.io.PortInUseException( > native_psmisc_report_owner(PortName)); So exactly how is the latest CVS supposed to help? On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple >> >> loadLibrary("rxtxSerial") >> >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > This was already discussed in this ML. Fetch the latest rxtx CVS. > From ivmai at mail.ru Tue Mar 16 12:12:56 2010 From: ivmai at mail.ru (Ivan Maidanski) Date: Tue, 16 Mar 2010 21:12:56 +0300 Subject: [Rxtx] =?koi8-r?b?Sk5JIDMyIHZzIDY0IGJpdCBpc3N1ZXM=?= In-Reply-To: References: Message-ID: Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: > > [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. > Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS > diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java > 4c4 > < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who > --- > > | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel > 467,474c467,468 > < String err_msg; > < try { > < err_msg = native_psmisc_report_owner(PortName); > < } catch (Throwable t) > < { > < err_msg = "Port " + PortName + " already owned... unable to open."; > < } > < throw new gnu.io.PortInUseException( err_msg ); > --- > > throw new gnu.io.PortInUseException( > > native_psmisc_report_owner(PortName)); > > > So exactly how is the latest CVS supposed to help? > > On Mar 16, 2010, at 10:36 AM, Ivan Maidanski wrote: > > > > > Tue, 16 Mar 2010 10:31:23 -0700 letter from Nick Sayer : > > > >> So in the 2.2-pre-2 version of rxtx, the loadLibrary step for rxtxSerial is a simple > >> > >> loadLibrary("rxtxSerial") > >> > >> This causes problems on Linux and Windows if you want to support 32 and 64 bit architectures simultaneously. > > > > This was already discussed in this ML. Fetch the latest rxtx CVS. > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From nsayer at kfu.com Tue Mar 16 12:20:07 2010 From: nsayer at kfu.com (Nick Sayer) Date: Tue, 16 Mar 2010 11:20:07 -0700 Subject: [Rxtx] JNI 32 vs 64 bit issues In-Reply-To: References: Message-ID: <5F4EC824-E87E-4936-BA31-7B7F9EE65D72@kfu.com> On Mar 16, 2010, at 11:12 AM, Ivan Maidanski wrote: > > Tue, 16 Mar 2010 10:52:42 -0700 letter from Nick Sayer : > >> Ok, I fetched the latest rxtx CVS and here is the entire java diff between 2.2-pre2 and CVS: >> >> [mercury:src/gnu/io] nsayer% diff . ~/rxtx-2.2pre2/src/gnu/io/. >> Common subdirectories: ./CVS and /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CVS >> diff ./CommPortIdentifier.java /Users/nsayer/p4home/main/eng/thirdparty/rxtx/rxtx-2.2pre2/src/gnu/io/./CommPortIdentifier.java >> 4c4 >> < | Copyright 1997-2009 by Trent Jarvi tjarvi at qbang.org and others who >> --- >>> | Copyright 1997-2007 by Trent Jarvi tjarvi at qbang.org and others who > > This is not the right CVS version to fetch. Use this one: cvs checkout -r commapi-0-0-1 rxtx-devel That's what I did. The CVS repository listed on the wiki at qbang is dead, but searching the archives led me to :pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot And that's the EXACT cvs checkout command I executed. Perhaps it's worth updating the wiki and/or website... From damorales at gmail.com Wed Mar 17 17:37:32 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 20:37:32 -0300 Subject: [Rxtx] Cannot access to CVS Message-ID: Hi Im trying to download the latest source code of RXTX from CVS as is described here: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code but i get a time out error so i cannot download anything. Is the CVS down ? or maybe there is some change to access ? Thanks and greetings !! -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvi at qbang.org Wed Mar 17 18:36:35 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 17 Mar 2010 18:36:35 -0600 (MDT) Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > Hi > > Im trying to download the latest source code of RXTX from CVS as is described here: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code > but i get a time out error so i cannot download anything. > > Is the CVS down ? or maybe there is some change to access ? > > Thanks and greetings? !! > The problem is resolved now. Thank you for pointing this out. I notice some are trying the older cvs server at ...milestone... which is not syncronized with qbang. Daniel has the correct link. If there are references to the older CVS server, we should update them. Any info on pages referencing the older CVS server would be appreciated. -- Trent Jarvi tjarvi at qbang.org From damorales at gmail.com Wed Mar 17 19:25:50 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 22:25:50 -0300 Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: Thanks Trent, i'm downloading now from CVS. I have one question, in the link it says that there are two branches, 2.0 and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 pre2. What version is more updated ? 2.1 from CVS or 2.2 pre2 ? Thanks and greetings !!! 2010/3/17 Trent Jarvi > On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > > Hi >> >> Im trying to download the latest source code of RXTX from CVS as is >> described here: >> http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code >> but i get a time out error so i cannot download anything. >> >> Is the CVS down ? or maybe there is some change to access ? >> >> Thanks and greetings !! >> >> > The problem is resolved now. Thank you for pointing this out. I notice > some are trying the older cvs server at ...milestone... which is not > syncronized with qbang. > > Daniel has the correct link. If there are references to the older CVS > server, we should update them. Any info on pages referencing the older CVS > server would be appreciated. > > -- > Trent Jarvi > tjarvi at qbang.org -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From damorales at gmail.com Wed Mar 17 19:47:23 2010 From: damorales at gmail.com (Daniel Morales Salas) Date: Wed, 17 Mar 2010 22:47:23 -0300 Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: Never mind, i've compiled and installed rxtx-devel (gnu.io) from CVS and it is 2.2 pre2 version (native library is 2.2 pre2 too). Now my application is working perfectly. Really really thanks for the very good work. Thanks again and greetings !!! 2010/3/17 Daniel Morales Salas > Thanks Trent, i'm downloading now from CVS. > > I have one question, in the link it says that there are two branches, 2.0 > and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 > pre2. What version is more updated ? 2.1 from CVS or 2.2 pre2 ? > > Thanks and greetings !!! > > 2010/3/17 Trent Jarvi > > On Wed, 17 Mar 2010, Daniel Morales Salas wrote: >> >> Hi >>> >>> Im trying to download the latest source code of RXTX from CVS as is >>> described here: >>> http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code >>> but i get a time out error so i cannot download anything. >>> >>> Is the CVS down ? or maybe there is some change to access ? >>> >>> Thanks and greetings !! >>> >>> >> The problem is resolved now. Thank you for pointing this out. I notice >> some are trying the older cvs server at ...milestone... which is not >> syncronized with qbang. >> >> Daniel has the correct link. If there are references to the older CVS >> server, we should update them. Any info on pages referencing the older CVS >> server would be appreciated. >> >> -- >> Trent Jarvi >> tjarvi at qbang.org > > > > > -- > Atte: > Daniel Dario Morales Salas > Ingeniero Civil en Computaci?n e Inform?tica > Tel?fono: 02 684 3417 > Celular: 09 643 1802 > Santiago, Chile > -- Atte: Daniel Dario Morales Salas Ingeniero Civil en Computaci?n e Inform?tica Tel?fono: 02 684 3417 Celular: 09 643 1802 Santiago, Chile -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjarvi at qbang.org Wed Mar 17 19:22:45 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 17 Mar 2010 19:22:45 -0600 (MDT) Subject: [Rxtx] Cannot access to CVS In-Reply-To: References: Message-ID: On Wed, 17 Mar 2010, Daniel Morales Salas wrote: > Thanks Trent, i'm downloading now from CVS. > > I have one question, in the link it says that there are two branches, 2.0 and 2.1 ... what about 2.2 ??, in the download page we can download 2.2 pre2. What version is more > updated ? 2.1 from CVS or 2.2 pre2 ? > -r commapi-0-0-1 has the most current 2.2pre2 when you check it out. Older versions in that branch go back to 2.1. The default branch contains an older version of rxtx that works with Sun's SPI known as RXTX 2.0 and goes back to the Cretaceous period when dinosaurs roamed. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Mon Mar 1 06:13:44 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Mon, 01 Mar 2010 14:13:44 +0100 Subject: [Rxtx] RxTx usb support Message-ID: <4B8BBD88.4@gmx.net> Hi all! In the course of my PhD thesis, I've written some Java software for device control and data acquisition in my setup. For the serial part, naturally I used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without looking at pre-existing code, I might add). I probably won't use that in my measurement software any more, but on the other hand would not like it to go to waste, so I'd like to see it integrated into the probably most widely used java communication library (as an optional component perhaps). Once the ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all platforms that RxTx does. What the library can do right now: Create multiple USB contexts (user sessions) Enumerate USB devices Read USB device descriptors Open/release USB devices Claim/release USB interfaces Send control/bulk/interrupt transfers, blocking and non-blocking Create native watch threads to poll for completed transfers What it can't do (yet): Isosynchronous transfers Read interface/configuration descriptors Sending a reset control transfer to a USB device looks like this: UsbContext ctx = new UsbContext(); ctx.startEventHandlerThread(500); int bus=1, port=6, timeout=1000; UsbDevice dev = new UsbDevice(ctx, bus, port); dev.open(); byte[] data=null; UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); while(!ct.isDone()) { System.out.println("waiting for transfer to finish"); Thread.sleep(500); } byte[] receivedData = tr.get(); dev.close(); ctx.release(); So what do you think? Does USB access fit into the RxTx project scope? Best regards, Andreas Eckstein From Kustaa.Nyholm at planmeca.com Mon Mar 1 07:02:57 2010 From: Kustaa.Nyholm at planmeca.com (Kustaa Nyholm) Date: Mon, 1 Mar 2010 16:02:57 +0200 Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> Message-ID: > So what do you think? Does USB access fit into the RxTx project scope? I don't think rxtx should be expanded to embrace anything beyond what Javacomm 'supports'. So some other project or a new project would be better. In a way libusb project would be 'natural' place for language wrappers for libusb library. This of course reflects my view that the libusb is first and foremost a cross platform usb API which just happens to be written in C. Further in my view the Java wrapper should reflect the usblib API C API as closely as possible not to introduce object orientation to the procedural API. I've done this with libusb 0.1 using JNA, which was a trivial two hour exercise with no C code involved accross all JNA supported platforms and this approach allows leveraging on all the example code and documentation with just trivial changes. Here is what it looks like for libusb 0.1: public interface LibUSBInterface extends Library { void usb_init(); int usb_find_busses(); int usb_find_devices(); USB_bus usb_get_busses(); String usb_strerror(); USB_dev_handle usb_open(USB_device dev); int usb_close(USB_dev_handle dev); int usb_set_configuration(USB_dev_handle dev, int configuration); int usb_claim_interface(USB_dev_handle dev, int interfce); int usb_release_interface(USB_dev_handle dev, int interfce); int usb_set_altinterface(USB_dev_handle dev, int alternate); int usb_resetep(USB_dev_handle dev, int ep); int usb_clear_halt(USB_dev_handle dev, int ep); int usb_reset(USB_dev_handle dev); int usb_set_debug(int level); int usb_detach_kernel_driver_np(USB_dev_handle dev, int interfce); int usb_get_driver_np(USB_dev_handle dev, int interfce, byte[] name, int namelen); int usb_get_string(USB_dev_handle dev, int index, int langid, byte[] buf, int buflen); int usb_get_string_simple(USB_dev_handle dev, int index, byte[] buf, int buflen); int usb_get_descriptor_by_endpoint(USB_dev_handle udev, int ep, byte type, byte index, byte[] buf, int size); int usb_get_descriptor(USB_dev_handle udev, byte type, byte index, byte[] buf, int size); int usb_bulk_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_bulk_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_write(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_interrupt_read(USB_dev_handle dev, int ep, byte[] bytes, int size, int timeout); int usb_control_msg(USB_dev_handle dev, int requesttype, int request, int value, int index, byte[] bytes, int size, int timeout); } I would expect this could be done easily for 1.0 too. Doing the JNA/JNI is not the difficult part, getting a cross platform USB library is, so far only libusb 0.1 has delivered but the recent activity on 1.0 project seems very encouraging. But this is the wrong list for this sort of discussion. br Kusti From HowardZ at howardz.com Mon Mar 1 17:45:40 2010 From: HowardZ at howardz.com (HowardZ at howardz.com) Date: Mon, 01 Mar 2010 19:45:40 -0500 Subject: [Rxtx] read returns -1 ??? Message-ID: <4B8C5FB4.8090107@howardz.com> Hi, I got a new box to control via RS232. The box sends me capital Letters, digits, carriage return, and pound sign "#". As soon as the pound sign comes in, the in.read() returns -1 over and over and over again. Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? Howard From tjarvi at qbang.org Mon Mar 1 20:56:50 2010 From: tjarvi at qbang.org (Trent Jarvi) Date: Mon, 1 Mar 2010 20:56:50 -0700 (MST) Subject: [Rxtx] RxTx usb support In-Reply-To: <4B8BBD88.4@gmx.net> References: <4B8BBD88.4@gmx.net> Message-ID: On Mon, 1 Mar 2010, Andreas Eckstein wrote: > Hi all! > > In the course of my PhD thesis, I've written some Java software for device > control and data acquisition in my setup. For the serial part, naturally I > used RxTx, for the USB part I used libusbjava. Seeing that libusbjava is for > libusb-0.1.x only, I wrote a JNI wrapper for libusb-1.0 (clean-room, without > looking at pre-existing code, I might add). I probably won't use that in my > measurement software any more, but on the other hand would not like it to go > to waste, so I'd like to see it integrated into the probably most widely used > java communication library (as an optional component perhaps). Once the > ongoing Windows port of libusb-1.0 is finished, the wrapper should cover all > platforms that RxTx does. > > What the library can do right now: > > Create multiple USB contexts (user sessions) > Enumerate USB devices > Read USB device descriptors > Open/release USB devices > Claim/release USB interfaces > Send control/bulk/interrupt transfers, blocking and non-blocking > Create native watch threads to poll for completed transfers > > What it can't do (yet): > Isosynchronous transfers > Read interface/configuration descriptors > > Sending a reset control transfer to a USB device looks like this: > > UsbContext ctx = new UsbContext(); > ctx.startEventHandlerThread(500); > int bus=1, port=6, timeout=1000; > UsbDevice dev = new UsbDevice(ctx, bus, port); > dev.open(); > byte[] data=null; > UsbTransfer tr = dev.submitControlMessage(0x40, 0, 0, 0, data, timeout); > while(!ct.isDone()) > { > System.out.println("waiting for transfer to finish"); > Thread.sleep(500); > } > byte[] receivedData = tr.get(); > dev.close(); > ctx.release(); > > > So what do you think? Does USB access fit into the RxTx project scope? > Hi Andreas, It could fit into rxtx in the sense that rxtx is a project someplace between an API for hobbiests and an API in the JSR process. If the native code fits into an existing open source project, it makes sense to leverage and contribute to that project for the native portion. I think it would make more sense to keep it a seperate CVS tree/project if kept on rxtx.org but it sounds reasonable to do if you like. -- Trent Jarvi tjarvi at qbang.org From andreas.eckstein at gmx.net Tue Mar 2 03:24:11 2010 From: andreas.eckstein at gmx.net (Andreas Eckstein) Date: Tue, 02 Mar 2010 11:24:11 +0100 Subject: [Rxtx] read returns -1 ??? In-Reply-To: <4B8C5FB4.8090107@howardz.com> References: <4B8C5FB4.8090107@howardz.com> Message-ID: <4B8CE74B.6030302@gmx.net> Hi Howard! The '-1' indicates EOF for InputStream.read(). The '#' is most probably your device signalling end-of-line or end-of-transmission. Any way, there are no characters in buffer to read right now. Regards Andreas On 02.03.2010 01:45, HowardZ at howardz.com wrote: > Hi, > > I got a new box to control via RS232. > The box sends me capital Letters, digits, carriage return, and pound > sign "#". > > As soon as the pound sign comes in, the in.read() returns -1 over and > over and over again. > > Is rxtxserial somehow using the pound sign ("#") as an EOF indicator? > > Howard > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From wido at pcextreme.nl Tue Mar 2 06:17:43 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:17:43 +0100 Subject: [Rxtx] Writing Hex data to the Serial port Message-ID: <1267535863.2661.10.camel@wido-desktop> Hi, I'm trying to port a .Net application (which was not written by me!) to Java so i can make it platform independent. I'm a Linux fan so i would like to run this app on Linux. First of all, i never used serial ports before in my programming experience, every application i wrote were Webbased applications where i didn't have to worry about binary and hex data. Now, the system i am building is for a paintball competition, we have some flags in the field which have to be remote controlled, so all the hardware is custom made. On Windows i used the program "PortMon" to see what the .Net program does on the serial port, this gave me: 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS Length 11: EE FF FF 00 00 11 01 03 00 EE CC After searching through the .Net code (which was made with Visual Studio) has the following code: private void SendStartGame(byte status, byte destination) { byte[] sendPacket = { 0xEE, 0xFF, destination, //destination ALL FLAGS 0x00, //sender BASE 0x00, //messagetype CHANGE 0x11, //command gamestatus 0x01, //length 6 status, //data status (1=start,2=stop) 0x00, //CRC 0xEE, 0xCC}; if (serialPort1.IsOpen) { serialPort1.Write(sendPacket,0, sendPacket.Length); } else { MessageBox.Show("Not connected to device"); } } No, i'm trying to port that piece of code to Java and i get stuck.. In Java i created: private void startGame() { byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, 01, 03, 00, (byte) 238, (byte) 204 }; try { byte packet = Integer.toHexString(255).getBytes()[0]; this.outputStream.write(buf, 0, buf.length); this.outputStream.flush(); } catch (Exception e) { System.out.println(e.getMessage()); } } This should send a start signal to my piece of hardware, but that doesn't happened. So i'm stuck here about the hex to byte conversion and vise versa. I also tried: byte[] buf { 0xEE, 0xFF, 0x00 }; That doesn't work either, the compiler doesn't take it, it gives: PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; Since this is my first time using serial ports i'm getting a bit lost. Does somebody have a hint in the right direction? How do i do this in Java? Thank you in advance! -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl From george.dma at gmail.com Tue Mar 2 06:42:05 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 15:42:05 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267535863.2661.10.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> Message-ID: Hi, Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I send lots of arrays that way through rxtx This seems like a warning... though I am using Eclipse and I never get this warning. I guess your compiler is taking the hex values as ints. PBComm.java:58: possible loss of precision found : int required: byte byte[] buf = { 0xEE, 0xFF }; You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; What IDE are you using ? -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander wrote: > Hi, > > I'm trying to port a .Net application (which was not written by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my programming > experience, every application i wrote were Webbased applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, we have > some flags in the field which have to be remote controlled, so all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 SUCCESS > Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a bit lost. > > Does somebody have a hint in the right direction? How do i do this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wido at pcextreme.nl Tue Mar 2 06:58:22 2010 From: wido at pcextreme.nl (Wido den Hollander) Date: Tue, 02 Mar 2010 14:58:22 +0100 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: References: <1267535863.2661.10.camel@wido-desktop> Message-ID: <1267538302.2661.19.camel@wido-desktop> Hi, I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my Java code. My Java version is: wido at wido-desktop:~/Desktop$ javac -version javac 1.6.0_15 wido at wido-desktop:~/Desktop$ I've build a simple BASH script to compile my code and run it. Now i'm using: private void startGame() { byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, 0x01, 0x11, 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; try { this.outputStream.write(buf); this.outputStream.flush(); System.out.println(buf); } catch (Exception e) { System.out.println(e.getMessage()); } } It works (i see the right data going out), but the device doesn't respond.. Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem right. -- Met vriendelijke groet, Wido den Hollander Hoofd Systeembeheer / CSO Telefoon Support Nederland: 0900 9633 (45 cpm) Telefoon Support Belgi?: 0900 70312 (45 cpm) Telefoon Direct: (+31) (0)20 50 60 104 Fax: +31 (0)20 50 60 111 E-mail: support at pcextreme.nl Website: http://www.pcextreme.nl Kennisbank: http://support.pcextreme.nl/ Netwerkstatus: http://nmc.pcextreme.nl On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > Hi, > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > send lots of arrays that way through rxtx > > This seems like a warning... though I am using Eclipse and I never get > this warning. I guess your compiler is taking the hex values as ints. > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > What IDE are you using ? > -- > George H > george.dma at gmail.com > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > wrote: > Hi, > > I'm trying to port a .Net application (which was not written > by me!) to > Java so i can make it platform independent. > > I'm a Linux fan so i would like to run this app on Linux. > > First of all, i never used serial ports before in my > programming > experience, every application i wrote were Webbased > applications where i > didn't have to worry about binary and hex data. > > Now, the system i am building is for a paintball competition, > we have > some flags in the field which have to be remote controlled, so > all the > hardware is custom made. > > On Windows i used the program "PortMon" to see what the .Net > program > does on the serial port, this gave me: > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > SUCCESS Length 11: EE FF FF > 00 00 11 01 03 00 EE CC > > After searching through the .Net code (which was made with > Visual > Studio) has the following code: > > private void SendStartGame(byte status, byte destination) { > > byte[] sendPacket = { 0xEE, > 0xFF, > destination, //destination ALL > FLAGS > 0x00, //sender BASE > 0x00, //messagetype CHANGE > 0x11, //command gamestatus > 0x01, //length 6 > status, //data status > (1=start,2=stop) > 0x00, //CRC > 0xEE, > 0xCC}; > > if (serialPort1.IsOpen) > { > serialPort1.Write(sendPacket,0, sendPacket.Length); > } > else > { > MessageBox.Show("Not connected to device"); > } > } > > No, i'm trying to port that piece of code to Java and i get > stuck.. > > In Java i created: > > private void startGame() { > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > (byte) 17, > 01, 03, 00, (byte) 238, (byte) 204 }; > > try { > byte packet = Integer.toHexString(255).getBytes()[0]; > this.outputStream.write(buf, 0, buf.length); > this.outputStream.flush(); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > } > > This should send a start signal to my piece of hardware, but > that > doesn't happened. > > So i'm stuck here about the hex to byte conversion and vise > versa. > > I also tried: > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > That doesn't work either, the compiler doesn't take it, it > gives: > > PBComm.java:58: possible loss of precision > found : int > required: byte > byte[] buf = { 0xEE, 0xFF }; > > Since this is my first time using serial ports i'm getting a > bit lost. > > Does somebody have a hint in the right direction? How do i do > this in > Java? > > Thank you in advance! > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > From george.dma at gmail.com Tue Mar 2 07:10:11 2010 From: george.dma at gmail.com (George H) Date: Tue, 2 Mar 2010 16:10:11 +0200 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: Perhaps you need to set the serial port settings like the UART stuff on linux. I found in my case, it is better not to configure the ports using setserial, and just let the kernel auto-config the ports and then use rxtx to set the serial port parameters such as the baud rate, parity ...etc. Maybe you need to use "setserial" command to configure your serial ports. Try doing some debugging on that level. -- George H george.dma at gmail.com On Tue, Mar 2, 2010 at 3:58 PM, Wido den Hollander wrote: > Hi, > > I'm using Java JDK 1.6.0 and a simple text editor (Kate) to write my > Java code. > > My Java version is: > > wido at wido-desktop:~/Desktop$ javac -version > javac 1.6.0_15 > wido at wido-desktop:~/Desktop$ > > I've build a simple BASH script to compile my code and run it. > > Now i'm using: > > private void startGame() { > > byte[] buf = { (byte)0xee, (byte)0xff, (byte)0xff, 0x00, > 0x01, 0x11, > 0x01, 0x01, 0x00, (byte)0xee, (byte)0xcc }; > try { > this.outputStream.write(buf); > this.outputStream.flush(); > System.out.println(buf); > } catch (Exception e) { > System.out.println(e.getMessage()); > } > > } > > It works (i see the right data going out), but the device doesn't > respond.. > > Any ideas? Ofcourse, you don't know my hardware, but it doesn't seem > right. > > -- > Met vriendelijke groet, > > Wido den Hollander > Hoofd Systeembeheer / CSO > Telefoon Support Nederland: 0900 9633 (45 cpm) > Telefoon Support Belgi?: 0900 70312 (45 cpm) > Telefoon Direct: (+31) (0)20 50 60 104 > Fax: +31 (0)20 50 60 111 > E-mail: support at pcextreme.nl > Website: http://www.pcextreme.nl > Kennisbank: http://support.pcextreme.nl/ > Netwerkstatus: http://nmc.pcextreme.nl > > > On Tue, 2010-03-02 at 15:42 +0200, George H wrote: > > Hi, > > > > Sending a byte array as bye[] array = { 0xEE,0xFF}; should work. I > > send lots of arrays that way through rxtx > > > > This seems like a warning... though I am using Eclipse and I never get > > this warning. I guess your compiler is taking the hex values as ints. > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > > > You can try a hacky way byte[] buf = { ((byte)0xEE), ((byte)0xFF)}; > > > > What IDE are you using ? > > -- > > George H > > george.dma at gmail.com > > > > > > On Tue, Mar 2, 2010 at 3:17 PM, Wido den Hollander > > wrote: > > Hi, > > > > I'm trying to port a .Net application (which was not written > > by me!) to > > Java so i can make it platform independent. > > > > I'm a Linux fan so i would like to run this app on Linux. > > > > First of all, i never used serial ports before in my > > programming > > experience, every application i wrote were Webbased > > applications where i > > didn't have to worry about binary and hex data. > > > > Now, the system i am building is for a paintball competition, > > we have > > some flags in the field which have to be remote controlled, so > > all the > > hardware is custom made. > > > > On Windows i used the program "PortMon" to see what the .Net > > program > > does on the serial port, this gave me: > > > > 426 0.00063472 pb_ctrl.exe IRP_MJ_WRITE VCP0 > > SUCCESS Length 11: EE FF FF > > 00 00 11 01 03 00 EE CC > > > > After searching through the .Net code (which was made with > > Visual > > Studio) has the following code: > > > > private void SendStartGame(byte status, byte destination) { > > > > byte[] sendPacket = { 0xEE, > > 0xFF, > > destination, //destination ALL > > FLAGS > > 0x00, //sender BASE > > 0x00, //messagetype CHANGE > > 0x11, //command gamestatus > > 0x01, //length 6 > > status, //data status > > (1=start,2=stop) > > 0x00, //CRC > > 0xEE, > > 0xCC}; > > > > if (serialPort1.IsOpen) > > { > > serialPort1.Write(sendPacket,0, sendPacket.Length); > > } > > else > > { > > MessageBox.Show("Not connected to device"); > > } > > } > > > > No, i'm trying to port that piece of code to Java and i get > > stuck.. > > > > In Java i created: > > > > private void startGame() { > > > > byte[] buf = { (byte) 238, (byte) 255, (byte) 255 , 0, 0, > > (byte) 17, > > 01, 03, 00, (byte) 238, (byte) 204 }; > > > > try { > > byte packet = Integer.toHexString(255).getBytes()[0]; > > this.outputStream.write(buf, 0, buf.length); > > this.outputStream.flush(); > > } catch (Exception e) { > > System.out.println(e.getMessage()); > > } > > } > > > > This should send a start signal to my piece of hardware, but > > that > > doesn't happened. > > > > So i'm stuck here about the hex to byte conversion and vise > > versa. > > > > I also tried: > > > > byte[] buf { 0xEE, 0xFF, 0x00 }; > > > > That doesn't work either, the compiler doesn't take it, it > > gives: > > > > PBComm.java:58: possible loss of precision > > found : int > > required: byte > > byte[] buf = { 0xEE, 0xFF }; > > > > Since this is my first time using serial ports i'm getting a > > bit lost. > > > > Does somebody have a hint in the right direction? How do i do > > this in > > Java? > > > > Thank you in advance! > > > > -- > > Met vriendelijke groet, > > > > Wido den Hollander > > Hoofd Systeembeheer / CSO > > Telefoon Support Nederland: 0900 9633 (45 cpm) > > Telefoon Support Belgi?: 0900 70312 (45 cpm) > > Telefoon Direct: (+31) (0)20 50 60 104 > > Fax: +31 (0)20 50 60 111 > > E-mail: support at pcextreme.nl > > Website: http://www.pcextreme.nl > > Kennisbank: http://support.pcextreme.nl/ > > Netwerkstatus: http://nmc.pcextreme.nl > > > > > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx at qbang.org > > http://mailman.qbang.org/mailman/listinfo/rxtx > > > > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.kirkland at comcast.net Tue Mar 2 08:46:13 2010 From: m.kirkland at comcast.net (Mike Kirkland) Date: Tue, 2 Mar 2010 07:46:13 -0800 Subject: [Rxtx] Writing Hex data to the Serial port In-Reply-To: <1267538302.2661.19.camel@wido-desktop> References: <1267535863.2661.10.camel@wido-desktop> <1267538302.2661.19.camel@wido-desktop> Message-ID: <5328115605B34B8C8F53E954BC42CEC3@bengal.net> How do you "see" the data going out? The only way to know for sure is to see it on the serial port connector itself. A handy device to do this with is a serial break out box. It is a box of lights for each serial line and jumpers. Even if you don't have one you can connect a second serial port's receive line to the port in question transmit or receive line and watch the data with a serial terminal program. Some random guesses of things to check. Is the data really getting out the serial port (see above)? Is the baud rate, data bits, stop bits correct? Is the handshaking correct? Is the serial port handshaking correctly configured for the device? Is the serial cable correctly providing handshaking pins to the device? Good luck hunting... Mike -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Wido den Hollander Sent