Closed drom89 closed 2 years ago
Hi again, just a dumb question, how can i modify pin outputs ?
By modifying the pin map file or creating a new.
I suppose that it should be done in btt_skr_1.4_turbo_map.h ?
Yes, but better to copy it to _my_machinemap.h and enable that in _mymachine.h instead. This way your changes will not be overwritten on an update.
I want to use PIN 2.7 for PWM output to CO2 laser PSU.
According to the datasheet this pin is not PWM output capable, so not possible. Pins supported by code can be found here.
And it is possible to control outputs thru G code ?
Yes, currently up to 3 can be controlled with M62 - M65. Pin assignments has to be added to the map file, an example:
I want to use PIN 2.7 for PWM output to CO2 laser PSU.
According to the datasheet this pin is not PWM output capable, so not possible. Pins supported by code can be found here.
What datasheet are you looking at ?
On SKR1.4T PIN2.7 is connected to mosfet and mosfet is controlled from Pin 66 on the chip if im correct. BTT have it marked as PWM but in data sheet for MCU its not labeled as PWM hmm, im getting lost in this. But i think, that it can be used as PWM, i will try test it.
What datasheet are you looking at ?
The MCU user manual - UM10360, same info there as in the last image in the comment above.
But i think, that it can be used as PWM, i will try test it.
All GPIO pins can be used for PWM if you use timer(s) to generate interrupt(s) and flip the output in the interrupt handler(s). With a 5KHz PWM frequency that will be two interrupts firing every 200 microseconds, possibly very close - you can get away with that without causing too much jitter?
Hi @terjeio, i have some small problems.
i want to use pin P2.3 (PWM1_CH4 / pin70 on MCU/ FAN0 mosfet) on SKR as #define SPINDLE_ENABLE_PIN
when i try #define SPINDLE_ENABLE_PIN PWM1_CH4 it doesnt work so i tried #define SPINDLE_ENABLE_PIN 70 it doesnt work
I want it because i got some weird stuff going on with laser, when using default 23 (P1.23 on SKR / pin37 on MCU) its always on at least little bit. What im doing wrong ?
Thanks in advance.
You have to change
#define SPINDLE_PWM_CHANNEL PWM1_CH6
to
#define SPINDLE_PWM_CHANNEL PWM1_CH4
The spindle enable pin is on/off only. Note that the MOSFET outputs are all open drain, it is possible you have to add a pullup resistor to make them work with the laser PSU.
Yes so spindle enable is only ON/OFF. So that didnt fix my problem :(
I have infamous K40 CO2 laser rebuild to 600x300mm working area, custom made mechanics. But now im having problem that im losing sharpnes or the details of raster images stock controller was better. Sorry for the photo quality. It looks like it takes time to fire the laser and to shut it off (something like ramp up and ramp down) or overburned dont know how to explain it well.
Any ideas what im doing wrong ?
Any ideas what im doing wrong ?
I have many... Did you get PWM working? Is this an engraving with constant power? Do you get a better result if lowering the power and feed rate? Or by lowering acceleration? Is laser mode enabled in grblHAL ($32=1)?
If you run this program (adjust power and feedrate to suit your laser), do you get sharp lines?
G21G90G40G17
M4 S30
G0 X0Y0Z0
G1 X0 Y0 F300
G1 X50
G1 Y50
G1 X0
G1 Y0
G0
M30
It is a 50x50mm square. If the lines are sharp you may have issues with switching the laser on/off (takes too long) or backlash. If not your laser is out of focus (not likely if the two engravings above are with the same mechanincal configuration).
If you engrave a rectangle (from a bitmap) are the horizontal lines the same width as the vertical ones? If not and both directions looks the same with the program above then you either have backlash or a laser on/off delay issue.
So i reduce speed, accel et. and i found out something after tinkering for some time. If i turn on bi-directional scanning in lightburn im getting really bad quality.
$0=10.0 $1=25 $2=0 $3=0 $4=7 $5=0 $6=1 $7=0 $10=511 $11=0.010 $12=0.002 $13=0 $14=7 $15=0 $16=0 $17=0 $18=0 $19=0 $20=0 $21=0 $22=41 $23=0 $24=25.0 $25=500.0 $26=250 $27=1.000 $28=0.100 $29=0.0 $30=100.000 $31=1.000 $32=1 $33=50000.0 $34=0.0 $35=0.0 $36=100.0 $37=0 $39=1 $40=0 $43=1 $44=5 $45=0 $46=0 $62=0 $63=3 $64=0 $65=0 $80=1.000 $81=0.010 $82=0.000 $84=0.000 $85=10.000 $90=0.000 $91=0.000 $92=0.000 $95=0.000 $100=80.000 $101=80.000 $102=250.000 $110=30000.000 $111=20000.000 $112=500.000 $120=1000.000 $121=600.000 $122=10.000 $130=600.000 $131=300.000 $132=200.000 $140=1200 $141=1200 $142=500 $150=16 $151=16 $152=16 $200=50.0 $201=50.0 $202=22.0 $210=50 $211=50 $212=50 $338=0 $339=0 $341=0 $342=30.0 $343=25.0 $344=200.0 $345=100.0 $347=5.0 $348=2.500 $349=25.000 $384=0
IMO then it is backlash. Did the stock controller have a setting for that?
Backlash compensation can be enabled in grblHAL by uncommenting //#define ENABLE_BACKLASH_COMPENSATION
in grbl/config.h. Amount of compensation is set with $160 for X and $161 for Y. Note that when enabling this the current settings will be reset to default. Backup and restore - if you are on Windows you can use my grbl config app.
I will try the backlash function. But it strange. I tried to fill cube shapes with 0.4mm interval with bi scan ON/OFF
Fast direction of engraving is horizontal in the images above? If so it is strange yes.
Are your belts and pulley setscrews tight? And was the STOCK K40 engraving with the same mechanical configuration and not before any modifications?
Yes it is horizontal engraving along X axis.
Belts seems to be ok, i will check pulleys.
Stock K40 was on different mechanics. But im getting the same quality now when bi scan is off.
Can you attach the gcode for the two 20x20mm 0.4mm distance variants? And if you rotate those 90 degrees (vertical lines) how does that come out?
So it looks like its mechanical thing.
So i reinforce 3D printed part that hold the last mirror and lens, and its much better. Still not perfect, but i will make that part from aluminium.
So another question is LPC chip is having 6PWM channels that control 12pins. If i want to use PWM from P1.23, i just need to define this ? see below
#ifdef SPINDLE_PWM_PIN_2_4
#define SPINDLE_PWM_CHANNEL PWM1_CH6 // MOSFET3 (P2.4)
#else
#define SPINDLE_PWM_CHANNEL PWM1_CH4
#endif
#define SPINDLE_PWM_USE_PRIMARY_PIN true
#define SPINDLE_PWM_USE_SECONDARY_PIN false
Is this correct ?
So i reinforce 3D printed part that hold the last mirror and lens, and its much better.
That is great, I was wondering a bit about your wiggly lines before but thought it might be due to the material not beeing perfectly flat...
Is this correct ?
Yes, I believe so. I have not tested all the PWM capable pins so you'll have to try...
So i change the pins and now i m using pwm to control laser power (before i used only laser on full power/off on different input on PSU). And new problem arise see photo. I try to outline text in lightburn and with speeds 100mm/s+ im getting this, see photo below. Laser mode is on. It looks like it need time to start the beam, but on engraving its ok.
I see that you have very high acceleration rates, does it help to reduce them? In laser mode PWM output is reduced during acceleration/deceleration to avoid overburn - perhaps the speed is changing too fast for the laser PSU and/or tube to catch up? DC excited tubes have a fairly slow response time, IIRC around 1ms, this might be part of it. Another reason could be that the power reduction is too great - since I am using PPI mode for my laser I have not looked into how the power reduction algorithm works.
As you are running in "laser mode" from the settings listed above may I ask if M3 or M4 is used to switch the laser on?
I set accel on both axis to 300mm/s2 and its getting worse.
X Y 300mm/s2 Video: https://share.icloud.com/photos/0JDlWPOObsYDlH4s6GiIzSo1A
X:1000mm/s2 Y600mm/s2 Video: https://share.icloud.com/photos/0qAz45QAecuFYVmvkCpormcHQ
Anyway thanks for your time, do you have patreon or something ?
Current settings
$$
$0=10.0
$1=25
$2=0
$3=0
$4=7
$5=0
$6=1
$7=0
$10=511
$11=0.010
$12=0.002
$13=0
$14=7
$15=0
$16=0
$17=0
$18=0
$19=0
$20=0
$21=0
$22=0
$23=0
$24=25.0
$25=500.0
$26=250
$27=1.000
$28=0.100
$29=0.0
$30=1000.000
$31=1.000
$32=1
$33=20000.0
$34=0.0
$35=0.0
$36=100.0
$37=0
$39=1
$40=0
$43=1
$44=5
$45=0
$46=0
$62=0
$63=3
$64=0
$65=0
$80=1.000
$81=0.010
$82=0.000
$84=0.000
$85=10.000
$90=0.000
$91=0.000
$92=0.000
$95=0.000
$100=80.000
$101=80.000
$102=40.000
$110=30000.000
$111=20000.000
$112=500.000
$120=300.000
$121=300.000
$122=10.000
$130=600.000
$131=200.000
$132=200.000
$140=1200
$141=1200
$142=500
$150=16
$151=16
$152=16
$160=0.000
$161=0.000
$162=0.000
$200=50.0
$201=50.0
$202=22.0
$210=50
$211=50
$212=50
$338=0
$339=0
$341=0
$342=30.0
$343=25.0
$344=200.0
$345=100.0
$347=5.0
$348=2.500
$349=25.000
$384=0
Anyway thanks for your time, do you have patreon or something ?
No patreon...
Please attach the gcode you are using for the test in the video.
If M4 is used to switch the laser on then try with M3 - this disables dynamic power during accel/decel. Same result?
Another thing to try is to switch off laser mode and check at which spindle RPM the laser starts delivering enough power to mark material. If this is quite high then that might explain your issue, setting $35 to some value > 0 may then help?
So $35 helped, didnt test how fast i can go.
Hi again, just a dumb question, how can i modify pin outputs ?
According to PIN map for SKR 1.4T [https://github.com/bigtreetech/BIGTREETECH-SKR-V1.3/blob/master/BTT%20SKR%20V1.4/Hardware/BTT%20SKR%20V1.4PIN.pdf] I suppose that it should be done in btt_skr_1.4_turbo_map.h ? I want to use PIN 2.7 for PWM output to CO2 laser PSU. Because i have one SKR 1.4T board where all other MOSFETs are fried :-)
And it is possible to control outputs thru G code ?