AnsweredAssumed Answered

Problem with I2C on STM32F030R8T6 using STM32F0xx HAL drivers library

Question asked by Gates on Sep 25, 2014
Latest reply on Sep 29, 2014 by Montassar BEN ROMDHANE

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:

 

01./* I2C1 init function */
02.void MX_I2C1_Init(void)
03.{
04. 
05.  hi2c1.Instance = I2C1;
06.  hi2c1.Init.Timing = 0x2000090E;
07.  hi2c1.Init.OwnAddress1 = 0;
08.  hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
09.  hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
10.  hi2c1.Init.OwnAddress2 = 0;
11.  hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
12.  hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
13.  hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
14.  HAL_I2C_Init(&hi2c1);
15. 
16.    /**Configure Analogue filter
17.    */
18.  HAL_I2CEx_AnalogFilter_Config(&hi2c1, I2C_ANALOGFILTER_ENABLED);
19. 
20.}

 

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?

Outcomes