Re: Problem with serial port output

Shawn Silverman <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hi, Bruno.  Thanks for your response.

Sometimes it's easier not to store these objects and pass everything 
around, but you're right, it is better practice to cache things.  This 
particular method is called only once in the whole program anyway.

Still, the SerialPort object should return the correct OutputStream no 
matter how many times I call getOutputStream().  I was just curious if 
this was a small oversight.

Oh, and there's no exception.  It just blocks.  I then thought it was a 
hardware flow control thing, but I checked, and CTS is set on my 
device, so it can't be that this is holding things up.  It could also 
be that my device is holding things up anyway.. I have some more 
checking to do :)

I suppose I should try my original OutputStream object..

	-Shawn

On 3-Feb-04, at 9:35 AM, Bruno De Maesschalck wrote:

> It's anyway better practise to call the getOutputStream() once and 
> store it
> in it's own OutputStream object.
> Use this object as long as you need it and then cast it away.
>
> Try this out first and let me know if it still hangs.
>
> Have you done some try{ } and printed out the stacktrace?
> Or doesn't it throw any exception?
>
> B.
>
>
>> I've just encountered a case where serialOut.write(cmd.getBytes())
>> hangs.  serialOut is an OutputStream obtained from
>> SerialPort.getOutputStream() (serial0, 57600, 8N1), and cmd is a
>> String.
>>
>> In this instance, I'm calling getOutputStream() after it has been
>> called before.  Should this cause a problem?  Should I cache the
>> OutputStream object once getOutputStream() has been called once?
>>
>> Thanks,
>> -Shawn

_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.