cancel
Showing results for 
Search instead for 
Did you mean: 

I2C DR write make Arbitration lost detected flag to 1

jf2399
Associate II
Posted on June 15, 2009 at 07:24

I2C DR write make Arbitration lost detected flag to 1

1 REPLY 1
jf2399
Associate II
Posted on May 17, 2011 at 13:14

Hi all,

I'm trying to use the I2C1 on STM32F101, using the PB6 and PB7 pins.

I have configure the pin, the register of I2C to place my STM32 in Master mode, no DMA and I can generate the Start bit on I2C bus.

SB on SR1 change to 1 after the start, and when I Write slave device adress in DR, the chip tell me that there's an arbitration lost detected, and then Goes to Slave mode and free the bus.

Have you and Idea about this problem ??

Here's the init code and the test code .

Init Code :

Code:

unsigned int tmp ;

IC2CLOCKEN = 1; // a BBA to select clock on module I2C1

I2C1REMAP = 0; // BBA on Remap port of I2C

tmp= I2C->SR1 ;

tmp= I2C->SR2 ;

PE=1;

I2C1->CR2 = 0x0002;

I2C1->CCR = 0x0008;

I2C1->TRISE = 5 ;

PE=1;

I2C1_SWRST = 1; // BBA for SWRST on CR1

test code

Code:

unsigned int tmp ;

I2C1_SWRST = 0;

PE = 1 ;

I2C_START =1; // BBA on START on CR1

while (I2CSB !=1 ); // BBA on SB on SR1

I2C1->DR = 0x64; // --->>> makes Arbitration Lost detected flag to 1