Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Support => Topic started by: Sev on August 20, 2010, 09:58:52 am

Title: BlinkM & Bus Pirate I2C
Post by: Sev on August 20, 2010, 09:58:52 am
I have a couple of BlinkMs and have been using them to familiarize myself with the Bus Pirate.  Both BlinkMs work; this has been confirmed with a connection to an arduino and the I2Cscanner sketch; both of them are set to address 0x09, as they should be by default.  I have the bus pirate's GND to "-", 3.3v to +, CLK to 'c' and MSIO to 'd'.  I also have the 3.3v ICSP voltage bridged to Vpu.  (I've tried it both with and without this, and it doesn't matter.)

Anyway, they don't show up in the BP's scan macro "(1)", and "I2C>[0x09" gets a NACK.  "[0x00;"n";0xFF;0x00;0x00]", which -should- cause all BlinkMs on the circuit to change to red, doesn't change anything on the blinkM. 

I've tried interfacing the other I2C device I have, a TMP102 sensor, and I can't get a response on the address scan for that one, either.

Am I missing something here?  Thanks.
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: ian on August 20, 2010, 10:11:26 am
Hi Sev - Thanks for the report. Can you please paste the entire log of your session so I can have a look.

What Bus Pirate hardware/firmware version (i menu) do you have?

Make sure you press 'P' to enable the pullups, and check for a valid pullup voltage on the 'v' menu. This hasn't been as much of an issue now that the firmware warns when there is no pullup.

Here's the I2C documentation:
http://dangerousprototypes.com/docs/Bus_Pirate_I2C (http://dangerousprototypes.com/docs/Bus_Pirate_I2C)
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: Sev on August 20, 2010, 10:29:04 am
Whoops.  I previously had the d pin connected to MISO not MOSI.  (Stupid dyslexia.)  However, now that I've fixed that, I'm getting weird results, still.  It's returning the addresses as if I didn't enable the pull-ups.  I'm using a new v3 from Adafruit.

The only thing connected is the BlinkM via jumpers.

