I tried redirection stuff before but couldn't get it working. After too much of Java I have realised that I have forgotten the basic C stuff :) that the printf doesn't flush the buffer. I just added fflush(stdout) in the code (spisniffer.c) and recompiled - this has resulted in my grep working.
I followed your advise and connected the remote with the 3.3V power output of the buspirate. The results are the same as before i.e as soon as you plug in to MOSI the RF link (pairing) between the remote and its game console stops. Remote and bus pirate are still powered ON though. Did not use opto couplers as I don't have any fast one's handy.
Please note if you plug the MOSI before switching on the remote, the RF link is not established at all, irrespective of the power source.
I disconnected everything and did some analysis just with the remote control's MOSI,MISO,CLK,CSN and GND
When I measure the resistance between GND and any of the pins in the remote i.e MISO,CLK,CSN - the multimeter shows infinite resistance.
However between MOSI and GND it shows 125K.
I tried the following analysis - removed buspirate completely from the picture.
Exp 1
Powered on the remote with 2xAA battery
The remote powered ON and the RF link between console and the remote was established - there is a LED for RF link which gets lit.
Now I took a jumper cable and inserted it to the GND pin - other end of the cable is isolated from any contacts, it is just floating.
Now I took another jumper cable and inserted to each one of the following pins one pin at a time, MISO,CLK,CSN. This cables other end is isolated and floating as well. I inserted in to MISO - RF linked stayed ON. Hence removed the jumper cable and inserted in to CLK and so on.
When the cable was inserted in to the MOSI pin on the remote the RF link stopped working.
Please note the inserted cable's other end is not connected to anything else and the other end is isolated.
I repeated this experiment several times and I got the same result each time.
Exp 2
Remote powered with 2AA batteries. RF link up.
I removed the extra jumper cable from GND, which was used in the previous experiment.
Now I tried inserting a jumper cable in to MISO,CLK,CSN one pin at a time - RF link stayed ON. The jumper cable's other end is isolated.
Only 1 cable is used and it is plugged and unplugged from each PIN.
I tried inserting it in to MOSI - RF linked stayed ON.
Moved the cable with reasonable force in the MOSI header to see whether to check whether any shorts, none - RF link stayed ON. Unplugged, replugged this cable in MOSI several times - RF link stayed ON.
With the cable plugged inside MOSI header, I inserted a separate jumper cable (not connected to any where) to the GND header - RF link stayed ON.
After a while, when the jumper wire was still plugged in the GND, I removed the jumper cable from MOSI. RF link dropped.
I repeated this several times and am able reproduce it every time.
The MOSI pin seems to disrupt the RF link only if the ground gets connected to something even if it is a simple wire.
The snooped data with RF link down is something like this (this data was captured when the remote was powered ON with MOSI plugged in and hence no RF link)
I have tested the buspirate SPISniffer utility against a PIC24 on a Microstick and a RaspberryPI, the SPI sniffer utility is picking up the data with out disrupting anything. So there doesn't seem to be a fault with the MOSI line on the buspirate.
No luck with the firmware upgrade - it is still behaving in the same way. I am going to try to sniff some other SPI traffic between a PIC24 and a RaspberryPI and see whether the sniffer really works on the buspirate. In that way I can probably eliminate whether the issue with the buspirate or the remote.
If that doesn't work, replace the [tt:]echo[/tt:] line with: [tt:]cat >/dev/ttyUSB0[/tt:] and type [tt:]$<enter>y<enter><Ctrl-d>[/tt:][/quote]
I am sorry to post to this old thread. Can you please update the firmware upgrade documentation to include the step described above to exit the terminal/screen. It is not quite obvious for some one new to screen.
Tried with laptop just on batteries. It didn't make any difference.
My earlier observations were with a Ubuntu Laptop.
I ran the test on a Windows 7 Laptop
However there is a change to my earlier observation, the pairing stays put with 3 pins connected i.e CS,CLK and MISO - it is only when MOSI is connected the pairing stops.
The pairing stays put with the three pins connected to the remote before or after it was switched ON.
But connecting the MOSI pin disrupts the pairing.
I will try to run the test again using Ubuntu to see whether I am able to reproduce the same behaviour as windows or whether I get my earlier issue of CS and CLK disrupting the pairing.
Thanks for you reply. I did try that i.e plugging everything between the buspirate and the remote. then turning on Sniffer and then remote. When I do that the remote doesn't get paired at all.
I got the bus pirate V3 yesterday. So still a newbie with it.
I am trying to snoop SPI data using it and have hit some problems.
I have a Wiimote like remote control for a game console.
The remote and the console both communicate wirelessly using NRF24L01 nordic chip.
The remote has a led on it to show that it is paired with the game console (you need to press a button on the console and the remote simultaneously to pair them, once paired they are paired for ever).
In the remote, a micro controller communicates with the nRF via SPI.
I am trying to use buspirate along with SPIsniffer utility to capture the data transfer between the microcontroller and the nrf chip on the remote.
On the buspirate, I run SPIsniffer program - it shows the following at start up
Parameters used: Device = /dev/ttyUSB0, Speed = 115200, Clock Edge= 1, Polarity= 0 Opening Bus Pirate on /dev/ttyUSB0 at 115200bps... Starting SPI sniffer... Configuring Bus Pirate... Entering binary mode... (OK) Happy sniffing! Press ESC to stop. Sync
At this point I have the remote and the game console both powered ON, the LED on the remote shows that it is paired with the game console.
When I start connecting the MISO,MOSI,CLK and CSN to corresponding pins on the remote control (there are proper header) the pairing light on the remote control goes off - i.e the remote and console no longer communicate.
After some trial and error, I have narrowed it to MOSI pin, i.e when the MOSI pin from bus pirate gets connected to the corresponding SPI pin on the remote, the pairing on the remote switches off. The remote has to be power cycled and bus pirate disconnected to enable the pairing again.
Because of this I am not able to get the SPI data when the remote is paired with the game console.
However I do get SPI data when there is no pairing - the following data gets repeated again and again from the SPI bus [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x0C(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x12(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x00(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x07(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x00(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x01(0x08)] [0x03(0x0E)0x20(0x03)] [0x00(0x0E)0x00(0x08)]
Could some one throw some light on to why the nordic chip looses its pairing as soon as a SPI probe is plugged in from buspirate and any ideas to over come it.