2016-09-18 09:56 AM
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?. Thanksvoid 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 */ }}