You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
Using "teacup" to drive a two axis laser and pin DIO11 defined as heater in "hardware PWM mode" to be used as ttl output to drive a led laser using M106 P0 S0 >=255 (0 to 100%).
Everything worked fine but i saw that it was impossible to shut completely the laser.Checking with an oscilloscope there was a pulse equal to 1 cycle of the timer in duration
which was confirmed in the section "OFF-BY-ONE" in the document:
Below i'll speak about fastpwm, not the option defined in Teacup firmware but the one defined in Atmel ATMEGA 328P manual as one of PWM mode : fastpwm or phase-correct.
This fastpwm mode is set in "heather-avr.c" file line 70 and pin DIO11 use timer TCCR2A (see line 121 in "arduino-168-328p.h" file).
Setting the mode to phase-correct avoid the extra pulse and at the same time allow setting a higher frequency for the laser.(3.921kHz).
The lines to modify in "heather-avr.c" :
line 85 : TCCR2A = MASK(WGM21) | MASK(WGM20);
to : TCCR2A = MASK(WGM20);
line 89 : TCCR2B = MASK(CS20) | MASK(CS21) | MASK(CS22); // F_CPU / 256 / 1024
to : TCCR2B = MASK(CS21) ; // F_CPU / 8 / 255 / 2 / = 3.921kHz
Hope this will help.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Using "teacup" to drive a two axis laser and pin DIO11 defined as heater in "hardware PWM mode" to be used as ttl output to drive a led laser using M106 P0 S0 >=255 (0 to 100%).
Everything worked fine but i saw that it was impossible to shut completely the laser.Checking with an oscilloscope there was a pulse equal to 1 cycle of the timer in duration
which was confirmed in the section "OFF-BY-ONE" in the document:
https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm#using-the-atmega-pwm-registers-directly
Below i'll speak about fastpwm, not the option defined in Teacup firmware but the one defined in Atmel ATMEGA 328P manual as one of PWM mode : fastpwm or phase-correct.
This fastpwm mode is set in "heather-avr.c" file line 70 and pin DIO11 use timer TCCR2A (see line 121 in "arduino-168-328p.h" file).
Setting the mode to phase-correct avoid the extra pulse and at the same time allow setting a higher frequency for the laser.(3.921kHz).
The lines to modify in "heather-avr.c" :
line 85 : TCCR2A = MASK(WGM21) | MASK(WGM20);
to : TCCR2A = MASK(WGM20);
line 89 : TCCR2B = MASK(CS20) | MASK(CS21) | MASK(CS22); // F_CPU / 256 / 1024
to : TCCR2B = MASK(CS21) ; // F_CPU / 8 / 255 / 2 / = 3.921kHz
Hope this will help.
The text was updated successfully, but these errors were encountered: