5 years, 7 months ago.

No Clock or data on I2C1


I have following code:


int main(void)



         I2cHandle.Instance             = I2C1;
	  I2cHandle.Init.Timing          = I2C_TIMING;
	  I2cHandle.Init.OwnAddress1     = I2C_ADDRESS;
	  I2cHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_10BIT;
	  I2cHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
	  I2cHandle.Init.OwnAddress2     = 0xFF;
	  I2cHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
	  I2cHandle.Init.NoStretchMode   = I2C_NOSTRETCH_DISABLE;


...some code with sending, thought not necessary... }

Problem is, that this code goes flawlessly, but I cant find any clock signal on D15 pin. It is connected with resistor to AVDD. Do you think there is a problem with my code or problem with pin selection?

Question relating to:

The STM32F746G-DISCO discovery board (32F746GDISCOVERY) is a complete demonstration and development platform for STMicroelectronics ARM® Cortex®-M7 core-based STM32F746NGH6 microcontroller.

That does not look to be MBED driven code but rather the convoluted code from the ST libraries ? Why not move over from the dark side and try the following MBED solution ? Be sure to map the I2C port pins that map to your target board and you should be up and running quickly:


Update - D15 is correct for your board for the I2C1_SCL and D14 for I2C1_SDA. For the I2C spec, the port pins are open drain which means the pins can supply a logic LOW but there is no HIGH. Instead, the same port pin will be floating when a HIGH value is written to the port pin. Therefore it is common practice to have a pull-up resistor (as you have noted) to gently pull the floating pin HIGH. The I2C pins (both SCL and SDA pins) are both required to be pulled up to operate correctly. The ST methods are far from being clean on how to use. If it was not for MBED, we would not even consider ST micros in our product designs. Try the simple I2C tests with your target board to quickly move on with your project.

posted by Sanjiv Bhatia 19 Feb 2016
Be the first to answer this question.