cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with I2c1 on PB8, PB9 STM32F103VET6 using cube

Posted on September 18, 2016 at 18:56

Hi All,

I config I2C1 on PB8 and PB9 using CubeX. After run this function the sdw con not run and disconnect with chip. When I debug i saw  hte program run before  __HAL_AFIO_REMAP_I2C1_ENABLE(); after this my debug port disconnect.

Anyone help me?. Thanks

void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)

{

  GPIO_InitTypeDef GPIO_InitStruct;

  if(hi2c->Instance==I2C1)

  {

  /* USER CODE BEGIN I2C1_MspInit 0 */

  /* USER CODE END I2C1_MspInit 0 */

  B9     ------> I2C1_SDA 

    */

    GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;

    GPI

    /**I2C1 GPIO Configuration    

    PB8     ------> I2C1_SCL

    PO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

   __HAL_AFIO_REMAP_I2C1_ENABLE();

    /* Peripheral clock enable */

    __HAL_RCC_I2C1_CLK_ENABLE();

  /* USER CODE BEGIN I2C1_MspInit 1 */

  /* USER CODE END I2C1_MspInit 1 */

  }

}

0 REPLIES 0