This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problems with timers and i2c

hello, i'm using a stm32f4 discovery to control a dc motor, for this i've used different timers for the different actions i have to do in this one, TIM2 is in charge of reading encoder, TIM3 is the pwm generator that goes to a H bridge, TIM4 i use it in Input Capture mode to measure the speed, and the TIM7 I use it to generate an interpolator of order 7, together they work perfectly, but within my application I want to measure the current, for this I am using a module IN219 which communicates by i2c and I am using an adafruit library, separately I made a current control of the motor and it worked perfectly, but when I introduced it in the code with all the timers I mentioned, the I2C communication was taken and stopped sending me data, I tried changing from i2c1 to i2c2 but there was no difference, I also noticed that if I remove the interpolator sequence in the TIM7 the communication was again more stable, but within my application this sequence is important. I also want to comment that TIM7 has lowered the priority 7, but it doesn't solve things

is there any conflict between the i2c communication and the timers???

Besides all this, I had planned to use the interruptions of my timers to make the reading of this sensor since I need to measure only the current peaks when measuring the current in a modulated signal, but the same thing happens, the communication is frozen if I want to make the current request within a timer.

it is possible to make i2c requests within a timer? 

Can someone help me to solve this problem?