EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Miyuki on May 19, 2022, 06:11:05 pm

Title: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: Miyuki on May 19, 2022, 06:11:05 pm
Hi folks.
I'm using a USB Saleae logic analyzer (a cheap clone works well as I work mostly on slow stuff up to 1MHz) and it is a great tool when developing.
I want to ask if you have any experience with something that can do another way. To have a nice environment on PC and can send custom messages or reply over SPI, I2C, and others.
I know there are chips like FT2232HL, that can do the hardware part, but is there some nice software?
Or how do you deal with this issue?
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: oPossum on May 19, 2022, 07:30:38 pm
Bus Pirate can do it.

http://dangerousprototypes.com/docs/Bus_Pirate (http://dangerousprototypes.com/docs/Bus_Pirate)
http://dangerousprototypes.com/docs/Features_overview (http://dangerousprototypes.com/docs/Features_overview)
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: RoGeorge on May 19, 2022, 07:58:50 pm
Try sigrok https://sigrok.org/wiki/Main_Page

It can stack decoders, compatible with many logic analyzers and many lab instruments, has both command line and GUI, I don't know if it can also transmit.
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: Hawaka on May 19, 2022, 07:59:57 pm
I have been using this at work, software is pretty easy to use. But I do think it is quite expensive for what it is.

https://www.totalphase.com/products/aardvark-i2cspi/ (https://www.totalphase.com/products/aardvark-i2cspi/)

Also I would strongly recommend getting an USB isolator ;) 15$ to protect your PC and dongle is a little price to pay and definitely worth it.

Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: tooki on May 19, 2022, 09:34:59 pm
I have been using this at work, software is pretty easy to use. But I do think it is quite expensive for what it is.

https://www.totalphase.com/products/aardvark-i2cspi/ (https://www.totalphase.com/products/aardvark-i2cspi/)

Also I would strongly recommend getting an USB isolator ;) 15$ to protect your PC and dongle is a little price to pay and definitely worth it.
I use the Aardvark at work, too, and find it very useful, but indeed, quite expensive.

I bought some $6 USB-I2C interfaces (eval boards for a converter chip) which have demo software (including source code) available. It works… ish. It’d probably take a skilled desktop app programmer a day to write something to do interactive bus communication, and maybe a week to flesh it out with scripting like thr Aardvark software. Alas, I’m not that person… :(
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: bgm370 on May 19, 2022, 11:06:47 pm
Pyftdi is quite powerful for these kinds of tasks. I successfully used it to communicate using i2c, spi and jtag in various situations. 
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: tooki on May 24, 2022, 08:02:49 pm
But is there a GUI for it? I kinda assume that’s what the OP means.
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: jeremy on May 24, 2022, 11:36:24 pm
I made a device to use which does exactly this: https://github.com/jeremyherbert/polyglot-turtle-xiao - I use it practically every day for little automation tasks. Well, really it is a firmware for the ~$5 seeeduino xiao, I wanted to avoid manufacturing anything myself.

It basically just connects over USB, and then you install the python library with pip: https://github.com/jeremyherbert/python-polyglot-turtle . No PC drivers are required (although you need to tweak udev permissions on Linux as usual). Python usage is very simple.

There are examples on the GitHub page for SPI, I2C, PWM, DAC, ADC and GPIO, and it also exposes a USB to UART converter which shows up as a serial port in the PC. Works on any platform you can install python on.
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: Bassman59 on May 25, 2022, 04:35:31 pm
I have been using this at work, software is pretty easy to use. But I do think it is quite expensive for what it is.

https://www.totalphase.com/products/aardvark-i2cspi/ (https://www.totalphase.com/products/aardvark-i2cspi/)

Also I would strongly recommend getting an USB isolator ;) 15$ to protect your PC and dongle is a little price to pay and definitely worth it.
I use the Aardvark at work, too, and find it very useful, but indeed, quite expensive.

One more vote for Aardvark, they work as advertised.
Title: Re: What is the best way to send SPI,I2C, etc. messages from PC (for testing)?
Post by: MadScientist on May 25, 2022, 04:41:26 pm
Try i2cdriver.com

Both i2C and spi come with command line and GUIs that let you send i2C or spi commands