Thread Subject: FOPEN: Port: COM5 is not available. Available ports: [...] COM5.

Subject: FOPEN: Port: COM5 is not available. Available ports: [...] COM5.

From: Geoffrey Akien

Date: 17 Jun, 2009 07:51:01

Message: 1 of 3

Anyone seen these errors before? (MATLAB R14 with the serial fix applied)

The device I am communicating with sends regular status updates, but I am not interested in all of the information, so as part of retrieving the latest information from the device, I do a flushinput, then wait for the information to come in again (roughly every 20 seconds). Anticipating issues with the buffer becoming too big, I've set the InputBufferSize to 20 MB. But, after ~5 hours I get:

??? Error using ==> icinterface.flushinput
Java exception occurred:
java.lang.NullPointerException

at com.mathworks.toolbox.instrument.InputBuffer.disposeNextRead(InputBuffer.java:615)

at com.mathworks.toolbox.instrument.InputBuffer.setSize(InputBuffer.java:69)

at com.mathworks.toolbox.instrument.InputBuffer.flush(InputBuffer.java:84)

at com.mathworks.toolbox.instrument.InstrumentReader.flushinput(InstrumentReader.java:210)
.

Error in ==> tharbprobjcomm at 107
        flushinput(serialObj)

As a non-Java user I must admit I don't really follow those error messages, so I attempted to close and delete the serial object, then recreate it and open it again, getting:

>> fopen(th)
??? Error using ==> serial.fopen
Port: COM5 is not available. Available ports: COM1, COM3, COM4, COM5.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.

These errors do not affect the other 3 serial devices that are currently attached and that I am also getting information from (all are attached via an 8-way USB-serial adaptor).

I am going to try doing an fread of BytesAvailable instead and discarding that instead of using flushinput, but I wondered what suggestions you guys might have had.

Subject: FOPEN: Port: COM5 is not available. Available ports: [...] COM5.

From: Gavrilo Bozovic

Date: 17 Jun, 2009 11:39:02

Message: 2 of 3

"Geoffrey Akien" <geoff.akien@gmail.com> wrote in message <h1a795$ikr$1@fred.mathworks.com>...
> Anyone seen these errors before? (MATLAB R14 with the serial fix applied)
>
> The device I am communicating with sends regular status updates, but I am not interested in all of the information, so as part of retrieving the latest information from the device, I do a flushinput, then wait for the information to come in again (roughly every 20 seconds). Anticipating issues with the buffer becoming too big, I've set the InputBufferSize to 20 MB. But, after ~5 hours I get:
>
> ??? Error using ==> icinterface.flushinput
> Java exception occurred:
> java.lang.NullPointerException
>
> at com.mathworks.toolbox.instrument.InputBuffer.disposeNextRead(InputBuffer.java:615)
>
> at com.mathworks.toolbox.instrument.InputBuffer.setSize(InputBuffer.java:69)
>
> at com.mathworks.toolbox.instrument.InputBuffer.flush(InputBuffer.java:84)
>
> at com.mathworks.toolbox.instrument.InstrumentReader.flushinput(InstrumentReader.java:210)
> .
>
> Error in ==> tharbprobjcomm at 107
> flushinput(serialObj)
>
> As a non-Java user I must admit I don't really follow those error messages, so I attempted to close and delete the serial object, then recreate it and open it again, getting:
>
> >> fopen(th)
> ??? Error using ==> serial.fopen
> Port: COM5 is not available. Available ports: COM1, COM3, COM4, COM5.
> Use INSTRFIND to determine if other instrument objects are connected to the requested device.
>
> These errors do not affect the other 3 serial devices that are currently attached and that I am also getting information from (all are attached via an 8-way USB-serial adaptor).
>
> I am going to try doing an fread of BytesAvailable instead and discarding that instead of using flushinput, but I wondered what suggestions you guys might have had.

Did you by any chance kill a program that was accessing COM5?

If you do so, as the port is not properly closed, you may have issues re-opening it. In case of doubt, try restarting the device connected to COM5!

Subject: FOPEN: Port: COM5 is not available. Available ports: [...] COM5.

From: Geoffrey Akien

Date: 17 Jun, 2009 20:10:22

Message: 3 of 3

Nope. Nothing else is accessing COM5. I have had issues before with Windows picking up the device (since it is continuously broadcasting information) as a "Microsoft Serial Ballpoint" (apparently an old mouse they used to do) - this is disabled in device manager.

So far using fread(serialObj, serialObj.BytesAvailable); and discarding the information seems to be working OK.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
serial Geoffrey Akien 17 Jun, 2009 03:54:08
java Geoffrey Akien 17 Jun, 2009 03:54:08
flushinput Geoffrey Akien 17 Jun, 2009 03:54:08
error Geoffrey Akien 17 Jun, 2009 03:54:08
rssFeed for this Thread

Contact us at files@mathworks.com