News for hackers. Stuff that matters.
Re:Firmware is on shaky ground – let's see what it's made of by HALtheWise on Tuesday April 18, 2023 @12:33AM (#35609992)
Yep! Most microcontrollers will sustain permanent damage if you short an output pin for any significant time. You could probably design a microcontroller that didn't do this, but it would require putting a big resistor in line with the pin (decreasing responsiveness and max power output) and/or adding a lot of circuitry and increased cost to defend against a risk that's not a big deal when the chip is being programmed by a competent embedded engineering team.
Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Tuesday April 18, 2023 @01:11AM (#35610192)
A lot of circuitry? I would have thought a handful of (integrated) transistors could make it happen.
Re:Firmware is on shaky ground – let's see what it's made of by wtallis on Tuesday April 18, 2023 @01:23AM (#35610265)
Transistors that can handle a lot of current or voltage will need to be much larger than most of the logic transistors on a chip, so even though they may appear to be few in number on the schematic, they can add up to significant die area for a small part like a microcontroller.
Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Tuesday April 18, 2023 @02:13AM (#35610522)
They need to control the transistor that actually does the output, so they shouldn't need to be very big themselves.
Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Wednesday April 19, 2023 @10:25AM (#35628580)
This is the point where the neat digital circuit abstraction breaks down and we get into analog and device physics territory. The extra current is a physical thing that has to go somewhere, maybe through a larger device. It takes time and circuitry to detect it and shut it off. And it could trigger a parasitic circuit that doesn't have an off switch like a transistor, which requires yet another circuit to detect and shut off. You can do it, but it costs space, money, power, and speed.
Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Wednesday April 19, 2023 @12:17PM (#35630024)
> The extra current is a physical thing and you need more material to temporarily withstand it, and more circuit to detect and control it.

Supposedly most of the chips can already temporarily withstand extra current. But the point of a current-limiting circuit is that you don't have extra.

> uncontrolled switching event

I'm not suggesting turning it off entirely, unless that's much much easier.

> it'll probably ring unless you add even more components to absorb and control that

If it fluctuates some when overloaded, that still sounds better than frying itself. But I'd expect an integrated implementation to keep pretty tight bounds.

> that could exceed the physical limits and trigger a parasitic circuit

What physical limits? You've lost me at this point.

> It can be a lot of work for the board designer

I was suggesting building it into the chip.

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Wednesday April 19, 2023 @03:02PM (#35631973)
The current limiter is analog and dissipates a lot of heat compared to digital and also uses more passive devices, so it must be bigger.

Digital CMOS is triggered to switch between fully on and fully off. You can't really hold it in between. If you do, you get undefined behavior.

The ringing can have an initial spike that fries stuff.

CMOS can break down and the current will flow through a different path away from the gate where the gate can't turn it off. Called latch-up.

It is in the chip. The protection circuit can add a lot of parasitic elements to the pin interface that you have to account for when you design the board.

Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Thursday April 20, 2023 @02:40AM (#35637084)
> The current limiter is analog and dissipates a lot of heat compared to digital and also uses more passive devices, so it must be bigger.

Controlling the voltage put into the output transistor shouldn't use much power or output much heat, should it? The output transistor will heat up based on voltage loss, but it needs to be able to handle a notable amount of that even when it's not shorted.

> Digital CMOS is triggered to switch between fully on and fully off. You can't really hold it in between. If you do, you get undefined behavior.

> CMOS can break down and the current will flow through a different path away from the gate where the gate can't turn it off. Called latch-up.

The pins are already tri-state. The logic to output +V, or output 0V, or neither already exists. So it won't fight itself.

> The ringing can have an initial spike that fries stuff.

How can you make a transistor's output spike higher than it does with the existing digital drive method?

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Thursday April 20, 2023 @03:38AM (#35637364)
Turning off the transistor is only the last step and the previous steps like detection take up space. Digital CMOS is bi-state and the pin is tri-state, therefore you can conclude that there are additional components involved to achieve the third state. You can cause spiking by suddenly shutting off current through a parasitic inductance because it sort of has inertia and can't stop immediately.
Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Thursday April 20, 2023 @04:38AM (#35637654)
> the previous steps like detection take up space

Yes but I'm missing why they would need significant amounts of space or power compared to the big transistor that's actually dealing with the current.

> Digital CMOS is bi-state and the pin is tri-state, therefore you can conclude that there are additional components involved to achieve the third state.

Yeah, so less to add and less to worry about compensating for because it's already handled.

> Spiking can be caused by suddenly shutting off current through a parasitic inductance because it sort of has inertia and can't stop immediately.

It already abruptly turns on and off. How does an extra trigger condition make that worse?

Or in other words, how are we not already in the worst case, with nowhere to go but up? (Since if we're just controlling the transistor better we won't be adding any more inductance than the pin already has.)

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Thursday April 20, 2023 @10:07AM (#35640164)
It depends on the design, but think of it this way. Digital if the smallest you can go. The protection circuit is not strictly digital, therefore it is bigger.

It's not already handled because you still need a circuit that detects the condition and switches to tri-state, if that's even how it's implemented.

Ringing and spikes come from electrical mismatch. If the protection changes the electrical properties of the pin, it may have to do more work to damp out the new mismatch. "Abrupt" isn't a single thing with a universal solution.

We're not just controlling transistors, but also sensing, shunting, clamping, damping, etc. And we're starting from the best case so we have nowhere to go but down.

You'll have to look up the rest yourself.

Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Thursday April 20, 2023 @11:27AM (#35641593)
I know it's "bigger". But the protection circuit should be working on a thousandth the power as the output transistor, and the chip has a zillion logic transistors already, so I'm saying the chip should be negligibly bigger.

It should always be tri state. Never allow the positive and negative output transistors to get power at the same time. If that particular detail wasn't already implemented, it'll take like two logic gates more. Which is absolutely nothing compared to the rest of the chip.

And again, don't change the electrical properties! Tap like a microamp for monitoring, on a pin that outputs milliamps.

It doesn't matter that there is no universal solution to "abrupt" because we already have an acceptable setup and it's not changing.

Sensing can be done with no real impact on output characteristics. Additional shunting and clamping is not necessary. If the damping only happens by controlling the output transitor, then it's no different from how the circuit already works.

And no we're not starting in the best case. We're starting with a transistor where the design goal was to have as fast a slew as feasible. If it already doesn't overshoot dangerously, then using the same or slower slew shouldn't be hard to avoid overshoot, all else equal.

Most of your objections come down to "if you change X you might cause problems" when I'm saying not to change X.

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Thursday April 20, 2023 @12:33PM (#35642520)
> It should always be tri state. Never allow the positive and negative output transistors to get power at the same time.

I think this is the problem. Neither of those things make sense, plus they contradict each other because tri-state means neither is doing anything.

You know when someone is like "hey man, you're good with computers. I have this idea to predict the winner of baseball games. All you have to do is type my ideas into the computer and we can make millions on sports betting". That's basically the same thing.

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Thursday April 20, 2023 @02:10PM (#35643889)
You're describing magic and contradicting yourself. Tri-state means everything is off, so one transistor can't also be on at the same time. Damping dissipates heat, so damping by controlling the output transistor requires a bigger output transistor.

Down below the digital level, you can't isolate decisions from each other and nothing is free.

Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Thursday April 20, 2023 @02:38PM (#35644280)
> tri-state means everything is off, so one transistor can't also be on at the same time.

I'm using tri-state to mean it has three distinct states. The output transistors are not connected to the same enable line. If that's wrong use, I'm sorry.

The point I'm making is that it's easy to make it so the output transistors don't fight, even if the one that's enabled gets a halfsies voltage, because the other one won't also get a halfsies voltage, it will get a pure digital off.

> Damping dissipates heat, so damping by controlling the output transistor requires a bigger output transistor. Damping the output transistor also changes the electrical characteristics of the pin.

I'm assuming it's already kind of heat resistant because it only sometimes fails when shorted with no limiter at all. And if you damp it enough you won't make much heat. But fine, let's ignore that. You already brought up just turning it off at a certain point. If that's what's needed, so be it, because that won't change the characteristics.

No magic needed to keep the characteristics the same if you're just turning it off the way it normally turns off.

But I still don't understand how a transistor with a damped input is supposed to cause voltage spikes in excess of the same transistor with an undamped input, with only the control logic changing.

Re:Firmware is on shaky ground – let's see what it's made of by nunuvit on Thursday April 20, 2023 @03:02PM (#35644624)
At this level, we're creating the concept of a digital state, so we can't use that result to solve problems, it's circular logic.

If damping makes heat, how can damping it enough make less heat? Why are you assuming that it's heat resistant if this is the level where you design the amount of heat resistance it has? Who did that work? Nobody, you have to do it yourself.

There is no control logic. It's analog. Logic is digital. Digital doesn't exist until we're done.

Sorry, but I've done all I can. Good luck in your search.

Re:Firmware is on shaky ground – let's see what it's made of by Dylan16807 on Thursday April 20, 2023 @03:53PM (#35645369)
> If damping makes heat, how can damping it enough make less heat?

Slowing the current flow without a buck converter means you're going to be acting like a resistor and turning the voltage drop into heat.

Ideally this circuit has minimal voltage drop and minimal heat. As you start damping you'll increase the resistance, creating more heat.

But the heat is voltage drop multiplied by current, so as you keep increasing resistance the power dissipated will hit a peak and then start decreasing as current approaches zero.

A transistor that's off doesn't make enough heat to kill itself.

> Why are you assuming that it's heat resistant if this is the level where you design the amount of heat resistance it has? Who did that work? Nobody, you have to do it yourself.

Because the premise is that it can survive short circuiting for some amount of time, and I want to increase that time. But also I'm willing to say "keep dropping the max current until it survives reliably, and let's see where we are at that point". I know that point does exist somewhere, even before I do any math.

> There is no control logic. It's analog. Logic is digital. Digital doesn't exist until we're done.

We can make an analog circuit output a digital decision.

The output transistor is always analog. But the already existing circuit controls it digitally, and we can continue to control it digitally if we want to.

There's no circular reasoning in "this partially analog circuit monitors a wire and outputs a digital signal based on some threshold"

> Sorry, but I've done all I can. Good luck in your search.

Cool but it feels like you purposefully ignored everything I said about keeping it simple and leaving most of the circuit unchanged, demanding I solve already-solved issues just to spite me... did you actually try to listen to me, or were you here just to come up with reasons I must be wrong?