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.

This Post Has 3 Comments

  1. peteh

    I have not come across the USBee stuff before. Not the cheapest option but I couldn’t find anything else that would allow you to use so many protocols and talk directly to connected devices for near to this price. I shall have to save up for one. is it the -AX model?

    Remarkably, they are available from Amazon look here:

    USBee-AX Pro USB Multifunction Instrument

    For a similar price, Owon do a mixed signal, 25MHz oscilloscope with a built-in 16 channel logic analyser. This is a record-only thing though and would not allow you to talk to the devices.



  2. Harjit Singh

    I have the USBee ZX.


    Completely agree that they are really pricey. I’m hopeful that someone will take the Openbench Logic Sniffer logic analyzer and make it an output also device.


    Looks like the Bus Pirate is the more affordable alternative – if I didn’t have the USBee, I would probably get one of these.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.