User Tools

Site Tools


projects:sand_drawing:work_logs:software

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
projects:sand_drawing:work_logs:software [2020/04/23 13:34] tjhowseprojects:sand_drawing:work_logs:software [2020/04/23 22:54] (current) tjhowse
Line 28: Line 28:
  
 My initial naive approach on the ESP8266 had a hidden benefit: I tracked every transition of the step pin. I could keep a perfectly accurate index register of how far the stepper had turned. Once I offloaded responsibility for twiddling the step pin to hardware, not software, I lost the ability to exactly track what step I was up to. My first pass at the PWM implementation was to convert my step interval to a frequency, set the duty cycle to 50% and Just Go. It was a disaster! My slow loop logic was still managing timing the movements, running at its reduced speed, while the PWM hardware was merrily thrashing the stepper 'round and 'round. I needed more smarts. My initial naive approach on the ESP8266 had a hidden benefit: I tracked every transition of the step pin. I could keep a perfectly accurate index register of how far the stepper had turned. Once I offloaded responsibility for twiddling the step pin to hardware, not software, I lost the ability to exactly track what step I was up to. My first pass at the PWM implementation was to convert my step interval to a frequency, set the duty cycle to 50% and Just Go. It was a disaster! My slow loop logic was still managing timing the movements, running at its reduced speed, while the PWM hardware was merrily thrashing the stepper 'round and 'round. I needed more smarts.
 +
 +My plan is to have two modes of operation: 1) Accurate slow, 2) Less accurate, fast. You'll be able to switch between modes in gcode. The accurate mode will have the waveform generation purely in software, and will track each pulse. The less accurate mode will use the PWM interface and measure the time it takes to move. If I use timer interrupts I should be able to say "move at 270 degrees per second and stop the movement after 1 second" and get reasonably good results. It won't be as good as tracking each step, but it will allow for fast-enough movement even at 32x microstepping.
 +
 +I could start motion with a PWM setting, then set a hardware interrupt timer for the duration of the move. During movement my main loop could update the index based on the time since the last update and the rate of movement.
  
  
projects/sand_drawing/work_logs/software.1587648899.txt.gz · Last modified: 2020/04/23 13:34 by tjhowse