|
"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!
|