HiZ> i
Bus Pirate v3b
Firmware v5.6 (r473)  Bootloader v4.3
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com (http://dangerousprototypes.com)
HiZ> v
Pinstates:
1.(BR)   2.(RD)   3.(OR)   4.(YW)   5.(GN)   6.(BL)   7.(PU)   8.(GR)   9.(WT)   0.(Blk)
GND   3.3V   5.0V   ADC   VPU   AUX   CLK   MOSI   CS   MISO
P   P   P   I   I   I   I   I   I   I   
GND   0.00V   0.00V   0.00V   3.31V   L   L   L   L   L   
HiZ> m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. KEYB
9. LCD
x. exit(without change)

(1)> 4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)> 2
Ready
I2C> W
Power supplies ON
I2C> P
Pull-up resistors ON
I2C> v
Pinstates:
1.(BR)   2.(RD)   3.(OR)   4.(YW)   5.(GN)   6.(BL)   7.(PU)   8.(GR)   9.(WT)   0.(Blk)
GND   3.3V   5.0V   ADC   VPU   AUX   SCL   SDA   -   -
P   P   P   I   I   I   I   I   I   I   
GND   3.29V   5.04V   0.00V   3.30V   L   H   H   H   H   
I2C> (1)
Searching I2C address space. Found devices at:
0x00(0x00 W) 0x12(0x09 W) 0x13(0x09 R) 0x14(0x0A W) 0x15(0x0A R) 0x16(0x0B W) 0x17(0x0B R) 0x18(0x0C W) 0x19(0x0C R) 0x1A(0x0D W) 0x1B(0x0D R) 0x1C(0x0E W) 0x1D(0x0E R) 0x1E(0x0F W) 0x1F(0x0F R) 0x20(0x10 W) 0x21(0x10 R) 0x22(0x11 W) 0x23(0x11 R) 0x24(0x12 W) 0x25(0x12 R) 0x26(0x13 W) 0x27(0x13 R) 0x28(0x14 W) 0x29(0x14 R) 0x2A(0x15 W) 0x2B(0x15 R) 0x2C(0x16 W) 0x2D(0x16 R) 0x2E(0x17 W) 0x2F(0x17 R) 0x30(0x18 W) 0x31(0x18 R) 0x32(0x19 W) 0x33(0x19 R) 0x34(0x1A W) 0x35(0x1A R) 0x36(0x1B W) 0x37(0x1B R) 0x38(0x1C W) 0x39(0x1C R) 0x3A(0x1D W) 0x3B(0x1D R) 0x3C(0x1E W) 0x3D(0x1E R) 0x3E(0x1F W) 0x3F(0x1F R) 0x40(0x20 W) 0x41(0x20 R) 0x42(0x21 W) 0x43(0x21 R) 0x44(0x22 W) 0x45(0x22 R) 0x46(0x23 W) 0x47(0x23 R) 0x48(0x24 W) 0x49(0x24 R) 0x4A(0x25 W) 0x4B(0x25 R) 0x4C(0x26 W) 0x4D(0x26 R) 0x4E(0x27 W) 0x4F(0x27 R) 0x50(0x28 W) 0x51(0x28 R) 0x52(0x29 W) 0x53(0x29 R) 0x54(0x2A W) 0x55(0x2A R) 0x56(0x2B W) 0x57(0x2B R) 0x58(0x2C W) 0x59(0x2C R) 0x5A(0x2D W) 0x5B(0x2D R) 0x5C(0x2E W) 0x5D(0x2E R) 0x5E(0x2F W) 0x5F(0x2F R) 0x60(0x30 W) 0x61(0x30 R) 0x62(0x31 W) 0x63(0x31 R) 0x64(0x32 W) 0x65(0x32 R) 0x66(0x33 W) 0x67(0x33 R) 0x68(0x34 W) 0x69(0x34 R) 0x6A(0x35 W) 0x6B(0x35 R) 0x6C(0x36 W) 0x6D(0x36 R) 0x6E(0x37 W) 0x6F(0x37 R) 0x70(0x38 W) 0x71(0x38 R) 0x72(0x39 W) 0x73(0x39 R) 0x74(0x3A W) 0x75(0x3A R) 0x76(0x3B W) 0x77(0x3B R) 0x78(0x3C W) 0x79(0x3C R) 0x7A(0x3D W) 0x7B(0x3D R) 0x7C(0x3E W) 0x7D(0x3E R) 0x7E(0x3F W) 0x7F(0x3F R) 0x80(0x40 W) 0x81(0x40 R) 0x82(0x41 W) 0x83(0x41 R) 0x84(0x42 W) 0x85(0x42 R) 0x86(0x43 W) 0x87(0x43 R) 0x88(0x44 W) 0x89(0x44 R) 0x8A(0x45 W) 0x8B(0x45 R) 0x8C(0x46 W) 0x8D(0x46 R) 0x8E(0x47 W) 0x8F(0x47 R) 0x90(0x48 W) 0x91(0x48 R) 0x92(0x49 W) 0x93(0x49 R) 0x94(0x4A W) 0x95(0x4A R) 0x96(0x4B W) 0x97(0x4B R) 0x98(0x4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EE(0x77 W) 0xEF(0x77 R) 0xF0(0x78 W) 0xF1(0x78 R) 0xF2(0x79 W) 0xF3(0x79 R) 0xF4(0x7A W) 0xF5(0x7A R) 0xF6(0x7B W) 0xF7(0x7B R) 0xF8(0x7C W) 0xF9(0x7C R) 0xFA(0x7D W) 0xFB(0x7D R) 0xFC(0x7E W) 0xFD(0x7E R) 0xFE(0x7F W) 0xFF(0x7F R)

I2C> v
Pinstates:
1.(BR)   2.(RD)   3.(OR)   4.(YW)   5.(GN)   6.(BL)   7.(PU)   8.(GR)   9.(WT)   0.(Blk)
GND   3.3V   5.0V   ADC   VPU   AUX   SCL   SDA   -   -
P   P   P   I   I   I   I   I   I   I   
GND   3.29V   5.04V   0.00V   3.30V   L   H   L   H   H   
I2C>
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: Sev on August 20, 2010, 10:35:47 am
nt
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: ian on August 20, 2010, 10:55:56 am
Hum, everything looks OK, maybe the blinkM doesn't like the address sniffer routine. Does this also happen with the TMP102?

Can you please double check the connections. On the Seeed cable (sold by adafruit) the grey wire is DAT and the purple is CLK.
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: Sev on August 20, 2010, 11:03:24 am
Yeah, I got confused with the Seeed cable and wound up just using female-female jumpers to the headers on the BlinkM.

Hrm.  Now that I have the right pins wired, the TMP102 seems to work with it.

I2C> v                                                                         
Pinstates:                                                                     
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     SCL     SDA     -       -      
P       P       P       I       I       I       I       I       I       I      
GND     3.26V   5.04V   0.00V   3.30V   L       H       H       H       H      
I2C> (1)                                                                       
Searching I2C address space. Found devices at:                                 
0x00(0x00 W) 0x90(0x48 W) 0x91(0x48 R)                                         
                                                                               
I2C> [0x90]                                                                    
I2C START BIT                                                                  
WRITE: 0x90 ACK                                                                
I2C STOP BIT           

I guess that there's definitely something weird about the BlinkMs -- and I'm too much of a noob to know.  Any ideas what I can do to get them working properly with this?  Thanks!
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: ian on August 20, 2010, 11:45:34 am
I'd guess the blinkM (because it's a microcontroller based device??? could be wrong) doesn't like being beaten around by the address sniffer, or maybe it just responds to all the addresses. I'd try it at a slower speed (1 instead of 2) maybe.

