Invariably during development you need to look at a small number of signals because the circuit isn’t working correctly. What do you do?
Recently, I was writing code for the I2C interface on the STM32 and found that when I tried to read a known value from an accelerometer, the I2C transfer wouldn’t complete. I checked the code, the STM32 documentation, did searches on the net but couldn’t find anything that helped. To further confound things, I wasn’t using ST’s peripheral library – I had written the I2C code from scratch, so any fault, had to be mine.
I then remembered that I had a product called USBee which allows one to monitor a handful of signals and display the results on the PC. When I visited their website, much to my delight, I found that they had an additional application that would decode the I2C signals!
I proceeded to solder in the I2C header and connected up the USBee and within minutes, I was able to see the symptoms of the problem. To make sure that the target device wasn’t the problem, I used the USBee to run I2C transactions to the slave device and sure enough, the slave device was fine.
The I2C module on the STM32 is not very straight forward to use with the DMA engine. For example, if you want to read one byte, you have to use interrupts to read the byte. But if you want to read more than one byte, you can use DMA. This means that you need a special case for this. In the end, I was able to create an interrupt/DMA driven I2C driver that seems to work well and using the USBee analyzer, I was able to verify that the transfer met the I2C specs.
Please note that I am not advocating or associated with USBee but am simply pointing out that having the right tools for the job are really important and can make development faster and easier. It turns out that there are a number of alternatives with different degree of capability. For example, there is a similar device at Sparkfun called “Open Logic Sniffer”. It is much cheaper than the USBee but I haven’t used it and don’t know how well it works. I’d love to hear what other tools people have found that are useful. One tool I wish I had is a reasonably priced, high performance scope with logic analyzer capability so that I can capture sensor and emitter signals.