News for hackers. Stuff that matters.
Re:Ben Eater is back with a new video (after almost a year)! by inetknght on Saturday November 05, 2022 @02:50PM (#33484425)
> I really, really like RS-232. It just works.

Well... as long as everyone has their configuration correctly hand-configured. As the video states, RS-232 doesn't have any way to transmit a clock. So if one end is talking 9600 baud and another wants to talk at, say, 56000 baud, then... no it doesn't just work.

Re:Ben Eater is back with a new video (after almost a year)! by sgtnoodle on Saturday November 05, 2022 @02:59PM (#33484509)
My favorite was the time we received a new batch of controllers from a vendor, same revision number, and their RX and TX pins were swapped. When working with RS232, it's best to have a handful of null adapters and gender changers in your pocket.
Re:Ben Eater is back with a new video (after almost a year)! by unboxingelf on Saturday November 05, 2022 @04:13PM (#33485167)
This brings back memories. We called them “gender benders”.
Re:Ben Eater is back with a new video (after almost a year)! by reaperducer on Saturday November 05, 2022 @06:21PM (#33486524)
Different item. While Gender benders could optionally be built with a null modem inside, as a single item their purpose was to link incompatible male and female ports.

Having both a null modem and a gender bender end-to-end was common.

Re:Ben Eater is back with a new video (after almost a year)! by dgfitz on Saturday November 05, 2022 @06:34PM (#33486632)
Still is! I carry around gender-benders, null modem adapters and 120ohm CAN db9 resistors every day, along with usb-to-serial, peak can to usb, kvaser to usb, and ixxat to usb.

These aren’t dead technologies by any stretch, not that you were implying that.

Re:Ben Eater is back with a new video (after almost a year)! by Eleison23 on Saturday November 05, 2022 @09:58PM (#33488060)
We never called them "gender benders" because that term had already been in use in the real world of gender ideology.

Real techs knew them as "gender changers" which was different enough to be recognizable as only a technical term for cable connectors.

Re:Ben Eater is back with a new video (after almost a year)! by randombits0 on Sunday November 06, 2022 @12:24AM (#33488973)
So how did you reference master/slave? That term is already in use in the real world of human ideology.

I’ll bet you’re not a native English speaker. Nothing wrong with that, btw.

Re:Ben Eater is back with a new video (after almost a year)! by Eleison23 on Sunday November 06, 2022 @12:32AM (#33489012)
"Gender bender" does not accurately describe what gender changers actually did, so whatever.
Re:Ben Eater is back with a new video (after almost a year)! by simoncion on Sunday November 06, 2022 @02:08AM (#33489993)
A gender bender changes the perceived gender of something so that other things that are going to interact with it interact with it appropriately.

Seems pretty spot-on to me.

Re:Ben Eater is back with a new video (after almost a year)! by Eleison23 on Tuesday November 08, 2022 @09:56PM (#33527055)
Yes, it "changes" the gender - so that's why we call them "gender changers"

Sorry if you don't see the pejorative connotations in the other term. We avoided it because we didn't wish to offend people.

Re:Ben Eater is back with a new video (after almost a year)! by simoncion on Saturday November 12, 2022 @08:38AM (#33572927)
> Sorry if you don't see the pejorative connotations in the other term. We avoided it because we didn't wish to offend people.

You remind me of one of the tech leads I have the occasional displeasure of interacting with. He'll blow in with some new work for us to do, and a stack of reasons to do it. The topmost in the stack he'll provide, and the rest of the stack he keeps hidden. The problem with his stack of reasons are twofold:

1) It takes no less than five and -typically- fifteen minutes to get through the stack.

2) Only the reason at the base of the stack is non-bogus. All of the others are calibrated to sound _great_ to folks who don't work on the thing (and talk to customers who use the thing) day in and day out.

Next time, start with the reason at the bottom of your stack when you're talking to technical folks like us. ;)

Re:Ben Eater is back with a new video (after almost a year)! by guenthert on Saturday November 05, 2022 @04:44PM (#33485477)
And a breakout box (breakout tester)!
Re:Ben Eater is back with a new video (after almost a year)! by cathdrlbizzare on Saturday November 05, 2022 @06:12PM (#33486454)
Null modems.

Laplink cables had DB-9 and DB-25 on both ends with the crossover built-in.

There were some male to male cables that had crossover while others didn’t. Then there were null modem adapter dongles for straight through cables. They were either male-female or male-male depending.

Reminds me about older Ethernet: before Auto-MDI/MDIX on most NICs and switches, crossover RJ-45 cables were needed.

Re:Ben Eater is back with a new video (after almost a year)! by bmitc on Saturday November 05, 2022 @02:57PM (#33484486)
It does because that is solved trivially by documentation. By just work I didn't mean plug and play. (USB isn't really plug and play anyway by virtue of it being terrible.)
Re:Ben Eater is back with a new video (after almost a year)! by sgtnoodle on Saturday November 05, 2022 @03:01PM (#33484528)
You can also design the protocol to auto-determine baud rate. Some protocols even transmit 0x55 at the start of every packet, allowing for clock synchronization.
Re:Ben Eater is back with a new video (after almost a year)! by camtarn on Saturday November 05, 2022 @08:17PM (#33487360)
Sometimes you get a device from a client who got it from another company who got it from etc etc. And it's been configured via internal memory to talk at some baud rate with some parity, and if you're really unlucky, it won't transmit unless it's received a command. And, like somebody else commented above, sometimes the Tx and Rx pins are just the wrong way around.

Your experiences with USB sound incredibly frustrating. But RS232 can also be crap in its own unique ways.

But to be fair, I do still rather like working on well behaved RS232/422/485 equipment, where you plug it in, set it to 9600 baud 8N1, and you just start seeing a stream of easily parsed text scrolling down your terminal :)

Re:Ben Eater is back with a new video (after almost a year)! by bmitc on Saturday November 05, 2022 @11:01PM (#33488414)
Most of the issues with RS-232 can be front-loaded though, and they are understandable. Once you get it going and document what's what, it's fine. For USB though, reaching an understanding of the actual problem is basically impossible.
Re:Ben Eater is back with a new video (after almost a year)! by brendank310 on Saturday November 05, 2022 @11:11PM (#33488481)
With RS232 you can hook up an old oscilloscope and measure what the right baud rate should be. Even in the "won't transmit unless it receives" case, a sweep on a waveform generator and well configured trigger will get you on your way. USB you'd need much nicer tools handy to get to the bottom of an issue.

You are right on about the joy of it being 9600 8N1 on the first try.

Re:Ben Eater is back with a new video (after almost a year)! by pdntspa on Saturday November 05, 2022 @04:04PM (#33485086)
I've yet to encounter a situation where this is truly as issue.
Re:Ben Eater is back with a new video (after almost a year)! by vardump on Saturday November 05, 2022 @04:07PM (#33485125)
Lucky you.

Issues like one device got a slightly different baud rate, enough to make it either not work at all or having a lot of transmission errors?

I have, and I'm sure a lot of other people have their own horror stories.

Having a clock signal, like in I2C, solves that.

Oh and that "oops, just connected 12V RS-232 to a 3.3V device," and see the magic smoke getting away...

Re:Ben Eater is back with a new video (after almost a year)! by pdntspa on Saturday November 05, 2022 @05:43PM (#33486147)
When I was doing embedded work all our terminals simply remembered the last settings and it was like we would set it once and not have to think about it again.

The voltage thing is real (and real stupid IME) but we never ran into clock issues that would skew baud rates one way or another.

Re:Ben Eater is back with a new video (after almost a year)! by exmadscientist on Saturday November 05, 2022 @05:43PM (#33486152)
You do need decently stable clocks for 232 and friends. Anything clocked by an RC oscillator is probably going to cause some sadness eventually.

I2C is terrible in so many ways. (Don't send it off-board. Just don't. Ever. Trust me on this one. I don't care what you read about the bus capacitance spec, do. not. do. this.) Sending out a clock on a 400pF on-card bus isn't too bad, but when you have a kilometer-long cable... yeah, we'd rather not send a clock down that, thank you. Hence the use of self-clocked or pray-we-have-similar-clock-frequencies protocols.

3.3V or 5V devices aren't RS-232 and people need to be careful about that. They're just UARTs with regular old logic levels. RS-232 or 422 or 485 are Serious Business levels to go out and do battle with the mean Real World and the only place they should ever land is at a dedicated transceiver. Full stop.

Re:Ben Eater is back with a new video (after almost a year)! by chasd00 on Saturday November 05, 2022 @10:24PM (#33488221)
Are you saying beware of i2c on a kilometer long cable?! Why would anyone even think that would be feasible?
Re:Ben Eater is back with a new video (after almost a year)! by bombcar on Sunday November 06, 2022 @01:14AM (#33489700)
https://www.nxp.com/docs/en/data-sheet/P82B96.pdf lists 250m as an option for whatever you'd want to do with that.
Re:Ben Eater is back with a new video (after almost a year)! by exmadscientist on Saturday November 12, 2022 @04:54PM (#33577497)
No, I'm saying you can't send I2C one meter off-board. Even six inches in anything but a gentle EMC environment can be severe trouble without careful design. And yet I've seen people try to run it ~180cm next to horrifying noise sources. Surprise, surprise, that doesn't work out very well.

The root of the problem is that I2C has serious EMC immunity issues. It's well known and appreciated that its drive is weak and open-drain. The bus buffers and especially differential drivers can and do help there. (And will get you past a meter.) What's less well recognized is that a single glitch pulse on SCK knocks all the internal state machines out of whack and requires a bus reset to fix them. Hope you're doing that when your bus is idle or when you're getting anomalies! Most people don't. The Nexus 4 phones sure didn't; this is why their light sensors went dead or crazy or both after a while of uptime.

All of that gets easier to handle if there's a nice, big, low-impedance ground plane nearby, which is why you don't see so much trouble when it stays on the PCB.

Re:Ben Eater is back with a new video (after almost a year)! by Scoundreller on Saturday November 05, 2022 @08:26PM (#33487408)
> oops, just connected 12V RS-232 to a 3.3V device

Maybe or maybe not. I ran 12V RS-232 levels into a 5V Atmel 8515 for a year or two 24/7 without issues, and tens of thousands, maybe more, have too. And that's a CMOS part.

(This was for a paytv interface sitting between an iso7816 slot and an x86 based emulator. The Atmel 8515 did the inversion in software).

The RS-232 on the PC side would have no issues with interpreting +5 as logic0 and 0V as logic1.

Some would setup a Max232 or Max233, but it wasn't necessary.

Others would use an MC1489 to at least convert the -12V and +12V into 5V and 0V by doing an input and then output into the chip, but again, it was out of caution and not actually necessary.

Re:Ben Eater is back with a new video (after almost a year)! by exmadscientist on Saturday November 05, 2022 @09:08PM (#33487681)
You can sometimes get away with this if your cables are short and your EMC environment is gentle. (An EE wouldn't try it, but only because sticking the transceiver in is quite easy.) You can never get away with this if your cables are long and your EMC environment is hostile. That's why we have 232 and, especially, 422/485: for when the job is hard.
Re:Ben Eater is back with a new video (after almost a year)! by Scoundreller on Saturday November 05, 2022 @09:21PM (#33487769)
Did it over ~100' of dollar-store grade RJ-11. (Maybe that's long, maybe that's short, depends on perspective). Was a residential environment, so EMC situation was nothing like some industrial environments.
Re:Ben Eater is back with a new video (after almost a year)! by megraf on Saturday November 05, 2022 @06:17PM (#33486494)
I've done a bunch of work with RS232 in the machining industry (CNC). Getting my mind around both software / hardware control sequences was the most challenging part.

You can overcome the baud challenges with scripts that loop through common baud rates until alpha numeric characters are found.

It's also nice that the same few windows applications have been in use for 20 years or so (I specifically worked with RS232 to TCP/IP).

Re:Ben Eater is back with a new video (after almost a year)! by funstuff007 on Sunday November 06, 2022 @09:01AM (#33492722)
With a buffer, it's probably pretty easy to guess the baud rate. Similar to encoding guessers for strings or the CSV.sniffer in Python standard library.

https://github.com/chardet/chardet

https://docs.python.org/3/library/csv.html#csv.Sniffer