Hi all,
I have a rPi (model b+), and added a GrovePi bought from gotronic.fr (end december 2014).
I’m not sure what firmware version came in (either 1.0 or 1.1) in the PIC, and apparently, no way to know.
After GrovePI setup & install with procedure on this site, I’m successful in detecting the I2C slave 0x04 and communicate with the slave (reading sound level sensor on A0), with the default bus speed (100 kHz).
As I plan to use more i2c chips on the pass-thru i2c connectors on the grovePi, and I need quite high number of R/W operations, I want to use higher bus speed.
So I add baudrate parameter in /etc/modprobe.d/i2c_perso.conf like this :
options i2c_bcm2708 baudrate=200000
then I unload/reload the driver :
modprobe -r i2c_bcm2708
modprobe i2c_bcm2708
At 200 Khz, GrovePI is still detected fine and operates correctly (my sound level reading are still fine).
pi@pi-orv-LG-01 ~ sudo cat /sys/module/i2c_bcm2708/parameters/baudrate
200000
pi@pi-orv-LG-01 ~ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
However, some time later, GrovePI slave 0x04 disapear.
pi@pi-orv-LG-01 ~ sudo cat /sys/module/i2c_bcm2708/parameters/baudrate
200000
pi@pi-orv-LG-01 ~ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
Then, even changing the frequency back to 100 Khz will not help. It’s now impossible to detect and use the GrovePi.
Only changing freq back to 100 Khz + a power cycle will help.
When slave 0x04 does not respond, I verified that both SDA1/SCL1 are still operating (ie not stick to 0 or 1) with an oscilloscope. so this is not a chip (CPU from PI, or PIC from GrovePI) which holds one of the lines.
Second test is with additionnal MCP9808 i2c slave (0x18) on one of the i2c ports of the Pi.
pi@pi-orv-LG-01 ~ sudo cat /sys/module/i2c_bcm2708/parameters/baudrate
100000
pi@pi-orv-LG-01 ~ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- 18 – -- – -- – -- –
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
both read/write fine.
Then I set speed to 200 Khz again (unload/reload driver)
pi@pi-orv-LG-01 ~ sudo cat /sys/module/i2c_bcm2708/parameters/baudrate
200000
pi@pi-orv-LG-01 ~ sudo i2cdetect -y -r 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- 18 – -- – -- – -- –
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
and still both read/write fine.
GrovePi will not fail apparently at 200 Khz, if other chip is connected to the bus.
My understanding is that additionnal pull-up resitors on the mcp9808 might help. (unsure yet since GrovePi is connected on Rpi side of the bus, while MCP9808 is after the adaptation transistor).
Now, 200 Khz is still not enough for me. Ideally, I want to reach 400 Khz.
However, when I set speed @ 300 Khz, I loose both grovePi and MCP9808.
Did anybody try higher i2c speeds with grovePi with success ?
I will try to flash the PIC with 1.1 firmware, just to make sure I’m not using a preloaded 1.0. (note, I received the grovePi with the 4 solderpads already soldered, I only need to cable the reset pins to get it updated).
Any comment/thought welcome.
Rgds
Laurent