Question
I2C Interface
Posted on September 29, 2015 at 23:28
I Trying To I2C Interface With DS1621 Using HAL Driver STM32Cube-MX 4.7.0
As Per HAL Driver I Try To Check Device Is Ready or NOT It Stuck At if(I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_SB, RESET, Timeout) != HAL_OK)It Always Getting timeout error what is the role ofI2C_FLAG_SB bit
&sharpdefine Slave_Address 0x90int main(void){ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); //MX_I2C1_Init(); while (1) { MX_I2C1_Init(); if(HAL_I2C_IsDeviceReady(&hi2c1, Slave_Address, 10, 1000) == HAL_OK); if(HAL_I2C_Master_Transmit(&hi2c1, Slave_Address, ''0xEE'', 1, 1000) == HAL_OK); if(HAL_I2C_IsDeviceReady(&hi2c1, Slave_Address, 10, 1000) == HAL_OK); if(HAL_I2C_Master_Transmit(&hi2c1, Slave_Address, ''0xAA'', 1, 1000) == HAL_OK); if(HAL_I2C_IsDeviceReady(&hi2c1, 0x91, 10, 1000) == HAL_OK); if(HAL_I2C_Master_Receive(&hi2c1, 0x91, Temp, 2, 1000) == HAL_OK); }}void MX_I2C1_Init(void){ hi2c1.Instance = I2C1; hi2c1.Init.ClockSpeed = 100000; hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2; hi2c1.Init.OwnAddress1 = 64; hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED; hi2c1.Init.OwnAddress2 = 0; hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_ENABLED; hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLED; HAL_I2C_Init(&hi2c1);}i used 1k resistor for pull-up what is the flow to use this driver please suggest me for initialization of I2C interfacealso suggest for tool where i can show signal activity #stm32f4-i2c-hal-driver #i2c-stm32