Alternative Interfaces to Step/Dir (CAN/RS485/Etc.) #524
-
Hi, Im just starting to look into grblHAL! This is an amazing project and I look forward to learning so much through it! (thank you everyone!) I was wondering if there was any provision or pointers I could get to integrate a serial protocol like CAN (CANopen Software Layer), RS485, Etc. to control servo drives instead of STEP/DIR. I am looking to control closed-loop LV BLDC and HV PMSM servo drives. I see that the ISRs for generating step pulses are tied to a bitfield inside - stepdir_map.h - that updates Step/dirs registers atomically so it looks like its pretty baked into the grblHAL code base but I was wondering if anyone has done such development and would be willing to teach me the ways Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
As a start you can hook your (plugin?) code into hal.stepper.pulse_start and send commands to the stepper drivers when a new segment arrives. A new segment is started every ~5ms and the acceleration and feed rate is constant during each. Next step could be adding an additional step interrupt handler to stepper.c, this to reduce overhead. It can be selected at run-time by pointing Disclaimer: I do not know if this is a workable solution or if a completely custom stepper.c is required. |
Beta Was this translation helpful? Give feedback.
As a start you can hook your (plugin?) code into hal.stepper.pulse_start and send commands to the stepper drivers when a new segment arrives. A new segment is started every ~5ms and the acceleration and feed rate is constant during each.
FYI spindle sync is implemented by swapping
hal.stepper.pulse_start
between normal and synced mode. Synced mode checks for new segments by comparing the segment id with the previous one so you may get som ideas from that code.Next step could be adding an additional step interrupt handler to stepper.c, this to reduce overhead. It can be selected at run-time by pointing
hal.stepper.interrupt_callback
to it.Disclaimer: I do not know if this is a workable s…