2015-11-10 06:53 AM
Hello guys,
I'm running a communication between two STM32F4 via SMBus. For configuration I use HAL Drivers and CubeMX. Pin Configuration:PB7 ------> I2C1_SDA
PB8 ------> I2C1_SCL
PB5 ------> I2C1_SMBA
GPIO_InitStruct.Pin = GPIO_PIN_5 | GPIO_PIN_7 | GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
I2C device configuration:
/* Peripheral clock enable */
__I2C1_CLK_ENABLE();
/* Peripheral interrupt init*/
HAL_NVIC_SetPriority(I2C1_EV_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C1_EV_IRQn);
HAL_NVIC_SetPriority(I2C1_ER_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(I2C1_ER_IRQn);
hi2c1.Instance = I2C1;
hi2c1.Init.ClockSpeed = 100000;
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
hi2c1.Init.OwnAddress1 = (36<<
1
);
hi2c1.Init.AddressingMode
=
I2C_ADDRESSINGMODE_7BIT
;
hi2c1.Init.DualAddressMode
=
I2C_DUALADDRESS_ENABLED
;
hi2c1.Init.OwnAddress2 = (38<<1);
hi2c1.Init.GeneralCallMode
=
I2C_GENERALCALL_DISABLED
;
hi2c1.Init.NoStretchMode
=
I2C_NOSTRETCH_ENABLE
;
hi2c1.Instance->CR1 |= I2C_CR1_SMBUS; // Mode = SMBus
hi2c1.Instance->CR1 &= ~I2C_CR1_SMBTYPE; // SMBus type = Device
HAL_I2C_Init(&hi2c1);
The data transfer works well.
Now I would like the slave-device to respond to ARA (00011000, as described in RM0090, p.846)and to drive the SMBA pin to LOW (also see p.851). The device should Ack the ARA request and transmit its own first address.
http://www.st.com/web/en/resource/technical/document/reference_manual/DM00031pdf
Set ALERT Bit in I2C_CR1:hi2c1.Instance->CR1 |= I2C_CR1_ALERT;
But the device doesn't respond to ARA and the SMBA pin stays pulled to HIGH.
Do you have any idea what is missing?
Thanks
2015-11-12 03:37 AM
Nobody any idea?