Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: Mouchon on August 26, 2013, 05:02:11 PM

Title: i2c bus frequency
Post by: Mouchon on August 26, 2013, 05:02:11 PM
Hi Can some one tell me what's the i2c bus frequency
on the board and if there is a way to change it at runtime ?

Title: Re: i2c bus frequency
Post by: XFer on August 26, 2013, 05:05:40 PM
I somehow recall it's fixed at 400 KHz, but I have to check it tonight at home.
Title: Re: i2c bus frequency
Post by: Mouchon on August 26, 2013, 05:10:28 PM
doh,
i need a 50khz one
Title: Re: i2c bus frequency
Post by: Mouchon on August 26, 2013, 06:29:42 PM
looked with a digital analyser and it seem to be 100khz
Title: Re: i2c bus frequency
Post by: XFer on August 26, 2013, 08:51:50 PM
Sorry, I just checked: I disabled i2c support from my latest kernel build so I don't know which is the default clock and if it's configurable.
Anyway there's no i2c section in the script.bin, which smells of fixed clock.

Fernando
Title: Re: i2c bus frequency
Post by: HeHoPMaJIeH on August 28, 2013, 10:17:29 AM

Quote from: XFer on August 26, 2013, 08:51:50 PM
Sorry, I just checked: I disabled i2c support from my latest kernel build so I don't know which is the default clock and if it's configurable.
Anyway there's no i2c section in the script.bin, which smells of fixed clock.

Fernando
Hi,
i2c speed is configurable in kernel source , look at this file :
arch/arm/mach-sun7i/include/mach/i2c.h


#define TWI0_TRANSFER_SPEED     (200000)
#define TWI1_TRANSFER_SPEED     (200000)
#define TWI2_TRANSFER_SPEED     (400000)



~Best
Title: Re: i2c bus frequency
Post by: XFer on August 28, 2013, 11:01:41 AM
So it's either 200 KHz or 400 KHz, selectable in the header file.

Thanks for the tip.

Fernando
Title: Re: i2c bus frequency
Post by: Mouchon on September 04, 2013, 04:19:37 PM
Made different test and was able to configure frequency to 50khz on i2c-1
with stage/sunxi-3.4. I will try to adapt modules i2c-sunxi to make frequency change as module param or flex configuration entry.