www.8devices.com
View unanswered posts | View active topics It is currently 16 Sep 2014, 09:23



Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next
 Carambola2 I²C 
Author Message

Joined: 29 Apr 2013, 10:06
Posts: 20
As Carambola2 lacks I²C support, I'm wondering if some of you already have solved this; for example, via SPI-I²C bridges.

In particular, a device which is already supported by Linux would be very neat. Any ideas?

Thanks
Felicitus


26 May 2013, 15:06
Profile

Joined: 18 Mar 2012, 19:06
Posts: 51
Dear Felicitus,
I will share my experience with you:

1. Choose gpio pins for SDA,SCL. My choice was GPIO 19 ,GPIO 20 soldered with resistors to 3.3V.
2. Rebuild kernel with modules:
Quote:
CONFIG_PACKAGE_kmod-i2c-core=y
CONFIG_PACKAGE_kmod-i2c-algo-bit=y
# CONFIG_PACKAGE_kmod-i2c-algo-pca is not set
# CONFIG_PACKAGE_kmod-i2c-algo-pcf is not set
CONFIG_PACKAGE_kmod-i2c-gpio=y
CONFIG_PACKAGE_kmod-i2c-gpio-custom=y
# CONFIG_PACKAGE_kmod-i2c-mux is not set
# CONFIG_PACKAGE_kmod-i2c-tiny-usb is not set
CONFIG_PACKAGE_i2c-tools=y


3 . echo i2c-gpio-custom bus0=0,19,20 > /etc/modules.d/66-i2c-gpio-custom

That is all. I2C bus clock operate about 83 kHz.


27 May 2013, 10:03
Profile

Joined: 29 Apr 2013, 10:06
Posts: 20
That's pretty neat, thank you for sharing! I originally thought that I need a SPI->i²C bridge, but that's elegant, too!


27 May 2013, 10:08
Profile

Joined: 08 Oct 2013, 18:13
Posts: 5
I2C support is in code from git now:
https://github.com/8devices/carambola2/ ... dd7a1b6d35
There it says:
Quote:
i2c pins: sda - GPIO18, scl - GPIO19

I used recent code, and my Carambola2 says while booting (got it with "dmesg | grep i2c"):
Quote:
[ 0.550000] i2c-gpio i2c-gpio.0: using pins 18 (SDA) and 19 (SCL)

I connected a RTC that works fine using annother board to Pins 18 and 19 of the Carambola 2 module using 10k pullup resistors to 3.3 V. Unfortunately, this does not work.
The problem is: "using pins 18 (SDA) and 19 (SCL)" means in fact GPIO 18 and 19.

To get this clear: When using the Carambola2 eval board, connections are like this:
SDA is GPIO 18 -> Pin 6 of Carambola2 module -> Pin 10 of J12 of eval board
SCL is GPIO 19 -> Pin 5 of Carambola2 module -> Pin 11 of J12 of eval board

Hope that helps avoinding the trouble I had when i mixed up pins and gpios.


08 Oct 2013, 19:38
Profile
User avatar

Joined: 11 Jun 2013, 11:34
Posts: 38
tty wrote:
Dear Felicitus,
I will share my experience with you:

1. Choose gpio pins for SDA,SCL. My choice was GPIO 19 ,GPIO 20 soldered with resistors to 3.3V.
2. Rebuild kernel with modules:

3 . echo i2c-gpio-custom bus0=0,19,20 > /etc/modules.d/66-i2c-gpio-custom

That is all. I2C bus clock operate about 83 kHz.


Hi tty,

May you please shed some light on how this solution makes the GPIO pins open drain?


12 Oct 2013, 15:26
Profile

Joined: 18 Mar 2012, 19:06
Posts: 51
Quote:
May you please shed some light on how this solution makes the GPIO pins open drain?


Are you planning SCL stretching or another bus master ?


12 Oct 2013, 22:04
Profile
User avatar

Joined: 11 Jun 2013, 11:34
Posts: 38
tty wrote:
Quote:
May you please shed some light on how this solution makes the GPIO pins open drain?


Are you planning SCL stretching or another bus master ?


SCL stretching


13 Oct 2013, 04:51
Profile

Joined: 18 Mar 2012, 19:06
Posts: 51
Because of not true_I2c bus I am afraid there are not open drain pins. Have a look at this:

PU/PD Resistance 200 kOm


Attachments:
gpio_c.png
gpio_c.png [ 32.41 KiB | Viewed 2301 times ]
13 Oct 2013, 09:47
Profile
User avatar

Joined: 11 Jun 2013, 11:34
Posts: 38
tty wrote:
Because of not true_I2c bus I am afraid there are not open drain pins. Have a look at this:


Thanks, that's what I suspected too. Do you have any idea how to make a bidirectional CMOS 2.5 <-> open drain buffer?


13 Oct 2013, 13:03
Profile

Joined: 18 Mar 2012, 19:06
Posts: 51
There is a 2.2K resistor on each I2C line. The lines are effectively pulled up to 3.3V, resulting in approximately 1.5 mA of pull-up current.
A good rule of thumb is that if a downstream I2C device can sink more than 5 mA of current, the protocol should operate properly. I think there is no problem to stretch SCL, you can try it.


13 Oct 2013, 16:25
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page 1, 2, 3  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.