solving servo jittering when combine with i2c devices #1572
-
hey anyone know how to remove sensor jittering when using i2c devices. i use STM32F429ZI, servo, and ads1115. if i only use stm32 and servo it works properly, but when i add ads1115 it start jittering. please help me, thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @muhammadhusni777 , Lowest value means higher priority, so I2C has higher priority and will preempt servo. And if I2C traffic is too intensive (or too long, ...) it could impact/delay servo pin state change and thus induce jittering. So you can try either to:
|
Beta Was this translation helpful? Give feedback.
Hi @muhammadhusni777 ,
I guess you face real time issue, linked to preemption of servo by I2C:
Servo library is based on HardwareTimer, and it uses Interrupts to change servo pin state.
The interrupt priority of HardwareTimer (and of Servo) is by default defined to:
#define TIM_IRQ_PRIO 3
In parallel, you have your I2C component for which interrupt priority is by default defined to:
#define I2C_IRQ_PRIO 2
Lowest value means higher priority, so I2C has higher priority and will preempt servo. And if I2C traffic is too intensive (or too long, ...) it could impact/delay servo pin state change and thus induce jittering.
So you can try either to: