Using his previous experience on his Atmel based BusNinja, [J]oby came up with the Launchpad SPI Explorer. The serial parser is based off his previously covered RPN Calculator. If you ever want to debug any SPI based device or sensors, you can talk to it using the Launchpad without writing any code. The interactive shell allows you to send SPI packets serially with the Launchpad acting as a gateway.
[sourcecode language=”plain”]
Example
——-
Controlling a Microchip MCP23S17 SPI 16-bit I/O expander:
[ b111:4 0x20 10:2 r:64 ]
Which translates to:
Assert CS
Write 7 7 7 7
Write 32
Write 10 10
Read 64 bytes
Deassert CS
[/sourcecode]
More on his Launchpad SPI Explorer here. Debug away!
These are the kind of great projects I like to find; Making a tool that helps you make even better stuff!
NJC’s oscilloscope project is another example. I have a USBTeensy laying around that I just found out I can turn into a BusPirate; another great tool.
Man, I love brilliant people who share!
+1 for sharing!
This is great. You know what would be even greater? An i2c version of this please please pretty please with sugar on top.
The BusNinja project of his does do I2C. Its a matter of porting the hardware layer.
In fact, the Bus Ninja (AVR) code has a bit banging i2c implementation in hw_i2c. It’s just delay loops, DDR registers and PORT writes so will be easy to port.
The code is all available and open source, so feel free to have a go.
Note: Bus Ninja has an abstraction layer (bus_X) to allow runtime switching between i2c/spi/etc. It’s just an array of function pointers, so would be easy to add back.
If you’re interested in a Bus Pirate-a-like for MSP430, check out GoodFet (http://goodfet.sourceforge.net/manual/).
Send me mail (jrt-msp430@hopdgepig.org) if you have any questions.
Hopefully it can do both the read/write, but also i2c spy options, of just listening and listing all i2c traffic. But the read/write part is incredibly useful by itself.
I never implemented a sniffer, just read/write and address detection.
Very cool project. Wished I’d had this six months ago. 🙂
Update: I did it. i2c nearly ground up from scratch, with Joby’s menu system, and NJM’s uart. Tested with a standard i2c 8bit port extender.
Comes in at 1920 bytes on standard IAR. I even added in a bruteforce slave scanner. Have enough room to add like one or two more things.
Will be immediately doing a MSP430G2231 -> i2c port expander -> character lcd.
Hopefully, I can use the usi for a i2c sniffer as well. Should be simple enough.
Great stuff. Is the code available?
Not yet. Need to properly test it with multiple i2c devices for the scanning mode, and with proper pull-ups. Which means actually soldering in the female headers first. Should be soon.
Very cool! So it becomes pretty easy to turn the 430 into a cheap multi-channel I2C ADC… ? that could come in handy for me…
Posted to the 43oh boards. Under Projects -> i2c Explorer
Am I the only one here that in no possible way can get this to work? i am not getting a console and when i try to make it send a char just after reset i get garbage?
seems like a clock problem to me, but it seems the clock should be correctly configured, any suggestions?
I have tried with and without external 32kHz crystal.
@Stefan Check the comments on my blog posting. Although it works fine for me, I’ve posted some bugfixes that others suggested.
http://blog.hodgepig.org/2010/09/10/575/
Also have a look at http://blog.hodgepig.org/2010/09/09/573/
and http://www.43oh.com/forum/viewtopic.php?p=956#p956
Can someone post the CCS project for this?
His site http://blog.hodgepig.org/ is down and not available on archive.org’s WaybackMachine.
But the code is probably here: https://github.com/tobyjaffey/spi-explorer
I2C-Explorer thread here: http://forum.43oh.com/topic/126-i2c-explorer/