Greg Whitmore at Four-Three-Oh forum has written a quick how-to post on using the Bus Pirate to sniff SPI data on the MSP430. We’re reproducing the post here in its entirety with Greg’s permission.
“Bus Pirate, SUMP and the MSP430
To start off, this is not a tutorial but more of a quick how-to. The 1st post will be about using your Bus Pirate to “sniff” SPI data on your MSP430. Mostly, I’m posting this because I’ve never found clear instructions or examples on doing this but it’s been important in solving a lot of programming issues. The Bus Pirate is the handiest tool on my bench -it’s tiny and has a lot of functionality.
Bus Pirate -> MSP430
CS -> UCBxSTE (or your CS pin)
CLK ->UCBxCLK ( or your SPI clock pin)
MISO -> UCBxSOMI (or your SPI input pin)
MOSI -> UCBxSIMO (or your SPI output pin)
AUX -> SPI D/C or other Trigger source.
Alternative Sump Logic Analyzer Client
Labeled Client Project for MSP430
It’s a pretty simple process. Once you’ve downloaded the files, run either run.bat or run.sh for windows or linux. Open the Labeled Client Project, which will be MSP430_SPI_Scanner.olp
Once opened, you’ll see this:
Then, what I like to do, is create a logic trigger in my program. This is done, so I can determine exactly when I want to trigger the analyzer instead of relying on a clock source.
This code can be placed in your main.c:
Code: Select all
// manual logic trigger for analyzer
#define LOGIC_OUT P1OUT
#define LOGIC_DIR P1DIR
#define LOGIC_BIT BIT7
#define TRIGGER (LOGIC_OUT |= LOGIC_BIT)
Here I used P1.7 on the MSP430F2274. Change the port and bit configuration to suit your hardware. This will be the pin we connect to the AUX pin of the Bus Pirate. Then you can place TRIGGER; anywhere you’d like to start analyzing your data.
To being a capture, click on the ‘Start Capturing’ button. You’ll be presented with a configuration window. Select the configuration for your hardware; Analyzer Port is the com port for the Bus Pirate. Leave the speed at 115200bps and for Device Type, select “Bus Pirate OLS mode”. In the Acquisition tab, leave the default settings. Move to the Triggers tab; check the box to enable the trigger. For mode, select “Serial” and Channel to 0. The last step is select the Trigger Mask. We’re using Channel 4 (AUX on the Bus Pirate), so put a check in the 5th box from the right.
It should look like this:
Before pressing the capture button, prepare your MSP430 by making all the hardware connections and adding the TRIGGER macro. I like to use the CCS debugger together with SUMP. The capture button can be pressed and it will wait until you press Run in the debugger.
If all goes well, you’ll have a nice signal captured that looks similar to:
From here, select “Tools -> SPI Analyzer”. The proper channel and mode settings were saved as part of the Labeled Client Project, so just press “Analyze”. You will see all of the data that was transfer and at what times. Press close when you’re done reading.
The resulting window after Analyzing:
Here you can see that our Trigger was pulled high, CS was pulled low, no serial data was incoming, the clock is function properly and our outgoing datastream is “0xAE, 0x00, 0x10, 0x40, 0x00, 0x81, 0x8F…..” (BTW, that’s the init sequence for the OLED Booster Pack)
To scan again, just press the “Repeat Capture” button. This also works for I2C, UART and other protocols (with different settings, of course).”
Via the contact form.