7i96s Flash for additional PWM and Wiring for laser

More
23 Dec 2024 07:10 #317178 by SneakyGamer
So finally on my holiday break and looking to try and connect my 40w Diode laser to my machine

want to get some guidance before i flash my 7i96s and cause my whole CNC to stop working.

would like to be able to use the spindle control, whether that is scalled or as a percentage to adjust the 0-5v for the intensity of the laser

so i understand that i have to flash the board with 7i96s_2pwmd.zip, which will add PWMGen 1 to STEP4+/STEP4- 

Is how i have the diagram, would this be the correct way i need to wire to the board?

also is this the correct coding i need to add into my hal/ini file?

(HAL)

# Enable PWM generator on channel 0
etp hm2_7i96s.0.pwmgen.00.enable true

# Set the PWM frequency (adjust based on laser specs)
setp hm2_7i96s.0.pwmgen.00.scale 5000 # Example: Scale to 5000 RPM for 0-5V lasers

# Link PWM output to motion spindle speed command
net laser-power motion.spindle-speed-out => hm2_7i96s.0.pwmgen.00.value

# Link PWM enable to motion spindle enable
net laser-enable motion.spindle-on => hm2_7i96s.0.pwmgen.00.enable

# Link motion spindle-on signal to a GPIO pin
net laser-on motion.spindle-on => hm2_7i96s.0.gpio.000.out

(INI)

[SPINDLE]
SPINDLE_TYPE = PWM
MAX_SPINDLE_SPEED = 5000
# Match the scale in HAL MIN_SPINDLE_SPEED = 0
Attachments:

Please Log in or Create an account to join the conversation.

More
23 Dec 2024 16:00 #317206 by PCW
That looks close if the laser driver uses PWM and not 0 to 5V analog

Notes:

The STEP+ pin will start up in the high state so for safety you should use the STEP- pin
and invert the PWM output in the hal file. I would change the hal setup to:

# invert pwm output
setp hm2_7i96s.0.pwmgen.01.out0.invert_output true

# Set the PWM frequency (adjust based on laser specs)
setp hm2_7i96s.0.pwmgen.01.scale 5000 # Example: Scale to 5000 RPM for 0-5V lasers

# Link PWM output to motion spindle speed command
net laser-power motion.spindle-speed-out => hm2_7i96s.0.pwmgen.01.value

# Link PWM enable to motion spindle enable
net laser-enable motion.spindle-on => hm2_7i96s.0.pwmgen.01.enable

# Link motion spindle-on signal to a 7I96S SSR output pin
net laser-enable hm2_7i96s.0.ssr.00.out-00

(PWM channel 0 is for the analog spindle out on TB2 pins 22..24)



 
The following user(s) said Thank You: SneakyGamer

Please Log in or Create an account to join the conversation.

More
23 Dec 2024 23:29 - 23 Dec 2024 23:30 #317245 by SneakyGamer
Replied by SneakyGamer on topic 7i96s Flash for additional PWM and Wiring for laser
ooh ok thanks

yeah oversight, should be channel 1 if im using step/dir4

# Enable PWM generator on channel 1
setp hm2_7i96s.0.pwmgen.01.enable true

or do i not need this command if im replacing it with the invert

# invert pwm output
setp hm2_7i96s.0.pwmgen.01.out0.invert_output true
Last edit: 23 Dec 2024 23:30 by SneakyGamer.

Please Log in or Create an account to join the conversation.

More
24 Dec 2024 00:16 #317248 by PCW
I would not permanently enable the pwmgen with setp  but rather enable it by
connecting it to spindle-on as shown.

Inverting the PWM output and using the STEP- pin is needed because it guarantees that the
PWM pin is low before LinuxCNC is running, during power up, and after a fault (watchdog bite)

Please Log in or Create an account to join the conversation.

More
26 Dec 2024 02:44 #317383 by SneakyGamer
Replied by SneakyGamer on topic 7i96s Flash for additional PWM and Wiring for laser
Thankyou so far for the help PCW
but unfortunetly no luck with the coding side of things

managed to eventually sucessfully flash the mesa board with the 7i96s_2pwmd.bin after a few complications of mesaflash not being able to detect my board.

but afterwards all seemed to operate my existing cnc with no issues,

however as soon as i tried to update any of the hal or ini for the laser, linuxcnc failed to boot giving me the debug prompt.

is there any way to determine from the debug prompt message it provides what it doesnt like??

have provided my current working hal and ini, does not have any of the new additonal code that id need to run laser off spindle
Attachments:

Please Log in or Create an account to join the conversation.

More
26 Dec 2024 03:14 #317386 by PCW
Start LinuxCNC from a terminal window and the error messages will be displayed there.

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.059 seconds
Powered by Kunena Forum