cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F302R8 I2C1 STUCK AT GENERATE START CONDITION

WM_IR
Senior

Hi, I have a problem where my basic master send data code stuck at the generate start condition function. I am using STM32F302R8,

based on the reference manual, the flow chart stated that SET the I2C_CR2.START.

0693W00000Nr1T2QAJ.jpg 

Then, inside my code, here is my basic code to send the data.

0693W00000Nr1TMQAZ.jpgWhen it goes to inside MasterSendData(), It stuck in the GenerateStartCondition function.

Here is inside the GenerateStartCondition function and the start bit is register number 13.

0693W00000Nr1W6QAJ.jpg0693W00000Nr1WGQAZ.jpgBut, after it finish executing the I2C_GenerateStartCondition, the register I2C_CR2_START does not SET, But, it looping inside the startup file of stm32f302r8 from CopyDataInit to LoopCopyDataInit as shown below.

0693W00000Nr1WzQAJ.jpg 

So, I dont know what is the cause of this problem. Am I missing something in the setup? Hope someone can help me on this

4 REPLIES 4

Isn't there a short, which causes the mcu to reset when it pulls down SDA/SCK?

JW

The looping in the startup means the mcu reset? And it is because a short circuit? If there is a short circuit, why it happen during the generate start condition only? Not from the beginning of the program?​

That was just a tip. You can check it using an ohmmeter. You can also check it using oscilloscope, measuring NRST, and/or power supply.

JW

So the looping in the startup file is indicating what condition usually?​