2021-02-21 04:57 PM
It is developing products using stm32f469i_Discovery.
The stm32f469i_Discovery board is intended to be used with DS3231.
It was connected to I2C1 for I2C communication.
I2C1 initialization runs on MX_I2C1_Init();
In this function,
It is developing products using stm32f469i_Discovery.
The stm32f469i_Discovery board is intended to be used with DS3231.
It was connected to I2C1 for I2C communication.
I2C1 initialization runs on MX_I2C1_Init();
hi2c->State = HAL_I2C_STATE_RESET;
I2C communication is not possible because it is in a state.
Thus, after MX_I2C1_Init();, hi2c->State = HAL_I2C_STATE_READY; was added for use.
What I want to know is why the status of HAL_I2C_STATE_RESET continues when I2C is initialized.
For your information, I am working on it using TouchFGX.
Init Code is Add..
Solved! Go to Solution.
2021-02-23 01:47 PM
You can step through the source code and find it out.
2021-02-23 01:47 PM
You can step through the source code and find it out.
2021-03-02 08:23 PM
The part HAL_I2C_DeInit(&hi2c1) was deleted from static void MX_I2C1_Init(void).
Like the stm32f429i_Discovery i2c setting.
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
{
Error_Handler();
}
/** Configure Digital filter
*/
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
{
Error_Handler();
}
I added
Am I mistaken?
2021-03-02 11:29 PM
The code you are showing is part of MX_I2C1_Init and should be present.
2021-03-03 05:40 PM
It is My Code.
static void MX_I2C1_Init(void)
/* USER CODE BEGIN I2C1_Init 0 */
/* USER CODE END I2C1_Init 0 */
/* USER CODE BEGIN I2C1_Init 1 */
/* USER CODE END I2C1_Init 1 */
hi2c1.Instance = I2C1;
hi2c1.Init.ClockSpeed = 400000;
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
hi2c1.Init.OwnAddress2 = 0;
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
if (HAL_I2C_Init(&hi2c1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN I2C1_Init 2 */
#if 1
/** Configure Analogue filter
*/
if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
{
Error_Handler();
}
/** Configure Digital filter
*/
if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
{
Error_Handler();
}
#else
HAL_I2C_DeInit(&hi2c1);
#endif
/* USER CODE END I2C1_Init 2 */
}