SWO logger from M5STACK

Hi all, a short update on SWO logger. I managed to implement a very basic SWO data logger based on M5STACK device. Looks nice and works well (see the picture below where my test setup is shown). I have to admit though, that this thing turned out to be not as simple as expected. Now it needs some real-life testing. I’ll use it for some of my future projects and let you know about my experience. I hope it worth the time spent on it.

img_20180828_180254

  • – the white thing on the picture is a power bank, small blue PCB is the “device under test” stm32 “bluePill”, black box with LCD – m5stack that runs my SWO data logger software.

SWO trace logger?

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!

Esp32 40Msps oscilloscope project is closed and here is why.

Hi everybody, since my first post about the project I have made a couple video demonstrations and built several prototypes. I invested in the project a huge amount of time, but this is the time to admit that the project has failed. And I want to explain why.

The largest problem – incomplete unclear and misleading documentation of the esp32 chip. According to the specification, esp32’s I2S is able to work at 40MHz clock rate, but it’s not true (at least for parallel mode). According to my experiments and some information from other developers the maximum speed is 20MHz but even at this speed not all FIFO modes work. I have spent a couple of weeks investigating the problem and wondering why I2S at high speed puts 2 absolutely identical samples in the buffer. I found that other developers have the same problem and obviously it’s esp32 limitation.

The second problem – no JTAG debugging support. Unfortunately, I didn’t manage to make JTAG for esp32 work properly. Developers of “Sloeber IDE” did a greate job to create a fully functional IDE for Arduino platforms, but for some reasons, my j-Link doesn’t work with esp32’s OCD server from Espressif properly. When there is no proper documentation for the chip a proper debugger becomes a crucially important part of a successful development. But it’s not the case for esp32 (at least now, I hope in future it will be better).

The third problem – analog frontend of a high-speed oscilloscope is not a simple thing. Yes, my knowledge in analog electronics is relatively limited and it took me a while before I realized that I have underestimated the complexity of this part of the project. My goal was to create a very simple and cheap hardware that could be easily assembled by an amateur, but it seems to be not possible. Without shielding, bus drivers, operational amplifiers and other parts of a proper analog frontend it simply doesn’t work with proper quality. And when you put all of this in the project it becomes neither simple nor cheap.

So to summarize:

  1. My initial goals for the project (40Msps, low-cost and simple schematic) are not reachable with esp32 and selected hardware architecture. I think that 20Msps is a too slow speed.
  2. The development effort for esp32 is unacceptably high due to bad documentation and absence of proper debugging tools. But this statement is true only when you are doing something unusual. With typical tasks like web server hosting and wifi communication esp32 works well.

Esp32 oscilloscope 40Msps!

Hi, here is the first try with real HW of my new project – esp32 based wireless oscilloscope with 40Msps speed (battery powered oscilloscope with web interface built with web sockets and javascript).

Due to some software mistakes, the signal doesn’t look really good, but I found the problem and now waiting for PCB to improve also hardware quality. Hopefully, on the next video, we will see a beautiful picture with all features of a good oscilloscope (various trigger settings and low noise). Stay tuned!

EasyVolts_rev3 GUI sources

Hi, this post is just to let you know that sources of the EasyVolts GUI tool are now open source. Please find the project at this link. It’s free to modify and use, so you may use it to create your own tool that would better fit your needs. Also, it’s cross-platform because written on Python, so you won’t be limited by a particular platform.

Some updates

Hi everybody, in this post I want to tell you the latest news about my projects. First of all EasyVolts rev3 is now available on Tindie.com for a purchase. And the second update – I’ve started a new project of esp32 based wireless oscilloscope which is completely open. I’ve already posted sources for my experiments and some demo video is below. Bye!

PS. Sorry for the terrible quality, I was pretty excited that my code worked as expected and couldn’t resist sharing my demo immediately ))

EasyVolts rev3 is here!

Hi, I got samples of the latest version of the EasyVolts – rev3 version!

EasyVolts_rev3

In this version, the max power that can be converted by the device was increased to 5W. It lets the device to work with USB2.0 hosts that can provide 1a or more (for example USB3.0 or high power USB2.0 hosts). Also, current measurement and overcurrent protection functionality were improved. I hope this revision is the final one so I did full testing and measured actual parameters of EasyVolts power converter. Here is the efficiency of the device at max output power for different output voltages with input power limited to 2.5W (normal USB2.0): EasyVolts_rev3_Efficiency

For 5W input power, we can get ~2 times more output power (but output current must be less than 1a). I hope EasyVolts will be available for purchase soon.

IMG_20180127_125108

IMG_20180127_125029