STM32 ll library hardware IIC EEPROM program code

Time:2021-3-5
-*-Take notes for your communication,
-*-The related time sequence can be seen in the EEPROM datasheet, which is not explained here
Author: cavein, lollipop
Platform: keil5 & stm32g031ke8t6
Time: 20201101
1. The hardware IIC does not need to generate the start bit and the end bit by itself, it only needs to call the configuration function LL_ I2C_ Handletransfer, sending and receiving by setting parameters
2. Pay attention to parameter setting, such as LL_ I2C_ MODE_ Autoend and ll_ I2C_ GENERATE_ START_ Write is used for write operation and LL_ I2C_ MODE_ Softend and ll_ I2C_ GENERATE_ START_ Read is used for read operations
Pay attention to the difference.
3. Add the time-out setting, if the time to exit in time and clear the corresponding flag bit, I write it as a function, there is something wrong, but it is harmless.
4. After a stop, you still have to wait more than 5ms for EEPROM to write data. When writing continuously, because there is only one stop bit, you will only wait once, but be careful not to exceed the number of page bytes.
Here is the source code:
1 /*************************************************************
/*************************************************************

Recommended Today

asp.net Application of regular expression

1. Balanced group / recursive matching (?’ Group ‘), which is called the corresponding content of group, and counts it on the stack;(?’- Group ‘), and count the corresponding content named group out of the stack(?!) Zero width negative look ahead assertion. Since there is no suffix expression, attempts to match always failRegular example:,{0,1}”5″:\[[^\[\]]*(((?’Open’\[)[^\[\]]*)+((?’-Open’\])[^\[\]]*)+)*(?(Open)(?!))\],{0,1} Test […]