STM32 I2C1 Start bit not set in register SR1

I am trying to program stm32 on my i2c EEprom, but it seems like every time I say:

I2C_GenerateSTART(I2C1, ENABLE);
while( !(I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT)) );  the code hangs here

I went through the debugger, and I found that the flag bit SR1 0 (which is a flag with an open start bit) is not set, so the code freezes. I can see on the oscilloscope that the start bit was generated, and this works sometimes. it usually breaks when I tried to make several records in a row. I checked HW, everything looks good. I checked the frequency that I run on the i2c bus, it works well within 24 k1025 ep.

any ideas

thank

+3
source share
3 answers

, , , , STM32 STOP I2C_CR1:

. STOP, START PEC , I2C_CR1 , . STOP, START PEC.

STOP, , , START.

+6

( - ST). STM32 I2C. .

+1

Also, when using the driver source files typically provided by the STM32 platforms, be sure to read the headers! They can be very useful, especially for beginners (like me) who are not sure where to start.

In this case, you will watch stm32f4xx_i2c.c

0
source

Source: https://habr.com/ru/post/1739382/


All Articles