If you want the problem found, we need to recreate the same problem - so you have to post code
that compiles, downloads, runs and exhibits the problem, plus an explanation of what the
problem is (the expected behaviour v. the actual behaviour). If you can produce a smaller
example of a sketch with the same issue, that's useful, because you may figure it out
during the process. Sometimes the sketch requires particular hardware - that is going to reduce
the chance of recreating the problem, but there's still a chance of spotting it by eye.
I know that, but is impossible to you to use my code, because you will need brushless motors, IMU, etc. Because of that, I am going to explain what does the program, just in case anyone can help me.
I use 6 output as PWM at 32Khz for motors. The output will updated each t seconds, where I choose t. This is my ISR routine.
At the main program, I read IMU, calculate the output for the motors, etc . I have configurate the Timer1 for the ISR routine, because Timer0 is useless because the PWM outputs.
When I connect the USB and OPEN the terminal (both), my program works perfect at 200 Hz (5 microseconds). The motors has is own battery.
The problem comes when only connect the USB and do not open the terminal, then the programm don't works. Same if I connect a power supply instead the USB. I tried a lot of things, and looks that when I put the frequency at 100 Hz, the program works (but not fine, because all is calculated to works at 200 Hz).
It's like when I do not open the terminal frequency varies.
If with this explanation anyone can help me I will be happy, if not don't worry, I know that is difficult without see the program.