how often have you had a nasty bug which is never happening in the lab but spoils your day by appearing on your firmware in field once a week/month/year? That’s a terrible problem that could make your sleep bad. It’s not a new problem in the embedded world and in high-risk applications it’s successfully solved with “black box” functionality that is logging all the important firmware events. But everything has its cost, such “black box” adds serious time and material burden to the project. You need to provide some non-volatile memory and CPU resources and space on the PCB for this purpose, it’s ok when your application is responsible for a rocket launch or an oxygen delivery for a submarine. Nobody cares about a few extra weeks of developer’s work and couple tens bucks for the hardware in such projects. But what can we do, for example, for a humble HVAC system for private households where each dollar for development and/or production cost is critical. Nobody wants to buy a thermoregulator that costs like a rocket even if it’s VERY reliable. And at the same time, nobody likes getting complains from customers if some “thermoregulator” doesn’t work as expected. And how many times have you met a situation when customer’s “as expected” actually didn’t comply to device manual or use conditions were out of specs? It would be good to have a cheap yet efficient trace logger so that you know exactly what’s going on with your device. You would get a useful data source for an issue investigation and your customers would get a fast solution to their problems. If only it was possible… Or… Maybe it’s possible?
I believe it’s possible. In many modern microcontrollers, there is so-called SWO (serial wire output) pin available, its something like a very fast UART TX pin with some extra features that can send out information about variable changes and/or simple text traces that could be used to control your firmware execution. And all of that with minimal load and delays for microcontroller’s core. Neat, isn’t it? A single pin on the uC which is a part of standard JTAG connector, but so much profit. SWO is supported by many debuggers now. But debugger doesn’t solve the problem of a long run-time trace recording. In most cases, you can’t drive across the country to connect your laptop to a device that has some problems and wait days or weeks before a problem appears to debug it. And here is my idea – SWO data logger. Very small and cheap device that can be connected to the programming port of the device to be investigated which will record all the SWO traces to SD card. You don’t have to send your software developer in an expensive business trip. Just send the logger by post, let it collect the data on site until the problem is reproduced and then investigate the log file. Profit!
After doing its job the logger can be sent back. No expenses for a “black box” hardware in series production, connect the “black box”(SWO logger) only when it’s needed. No problems with delays for UART prints – use all features of SWO to reduce load from a logging task. Such a tool would let us be more efficient and I want to develop it.
Stay tuned, bye!