[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: battery tester



On Tue, 29 Oct 2024 17:36:18 +0100
tomas@tuxteam.de wrote:

> On Tue, Oct 29, 2024 at 04:28:14PM +0100, tomas@tuxteam.de wrote:
> > On Tue, Oct 29, 2024 at 11:13:28AM -0400, Stefan Monnier wrote:  
> 
> [...]
> 
> > > The CH340 is a real USB<->serial converter, so somewhere inside
> > > the device is a real serial connection which speaks at a specific
> > > speed and the CH340 probably has to match that speed if we want
> > > to get valuable output, I suspect.  IOW, I think it's not "just
> > > an abstraction layer".  
> > 
> > Hmmm. An interesting point. Yet another rabbit hole =:-o  
> 
> Yep, after thinking a bit and poking the interwebs for good measure,
> I'm convinced now that you are right. The stty sets the UART "at the
> other end" of the USB. So it better be right.
> 
> Of course one might hope it starts up with a sensible value, but hey.
> 
> Cheers

If the serial parameters are wrong, garbage characters will appear,
there won't be nothing at all. You play with the numbers until it isn't
garbage any more. This does require that the unknown source provides
continuous or at least frequent transmissions without getting proper
returns or handshaking.

There are systems which will automatically recognise baud rate by
assuming the shortest mark or space represents the rate, but this needs
fairly good signal strength and reasonable jitter to work. It generally
can't be done well through the UART, it needs a separate comparator to
bypass the UART's processing. 

These days serial is usually one wire in each direction and a ground,
in earlier days it might be necessary to deal with hardware handshaking
lines, which had standard functions in the telephone business but were
often used elsewhere for proprietary signalling.

I once needed to deal with a serial remote control system which used
the parity bit as a flow control system, something which utterly chokes
a standard UART. I needed to convert this to standard usage to send it
through a conventional serial link and back again at the other end.

-- 
Joe


Reply to: