Question
Problem with I2C on STM32F030R8T6 using STM32F0xx HAL drivers library
Posted on September 25, 2014 at 12:11
Hello,
I am trying to use I2C master communication with the STM32F030R8T8 that is on the STM32F0308DISCOVERY kit. I have used STM32CubeMX to generate the following initialization code:
/* I2C1 init function */
void
MX_I2C1_Init(
void
)
{
hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x2000090E;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
hi2c1.Init.OwnAddress2 = 0;
hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
HAL_I2C_Init(&hi2c1);
/**Configure Analogue filter
*/
HAL_I2CEx_AnalogFilter_Config(&hi2c1, I2C_ANALOGFILTER_ENABLED);
}
Then, I have tried to write a byte on I2C by using this function:
1.
HAL_I2C_Master_Transmit_IT(&hi2c1, 117, &data, 1);
After this line, my program doesn’t step over because the following handlers are called:
-
BusFault_Handler
-
DebugMon_Handler
-
HardFault_Handler
What’s wrong with my code?
#i2c-stm32f030r8t-stm32f0xx-hal