2019-02-12 02:41 AM
Hello,
I raised this problem in another topic I posted, but it is with another title and I'm not sure I will get there the help (title might be missleading).
I have the problem after sending Slave Address and Register Address and creating a start condition I don't get any clock signal from the STM32F4 microcontroller.
Hoch can I solve this?
Thank you
2019-02-14 12:06 PM
Thanks @Danish for the info.
Changed in Stop to I2C_SR2_MSL and removed the for-loop. Result is no clock pulses after the Stop-Start-Condition.
I think it's now about the sensor not about the microcontroller, the StdLib might somehow introduce a longer time for stop-start.
For now I would not mind to leave the for loop there, I want to get the interface now working. I have spend a lot of time and not able to read the reply of the sensor.
How can I provide a clock impulse for the sensor after the second address? Where should I check and reset which register?
thank you very much
Uli
2019-02-14 06:36 PM
Hi @uli stone . Sorry to jump in the middle of this dialog but is it important for you to use a step-by-step I2C handshake with your project? For example, why not apply the very powerful DMA feature of the I2C port using one of the working examples from CubeMX, etc. ? Most of the time, such examples can be working in a few minutes. The STM32F4 is very powerful and offer interrupt / DMA use to quickly send / receive data over I2C bus. You can also follow the examples to build an I2C slave using one of the kits.
2019-02-15 12:24 AM
If the I2C peripheral won't do it, then it presumably thinks it has reason not to do it.
Here's where it becomes something of a detective-game. You need to collect all the clues.
What I eventually had to do to sort out my I2C code was - whenever I was about to write to a control register - log the I2C status register(s), the time in microseconds, where I was in my code and what I was just about to do.
Those figures in the reference manual show master-read and master-write, with what events should happen to trigger each next step in your code. Sadly they don't show master-write-restart-read, or what might indicate failure so you can abort without waiting forever.