Hard fault on I2C initialization
Hello,
First I am new in ST device, I only used Microchip PIC for 6 years.
So any advise or comment will be appreciated.
I am trying to use I2C interface on NucleoBoard F091RC1.
I2C_HandleTypeDef* hi2c1;
void i2cInit(I2C_HandleTypeDef* i2cHandler)
{// Assigned I2C handler pointer
hi2c1 = i2cHandler;// Call I2C init function
MX_I2C1_Init();}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_DISABLE; hi2c1->Init.OwnAddress2 = 0; hi2c1->Init.OwnAddress2Masks = I2C_OA2_NOMASK; hi2c1->Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; hi2c1->Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; if (HAL_I2C_Init(hi2c1) != HAL_OK) { //Error_Handler(); }/**Configure Analogue filter
*/ if (HAL_I2CEx_ConfigAnalogFilter(hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK) { //Error_Handler(); }}
In debug mode my code generate an hardware fault event on the first line of
MX_I2C1_Init function
.Would it be possible for someone to tell me what i am doing wrong ?
Thanks in advance.
