cancel
Showing results for 
Search instead for 
Did you mean: 

I2C BUS WITH 2 DIFFERENT SPEED

a3b
Associate II
Posted on April 02, 2004 at 15:19

I2C BUS WITH 2 DIFFERENT SPEED

4 REPLIES 4
a3b
Associate II
Posted on May 17, 2011 at 11:59

Hello,

Someone could tell me if it is possible to use both I2C ports 1 and 2 of UPSD3234A but with different speed:

- one at 100 KHz to accomodate old componants like SAA1064,

- the other at 400 KHz to have communication with E2PROMS, Clock...

joseph2399
Associate II
Posted on May 17, 2011 at 11:59

Both I2C ports are clocked with the same programmable clock source so it is not possible to run one at 100KHz and the other at 400KHz.

Correction: Each I2C port has a SxCON register. There are three bits in this register that control the speed of the respective I2C port. Sorry for the mixup.

[ This message was edited by: uPSD on 02-04-2004 17:49 ]
joseph2399
Associate II
Posted on May 17, 2011 at 11:59

You are correct. Sorry about the mixup.

a3b
Associate II
Posted on May 17, 2011 at 11:59

Hello moderator,

I must disagree with you, I tested it and it works: the only difference between the 2 I2C apart of speed is that I2C-2 can be handled under interrupts, while i2C-1 not.

void upsd_i2c_2_init (void){

P3SFS |= 0xC0; // Enable P3.7 for SCL, P3.6 for SDA

S2CON |= I2C_400KHZ;// Setup I2C-2 for 400KHz (24 MHz XTAL)

S2SETUP= STANDARD_HOLD_TIME_START_STOP; // 0x86

i2c_timeout_flag = 0; // clear timeout error flag

IPA |= 0x02; // set high priority for EI2C

IEA |= 0x02; // set EI2C I2C Int. Enable bit

}

void upsd_i2c_1_init (void){

P4SFS |= 0x03; // Enable P4.0 for SDA, P4.1 pour SCL

S1CON |= I2C_100KHZ;// Setup I2C-2 for 100KHz (24 MHz XTAL)

S1SETUP= STANDARD_HOLD_TIME_START_STOP; // 0x86

i2c_timeout_flag = 0; // clear timeout error flag

// no interrupts for I2C-1

}