3 ms·
Are there? If I look at a common MCU, my choices are UART, SPI and I2C. Out of those, UART is the only interface which can easily handle printf-style debug mes
by theamk 3y ago
Are there?
If I look at a common MCU, my choices are UART, SPI and I2C. Out of those, UART is the only interface which can easily handle printf-style debug messages without additional protocols. I can manage something with SPI or I2C in a pinch, but this would be non-standard and require special software on PC side. If I really hate UART for some reason I can set up SPI master, but this will just require 2 extra wires and a very special host adapter (all the ones I saw are master-mode).
More expensive micros have CAN and Ethernet. Ethernet is nice but needs magnetics, probably overkill for debug port; plus once you have Ethernet on-board no one is happy with raw frames, so you end up with ARP, DHCP, IP, TCP and lots of memory usage. CAN is pretty cool, but developer tools are overpriced and very bad, and most larger SOCs do not have support for it. Plus you still have to select baudrate for it :)
Sadly, there does not seem to be anything "new" people could agree too... The combined inertia of billions of microcontrollers will keep UART alive forever.
... but hey, if I were a head of R&D for microcontroller company, I'd totally design my own debug protocol. It'd be pulse based (to allow random clock rates but also keep line quiet when there is no output), potentially capacitively coupled (because I hate ground loops), use single signal wire + ground (because debug channel does not need full duplex), have integrated "packet end" mark and predefined packet types for text logs and binary TLV. It'd also have fully open debug tools. But I am not designing my own chips, so I am just using UART.
- wrs 3y agoTo be clear, this doesn’t currently exist, but the premise was that everyone agrees to switch to something else. (Which is an unlikely premise, but maybe if something got momentum…) Microcontrollers do have their own proprietary serial debug protocols. ARM SWD, for example, has been around for almost 15 years. It’s “proprietary”, but being ARM that means it’s in billions of chips from many manufacturers. It does require a clock line, though. https://www.ti.com/lit/wp/spmy004/spmy004.pdf https://www.ti.com/lit/wp/spmy004/spmy004.pdf I’m suggesting something much simpler though, just keep the UARTs and stick a Manchester encoder/decoder in between.