PID Problems: Jerking while in steady run state
- alangibson
- Offline
- Senior Member
-
Less
More
- Posts: 68
- Thank you received: 29
31 Jan 2024 14:36 #292067
by alangibson
Replied by alangibson on topic PID Problems: Jerking while in steady run state
Thanks tommylight. I disabled CoolStep, StealthChop, etc a while ago.
I've added some jump detection code to my driver. It reports the positional jumps are within 1 ms of being 1 second apart. So I guess now the challenge is to figure out what's happening once per second that could cause this.
I've added some jump detection code to my driver. It reports the positional jumps are within 1 ms of being 1 second apart. So I guess now the challenge is to figure out what's happening once per second that could cause this.
Please Log in or Create an account to join the conversation.
- alangibson
- Offline
- Senior Member
-
Less
More
- Posts: 68
- Thank you received: 29
31 Jan 2024 18:49 - 31 Jan 2024 18:50 #292091
by alangibson
Replied by alangibson on topic PID Problems: Jerking while in steady run state
At this point everything is telling me that the TMC5041 internal counter really is jumping ahead about 1290 microsteps every second just like clockwork. My only guess is that this can only be a clock issue. I've ordered some 16 mHz crystals to confirm or reject that theory.
Last edit: 31 Jan 2024 18:50 by alangibson.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- alangibson
- Offline
- Senior Member
-
Less
More
- Posts: 68
- Thank you received: 29
01 Feb 2024 10:10 #292128
by alangibson
Replied by alangibson on topic PID Problems: Jerking while in steady run state
I think I've finally licked it.
I hooked the TMC5041 clock up to the clock on the Raspberry Pi. It didn't detect any improvement. So then I created a test program that essentially runs the servo loop like LinuxCNC, calling the same code just outside LinuxCNC. The problem was still there only not as bad.
I then started commenting out an non-essential TMC5041 register reads. And like magic the position jumps stopped. So in the end my driver loop was too slow. Reminds me of the old saying, when you hear hoofbeats think horses not zebras.
It took me so long to find the issue because the halscope graph didn't look like there was a delay. I expected the position number to flatten out before jumping. Maybe this a case of the graphing library helping too much. I also thought the SPI reads would be much faster than they actually seem to be.
My plan going forward is to have separate functions for issuing the commands to the TMC5041 and reading data back from it.
I hooked the TMC5041 clock up to the clock on the Raspberry Pi. It didn't detect any improvement. So then I created a test program that essentially runs the servo loop like LinuxCNC, calling the same code just outside LinuxCNC. The problem was still there only not as bad.
I then started commenting out an non-essential TMC5041 register reads. And like magic the position jumps stopped. So in the end my driver loop was too slow. Reminds me of the old saying, when you hear hoofbeats think horses not zebras.
It took me so long to find the issue because the halscope graph didn't look like there was a delay. I expected the position number to flatten out before jumping. Maybe this a case of the graphing library helping too much. I also thought the SPI reads would be much faster than they actually seem to be.
My plan going forward is to have separate functions for issuing the commands to the TMC5041 and reading data back from it.
Please Log in or Create an account to join the conversation.
- alangibson
- Offline
- Senior Member
-
Less
More
- Posts: 68
- Thank you received: 29
02 Feb 2024 10:26 #292210
by alangibson
Replied by alangibson on topic PID Problems: Jerking while in steady run state
To wrap this up, I was able to completely resolve the problem just by changing the SPI clock divider from 1024 to 256. 128 was too fast for the TMC5041.
Please Log in or Create an account to join the conversation.
Time to create page: 0.159 seconds