Channel: Predictable Designs with John Teel
YouTube ID:YnfpbCGyl-EDuration: 11 minutes
Takeaways
No takeaways generated.
Full Transcript
Most people think microcontrollers are simple, cheap, and slow, and that micro processors are complex, expensive, and fast. But in this video, I’m flipping that upside down because I’m comparing a 20 microcontroller that’s literally twice as fast. And here’s the weirdest part. Why is the microcontroller faster and why is it more expensive than the micro processor? Well, we’ll get to that. But first, there’s one critical difference between a microcontroller and a micro processor that I really need to tell you about because it explains everything. Hi, I’m John Teal. I was a microchip design engineer for Texas Instruments for over 10 years before developing and launching my own hardware product. And now I help others do the same. So when people hear microcontroller, they usually picture a little chip with some flash, some RAM, a bunch of peripherals, and your firmware running directly on the hardware. Power comes on a tiny boot ROM runs, it jumps straight into your code, and that’s pretty much it. There’s no operating system, no virtual memory, no processes, just raw native execution. A micro processor is built for something completely different, though. It’s built to run an operating system like Linux. That means external or high density RAM, a more complex boot flow, and most importantly, a MMU or a memory management unit. And the MMU is really the dividing line. If the core has an MMU, it can support virtual memory, process isolation, and everything that a modern operating system depends on. If it doesn’t have an MMU, then you’re in bare metal territory or maybe running a small real time operating system. So in the real world, a microcontroller gives you instant boot, deterministic timing, and tight control over everything happening on the chip. Nothing gets between you and the hardware. On the other hand, a microprocessor gives you Linux, drivers, file systems, networking, and the ability to run multiple applications. But you pay for that with complexity, higher power, and timing that’s never fully predictable. And that’s the real dividing line here. It’s not the clock speed or the price. It’s the memory architecture and the type of software the chip is designed to run. Now real quick, before we get into the details of these two really unusual chips, if you need help selecting the best microcontroller for your product, then I’ve created a free microcontroller selector tool for you. It just asks you a few questions about your product, and then it recommends the best microcontroller specifically for you. The link’s in the description below or you can just scan this QR code. So let’s start with the microprocessor, which is the all winner F1C100S, because this chip is really fascinating. It’s built around an old ARM9 core from the early 2000s. It’s a 32 bit architecture, so not modern by today’s standards, but still totally usable. The core runs at 533 megahertz, which is honestly pretty impressive for a 2 Linux board. But because the RAM is packaged with the processor, the layout becomes ridiculously simple. Suddenly, you’ve got a tiny Linux capable microprocessor that you can drop onto a straightforward PCB without advanced routing. That’s where you’ll find this all winner microprocessor is in cheap handhelds, kids toys, little media players, anything where cost is really critical. And it runs Linux, which gives you a big head start. Yeah, it runs a minimal Linux system, but you can still build perfectly usable little interfaces with it. You get USB 2.0, SD card support and an LCD controller, audio interfaces and enough horsepower for menus, audio playback and simple GUIs. And because it runs Linux, you get access to a ton of existing software that would be really painful to recreate from scratch on a bare metal microcontroller. All right, now let’s switch to the opposite end of the embedded world. And that’s the NXP IMX RT-1170. This thing is technically a microcontroller, but in raw real time performance, it absolutely out muscles a low end Cortex-A processor. The main core is a 1 GHz Cortex-M7. Yes, 1 GHz. And for microcontroller, that’s pretty ridiculous. It also includes a 400 MHz Cortex-M4 for handling other tasks in parallel. This NXP microcontroller is around 10 if you order it in higher volume. But even though it’s faster than the all winner Linux microprocessor, it cannot run Linux, not a real version of Linux. Yeah, there are some scaled down versions of Linux that it could technically run, but you lose memory protection, process isolation, and basically all the stuff that makes Linux valuable to start with. So in practice, nobody uses it that way. This microcontroller is built for something completely different, extremely demanding real time workloads with very predictable timing. It has two megabytes of on chip SRAM plus tightly coupled memory regions for each core so the critical code can run with single cycle latency. You can attach external memory if you really want to, but the entire memory system is designed around consistent access times and high execution speed, not juggling multiple processes under an operating system like is true with a microprocessor. That’s why you find this NXP microcontroller used in industrial automation, robotics, motor controller, instrumentation, audio processing, and advanced user interfaces where timing matters more than anything else. There’s no scheduler pausing your control loop, no virtual memory creating random stalls, no kernel waking up to do housekeeping at the worst possible time. For example, if you tell a microcontroller to run this interrupt every 20 milliseconds, well, it runs the interrupt every 20 milliseconds forever. So why is the microcontroller faster than the microprocessor? And why is the microcontroller the more expensive one? You’d think the Linux chip would be the pricey one, but part of the answer lies in the process technology. The NXP microcontroller is fabbed on a more advanced node with tighter tolerances that just costs more. It also has a bigger die with more on chip memory and more peripherals, but it’s also a completely different design philosophy. Microcontrollers are optimized for raw execution speed and deterministic behavior. They’re built to run tight loops at very high speed with predictable timing. So vendors squeeze every bit of performance out of them. Microprocessors like this all winter chip spend silicon on the MMU on caches tuned for general purpose workloads on memory controllers for high density RAM and on peripheral blocks that expect Linux drivers to manage them. Meanwhile, the NXP microcontroller skips the MMU. It uses a simpler memory hierarchy and focuses its silicon on compute performance, internal SRAM, and predictable bus structures. Don’t forget, if you need help selecting the best microcontroller for your product, then I’ve created a free microcontroller selector tool for you. It just asks you a few questions about your product and it recommends the best microcontroller specifically for you. The link’s in the description below or just scan this QR code right here. Memory is another area where the split between these two chips becomes obvious. The all winter microprocessor has 32 megabytes of on-package DDR1. Super impressive for a $2 chip. But once Linux boots, a good chunk of that memory is already spoken for. Between the kernel, background services, the file system, and your application, that memory gets eaten up fast. It’s enough for simple user interfaces and light workloads, but you’re always working within pretty tight limits. The NXP microcontroller lives in a totally different world. It’s all about fast internal SRAM with extremely low latency. There’s no kernel eating cycles, no background tasks you didn’t ask for, and your firmware owns the entire system. You control every byte and every cycle exactly how you want with a microcontroller. If you compare the all winter Linux chip and the NXP microcontroller in real-time workloads, the microcontroller absolutely destroys it. Even though the Linux chip runs Linux and sounds more capable, the raw cycle-to-cycle throughput of the microcontroller is in a totally different league. If you’re reading sensors, running control loops, or processing audio in real-time, the microcontroller is going to win by a huge margin. But if you want a GUI, media playback, a web server, or high-level software, the Linux chip wins instantly. Not because it’s faster, but because Linux brings a whole software ecosystem along with it. Now let’s talk about power for a moment. The all winter Linux chip always has something running in the background. Kernel threads, schedulers, timers, even when it looks like it’s idle. That means higher baseline power consumption. For anything plugged in, that’s probably not a big deal. But for long-life battery-powered products, that idle overhead starts to matter. The NXP microcontroller, on the other hand, can drop into very low power modes and wake up instantly with precise timing. It’s a much better fit when you need both high performance and long battery life, something Linux really struggles with. If you need help developing and launching a new electronic product, then check out my hardware academy. And if you found this video helpful, then check out this other video where I review some of the cheapest microcontrollers that you can buy today.