Also try to reset the BlinkM and interface it without running the address search, it might not be in such a dysfunctional state and you might get more from it.
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: Sjaak on August 20, 2010, 01:40:51 pm
i noticed you used the ';' delimeter. That is used for partial writes. Better to use space instead.

Btw there are several other threads about the blinkm. Iirc nobody succeeded :(
Title: Re: Can't seem to get Bus Pirate to do I2C
Post by: ian on August 20, 2010, 02:20:42 pm
Time for me to get one and figure out what's going on :)
Title: Re: BlinkM & Bus Pirate I2C
Post by: ian on August 20, 2010, 02:46:01 pm
I wrote and asked for samples. If I hadn't just bought stuff from Sparkfun, I would have ordered one from there.
Title: Re: BlinkM & Bus Pirate I2C
Post by: ian on August 25, 2010, 06:13:56 pm
The ThingM people are going to trade me a ThingM for a Bus Pirate. I hope to have one soon and I will keep you updated.
Title: Re: BlinkM & Bus Pirate I2C
Post by: ian on September 17, 2010, 05:17:27 pm
I just got the blinkM and tested it with Sev's syntax. It seems to be on a color changing loop by default. When I enter the syntax it snaps to red, but eventually continues to fade again (edit: not that it shouldn't, I haven't gone further yet).

Quote
I2C> m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. KEYB
9. LCD
x. exit(without change)

(1)> 4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)>
Ready
I2C> W
Power supplies ON
I2C> P
Pull-up resistors ON
I2C> v
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     SCL     SDA     -       -
P       P       P       I       I       I       I       I       I       I
GND     3.35V   5.00V   0.00V   3.27V   L       H       H       H       H
I2C> h
1. h
2. v
3. P
4. W
5. m
6. [0 "n" 0xff 0 0]
7. h
8. m
9. [0 "n" 0xff 0 0]
10. h
11. [0 "n" 0xff 0 0]
12. h
13. [0 "n" 0xff 0 0]
14. hx. exit

(0)> 6
I2C START BIT
WRITE: 0x00 ACK
WRITE: "n ACK"
WRITE: 0xFF ACK
WRITE: 0x00 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C> h
1. h
2. [0 "n" 0xff 0 0]
3. h
4. v
5. P
6. W
7. m
8. [0 "n" 0xff 0 0]
9. h
10. m
11. [0 "n" 0xff 0 0]
12. h
13. [0 "n" 0xff 0 0]
14. hx. exit

(0)> 2
I2C START BIT
WRITE: 0x00 ACK
WRITE: "n ACK"
WRITE: 0xFF ACK
WRITE: 0x00 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>
Title: Re: BlinkM & Bus Pirate I2C
Post by: todbot on September 30, 2010, 02:29:02 am
Hi,
It sounds like you got it working.  But the BlinkM will play its startup script unless explicitly told to stop.  You can stop the script from playing by sending the "Stop Script" command ('o' == 0x6f).
Title: Re: BlinkM & Bus Pirate I2C
Post by: ian on September 30, 2010, 04:05:47 pm
Thanks todbot - I plan to do a full demo, but haven't gotten around to it yet. This will help a lot.
Title: Re: BlinkM & Bus Pirate I2C
Post by: Miraculor on June 06, 2011, 08:05:24 pm
I am trying to make my BlinkM mini work wit my Bus Pirate and having issues too.

I can stop the script with broadcast address [0x00 "o"]
I can set the led to red with the broadcast address [0x00 "c" 0xff 0x00 0x00]
I can't read the device address [0x00 "a" r]
I cant send command to the default address [0x09 "c" 0xff 0x00 0x00]

Did someone manage to get this working ?
Title: Re: BlinkM & Bus Pirate I2C
Post by: Sjaak on June 07, 2011, 11:56:11 am
IIRC there is a command to set or display the address. The address could be set to something different then the standard 0x09.
Title: Re: Re: BlinkM & Bus Pirate I2C
Post by: Miraculor on June 13, 2011, 03:09:36 pm
I found the problem. The BlinkM adress is 7-bit plus one bit for R/W.
BlinkM 0x09 is 0x12 for writing and 0x13 for reading.
There are the command I am using:
[0x00 "o"]  stop the running script on all BlinkM
[0x12 "a" {0x13 r] read the address of BlinkM 0x09
[0x12 "g" {0x13 rrr] read the current color of BlinkM 0x09
[0x12 "n" 0xff 0x00 0x00] set BlinkM 0x09 to Red

I hope the information will be able to help someone else.
Title: Re: Re: BlinkM & Bus Pirate I2C
Post by: ian on June 17, 2011, 02:10:06 pm
Thanks for the update. I'm glad you got it going . I'll add a wiki page for this part.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01172133416session_write_close ( )...(null):0
20.01202265008ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01202265784Database_MySQL->query( ).../DatabaseHandler.php:119
40.05772404512Database_MySQL->error( ).../Db-mysql.class.php:273