2009-06-14 10:24 PM
I2C DR write make Arbitration lost detected flag to 1
2011-05-17 04:14 AM
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 codeCode:
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