You might already have the hardware on hand to easily interface I2C and SPI devices with Python scripts on your computer. The board seen above is an FT-2232 breakout board. These chips are often used to facilitate JTAG programming via USB, but they have other features that might be useful to you as well. The chip has a Multi-Protocol Synchronous Serial Engine (MPSSE) which can speak the I2C and SPI protocols, you just need to know how to active them in your code.
[Craig] makes this easy with his MPSSE Python wrapper. Simply install his module, and you’ll be able to import all the commands you need. He demonstrates reading the data out of a 1 MB SPI flash memory chip. This could be used for a lot more, including debugging peripherals à la the Bus Pirate, or reprogramming chips to add to your projects (we’re thinking font arrays and sprites for displays, or look-up tables).
If you’re not aware, these FTDI chips were the go-to for USB support for a long time. We’ve got a guide for bit-banging using this hardware. Lately more chips have become available with USB hardware built-in. They’re quite useful and cost-effective, especially with the availability of open-source stacks like the LUFA project.
Next up: a 7805 stabilizes voltage.
It’s as if you psychically KNEW I spent all last night struggling with the FTDI-provided MPSSE solution. This article is much clearer, and much appreciated!
whenever you touch MPSSE, you end up spending lots of time ;-)
http://lab.futuretech.in/content/fpga04/index_comspi.html
à la the Bus Pirate??? i guess that’s why Ian made the busblaster
The FT-2232 should not be confused with the FT-232R. The FT-2232 actually has native support for JTAG, SPI and I2C protocols. FTA:
“The FT-2232′s Multi-Protocol Synchronous Serial Engine (MPSSE) also supports the SPI and I2C protocols, clock rates of up to 30MHz, and a full-speed USB interface.”
So this will be much faster than trying to bit-bang these protocols through a FT-232R, and probably faster than many uC’s too.
@drew:
Yes, the busblaster is based on the FT-2232 chip as well, but AFAIK it is targeted primarily at JTAG. With this library you can extend its functionality to support SPI and I2C as well (although you may need to re-program the CPLD too).
A quick heads up: this ic does not support SPI mode 1 and 3, which is quite annoying.
FTDI’s libmpsse_spi library does not support SPI modes 1 and 3, but the open source libmpsse library does.
I have tested mode 3 on an SPI flash chip and it works fine; I don’t have any devices that support mode 1 at the moment, but it looks good on the ‘scope.
AVRDUDE 5.11 now also supports the SPI MPSSE engine in these FTDI **232H/C/D chips. This is handy for you Arduino types if you need to reinstall the Arduino bootloader. You can grab the Windows version at http://helix.air.net.au
FTDI says the LibMPSSE_SPI is supposed to be a good starting point for your development with FT2232H and the like.
Thanks for the article pointing towards the open libmpsse implementation – will have to give it a go when libmpsse_spi fails to deliver SPI_ReadWrite.