2009-01-18 01:50 AM
i2c1 & FSMC
2011-05-17 04:00 AM
Hi,
I have seen jki has the same problem and have solve it. May be I do something wrong, but I2C1 does not run. Please help. I am using I2C1 and FSMC on a STM32F103VC. On the PB6 and PB7 and after RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, DISABLE), I2C1 works well. After RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC , ENABLE) and remap I2C1 to PB8 & PB9 I2C1 does not work. I do following: RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO | RCC_APB2Periph_USART1, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2 | RCC_APB1Periph_I2C1 | RCC_APB1Periph_PWR | RCC_APB1Periph_SPI2 | RCC_APB1Periph_BKP | RCC_APB1Periph_TIM2 |RCC_APB1Periph_DAC, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC | RCC_AHBPeriph_DMA1, ENABLE); ………. #define GPIO_PIN_I2C1SCL GPIO_Pin_8 #define GPIO_PIN_I2C1SDA GPIO_Pin_9 GPIO_PinRemapConfig(GPIO_Remap_I2C1, ENABLE); // Configure GPIOB Pin8 (SCL) & Pin9 (SDA) as I2C1 GPIO_InitStructure.GPIO_Pin = GPIO_PIN_I2C1SCL | GPIO_PIN_I2C1SDA; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; GPIO_Init(GPIO_I2C1, &GPIO_InitStructure); ……. Regards Klaus Haber2011-05-17 04:00 AM
Hi,
I found out following: The I2C1 runs on PB8 & PB9 when I also connect pull up resistors on PB6 & PB7. Have anybody an idea what it the reason for this reaction? Thanks, regards Klaus Haber