Touch.begin makes stepper motors "laggy"

What do you want to achieve?

I simply want to control 4 steppers in custom sequence and use Arduino GIGA display shield for start and stop the sequence. The problem is that when I call Touch.begin function in void setup, my steppers won’t work smoothly. They are “laggy”, makes vibration and strange sound even though I don’t click anything on the screen. I have tried new empty project without any buttons and it still does the same. If I use buttons whenever I click one looks like my loop gets interupted for split second because I can hear stepper stopping at that moment.
If I comment Touch.begin line, everything runs smoothly again. I also use non interrupting functions for my steppers since screen becomes inactive if I use interrupts and in that case I can not click stop button.

What have you tried so far?

Making new empty project without any buttons.

Screenshot or video


  • SquareLine Studio version: V1.4.0
  • Operating system: Windows 11
  • Target hardware: Arduino GIGA with GIGA display shield

you dont show lib for stepper, but any hw critical system need knowledge about manage independent dedicated parts. Isnt for one thread loop code

Could you please explain in more details? Didn’t actually understand. I use accelstepper.h library for steppers.

Whatever you use, direct code or library, you need to be sure that steppers are timed very precisely. So you need to use high-priority interrupts on your MCU (or dedicated stepper-controller) for stepper ‘step’ controls that are never delayed (significantly) by the main loop where LVGL lv_task_handler runs, instead the motor control should interrupt LVGL and main loop whenever it needs to.

1 Like