Hi Hamish, > I must admit I struggle to see the difference between a > microcontroller and a very low end SoC/SBC, apart from the analogue > inputs (but AFAIK some SoCs/SBCs include analogue inputs too).
I'd welcome corrections, this is just the impression I'm formed from programming a few microcontrollers in C and assembler, e.g. swtch(). A microcontroller unit, or MCU, is more than a CPU. The Z80, 6502, 6509, etc., used in home computers of the 70s and 80s were CPUs; a chip which read instructions and executed them and accessed the outside world, including any memory other than its register file, over address and data pins. These days, a microcontroller will have on-board static RAM, and perhaps flash memory too for holding the code to run. If the flash isn't within the microcontroller's package then there will be support for external flash. General purpose binary I/O pins will be available for reading or writing. Simple ‘serial’ interfaces, like SPI, I²C, and CAN bus, will be available. An analogue-to-digital converter or two might be available to sample an analogue signal on an input pin. The CPU at the centre of the microcontroller still often lacks a floating-point unit so it can only do integer arithmetic, though fixed-point arithmetic is often good enough. And it probably won't have any memory protection unit either so all RAM is accessed at the same privilege level. Which isn't to say the CPU doesn't have different privilege levels when executing instructions, just that it can't be told a range of bytes are currently inaccessible to cause a fault on an invalid access. ARM's Cortex-M range, like the Pico's Cortex-M0+, are microcontrollers, according to ARM, which is why they're ‘M’ in contrast to the Cortex-A range which are for applications. An SoC which isn't a microcontroller would have double-precision floating-point and memory management in the CPU. Plus more complex peripherals like a GPU, SATA interfaces, etc. USB is a bit borderline, I think. Hardware-wise on the wire, it's quite simple, but the software stack to support it can be complex and so out of place on an MCU which may have limited flash to store all the code and RAM as low as hundreds of bytes. -- Cheers, Ralph. -- Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00 Check to whom you are replying Meetings, mailing list, IRC, ... http://dorset.lug.org.uk New thread, don't hijack: mailto:dorset@mailman.lug.org.uk