Skip to main content
rahul
Associate II
November 7, 2008
Question

i2C1 pin remapping

  • November 7, 2008
  • 3 replies
  • 1272 views
Posted on November 07, 2008 at 02:30

i2C1 pin remapping

    This topic has been closed for replies.

    3 replies

    rahul
    rahulAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:51

    i wonder if anybody out here has succcessfully used pin remapping .

    if yes , then plz do share the things that must be taken care of for this.

    rahul
    rahulAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:51

    Here is the code that i am trying out .

    void gpio_init ()

    {

    GPIO_InitTypeDef gpio_initstruct ;

    // Remapping of I2C1

    RCC_APB2PeriphClockCmd ( RCC_APB2Periph_AFIO , ENABLE ) ;

    msdelay ( 5 ) ;

    GPIO_PinRemapConfig(GPIO_Remap_I2C1, ENABLE) ;

    gpio_initstruct.GPIO_Pin = 0xFC79 ;

    gpio_initstruct.GPIO_Speed = GPIO_Speed_50MHz ;

    gpio_initstruct.GPIO_Mode = GPIO_Mode_Out_PP ;

    GPIO_Init ( GPIOB , &gpio_initstruct ) ;

    // I2C pins initialised to alternate function open drain mode

    gpio_initstruct.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 ;

    // gpio_initstruct.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7 ;

    gpio_initstruct.GPIO_Speed = GPIO_Speed_10MHz;

    gpio_initstruct.GPIO_Mode = GPIO_Mode_AF_OD;

    GPIO_Init (GPIOB, &gpio_initstruct ) ;

    gpio_initstruct.GPIO_Pin = 0x0F5F ;

    gpio_initstruct.GPIO_Speed = GPIO_Speed_50MHz ;

    gpio_initstruct.GPIO_Mode = GPIO_Mode_Out_PP ;

    GPIO_Init ( GPIOD , &gpio_initstruct ) ;

    }

    In the above code if i comment remapping part and initialise pins 6 and 7 instead of pin 8 and 9 for i2c1 then my i2c works fine but on remapping it doesn't .

    I am using STM103FRB controller ( 64-pin package) .

    rahul
    rahulAuthor
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 12:51

    i was trying to remap the i2c1 pins but its not working .

    any suggestions ?????????

    i have checked in hardware debugging through jtag that afio register does gets modified with i21_remap bit getting set but the communication does not takes place .

    However my i2c module starts working fine when i use normal pins without remapping .