Hacker News new | ask | show | jobs
by LennyWhiteJr 1713 days ago
To elaborate on this, the feature sets on these low level microcontrollers are no standardized. There is no common API for them to implement. Even chips coming from the same manufacturer will have different hardware capabilities, and although low-level drivers can abstract that way to a certain extent, there will always be differences.

The biggest challenge is when you need to update your firmware to use a microcontroller from a different manufacturer. Often times these chips are specifically chosen due to the set of hardware functionality they offer, and the firmware is written to take advantage of that from the start. The two are coupled.

Now you are forced to use a different chip, and the firmware that was written for a specific set of hardware now has to be modified for a new chip that may have a different feature set. Things fine print on how things like Analog to Digital converters becomes extremely important.

2 comments

Even a single hardware iteration intended to be a drop-in replacement in some cases won't be due to relying on implementation-defined behavior that is not guaranteed by the datasheet and wasn't considered a constraint by the people designing the silicon. Sometimes it's a bug, sometimes it's just "didn't think that was important".

Either way, you're left with something where the saturation behavior changed, or it's no longer possible to read out a value without risk of corruption since they assumed it can be treated as write-only, or some other hard to find and debug problem.

Swapping out chips is an exercise in testing and risk management, and never should be done without care, even before we start talking about safety critical applications.

I see this as a failing of microprocessor design. I/O should be standardized and there should be high level API's that do not change across chips or companies. MCU's are intentionally fragile in this respect to try to lock buyers into one MCU product family. It is absolutely stupid that I/O ports work differently for different MCU's and don't use a common API. It means every designer always has to reinvent the wheel when moving to a new MCU. This must have had a huge negative effect on product reliability and innovation. It's also why many products have moved to using Arduino's.

There is also a huge lack of improvement in MCU designs. Why doesn't my SPI bus autonegotiate everything? Why can't the serial port do the same? This should all be available in hardware as a standard feature of the ports. What a waste of decades of engineering talent to have to repeatedly troubleshoot everything at the bit level.

Thank goodness they don't all use a standardized design. What if the standard design was the wrong one? You couldn't switch to a competitor with a better design!