7i76e and selective drive fault detection during drive initialization

More
10 Mar 2019 01:40 #128194 by azrockcrawler
Greetings,

Some background, I bought a Mesa 7i76e 4 years ago and am finally getting around to putting it to use. I am reworking the controller for a small mill that started out life well over a decade ago on EMC generating steps via parallel port to Gecko G201s. The primary motivator for the 7i76e was the fact the modern releases of linux and LinuxCNC would not reliably run the base thread at acceptable performance levels and I got tired of iterating with the hardware I had on hand. I just wanted my mill converted and running. The Mesa solution is superior anyway, IMO.

The new drives are KL-5080H (a Leadshine variant I believe) driving closed loop NEMA23 stepper motors.

The power to the drives is separate from the control power. The idea is that this allows cycling drive power without cycling the entire controller (LinuxCNC or the 7i76e) should a drive fault occur. Drive faults must be cleared by power cycling the drive. This allows LinuxCNC and the 7i76e to always be in communication and running.

The main power switch on the controller supplies AC and brings up a 24 VDC power supply. That supplies power to the 7i76e and field power for anything else attached to it. A N.O. relay controls AC to the separate 48 VDC drive power supply. This supply does not turn on until a signal from the 7i76e energizes the relay. This all works.

The KL-5080H can assert a drive fault which is tied to inputs and linked to the HAL e-stop chain. It is currently configured to assert high when triggered. The drive firmware allows this to be configured as high or low. I surfaced LEDs in the GUI so the condition has some visual feedback. This also all works.

Finally, the problem. When LinuxCNC is taken out of e-stop and the power button is hit in the GUI,everything works as expected, until the drives fault during their startup sequence, thus triggering a drive fault, e-stop which turns the drive power back off almost immediately.

Although I had considered this possibility, I had not taken the time to ensure what happens at drive startup with the state of the drive alarm. Note that the drive has no drive-ready signal. As it turns out, the drive firmware twiddles the alarm signal as part of its power up sequence, asserting it briefly, then turning it off, as detected using halscope.

So, it is working exactly as it should given the circumstances. Problem is, its not what the desired behavior. :) I need either a stable drive-ready signal or to temporarily ignore only during drive power up the pesky test blip from the drive alarm signal.

I think I need something like, when machine-is-on (or some other signal) is enabled, ignore drive alarms (feels risky) for some period of time as determined by experimentation (looks like well under 3 seconds).

Assuming what I am trying to do is not the worst idea ever, what are the preferred options to pull this off without introducing unintended side effects? I imagine someone has run into this before but I did not find it. Of course, I can bypass all of this with a manual switch, but that means I cannot reset the drives from the GUI, which was a design goal.

One thing I can try is to invert the alarm signal in the drive firmware (and correspondingly in HAL) to and see if it behaves differently. I expect it'll twiddle the state in any case and I'll be no further ahead.

Sorry the the lengthy post, trying to provide context.


Thanks,

Barry

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

More
11 Mar 2019 04:08 #128284 by azrockcrawler
After posting that book chapter and pondering the problem, I chose to use debounce. Drive faults will be deferred 25ms. It is a compromise and not ideal, but it does work.

Still open to other suggestions.


Thanks,

Barry

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

More
11 Mar 2019 05:14 #128288 by tommylight

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

More
11 Mar 2019 07:16 #128297 by azrockcrawler
Motion inhibit (motion.enable I presume) seemed interesting. I sort of looked at that but it seemed to be turning into a bit of a rabbit hole, and I concluded, perhaps incorrectly, it may not suit the purpose.

I hunted for an analog to iocontrol.user-request-enable (except for use with machine.enable, or similar) and came up dry. Browsing the source I found onoff_clicked in an Axis Python module which sets a flag in the linuxcnc module. That won't really help at that level, of course.

If one could intercept the motion.enable request event, a startup flag could be set then cleared by a timer. The startup flag would become part of the drive-fault handler allowing the drive-fault to remain cleared but only if triggered during startup, thereby preserving the integrity of the rest of the e-stop chain and behaving as desired (trigger e-stop) in the normal running state.

This becomes trivial if I use the physical signal from the start/stop switch and relay on the control box, but then I still have to hit that button in the GUI and defeats the goal to replace the front panel start/stop button with the GUI machine on button.

It's been a while since I meddled with linuxcnc behavior. I could be missing some obvious things. Maybe more reading. I searched and did not find a similar situation that was solved without using real world signals.


Barry

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

More
11 Mar 2019 13:18 #128324 by Todd Zuercher
You could use a couple of hal components to disable the signal from the drives fault signal for a period of time after the drives are enabled. Use a tristate_bit and a oneshot. Connect the input of the Oneshot to the machine enable signal, and the "output not" of the Oneshot to the enable of the tristate_bit. Then feed the signal from the drive through the Tristate_bit's in and out. Set the time for the Oneshot equal to the amount of time you need to ignore the drive's error signal. But if you are happy with what you already have, it is slightly simpler, just a little less responsive when you truly have an error.

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

More
11 Mar 2019 13:33 #128332 by bevins
You could use a timer in CL. input, machine is on, start a timer that will energize a relay with the contacts of the relay is series with your pesky drive alarm signal so linuxcnc does not see it during the time set in the timer. . After the time period the relay closes back and the alarm signal will trigger linuxcnc. you could also inhibit motion during that time period just to be safe.


That should work if I understand your problem.

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

More
11 Mar 2019 13:55 #128343 by andypugh

After posting that book chapter and pondering the problem, I chose to use debounce.


That was my first idea too.

Something using "oneshot" might be better,

Maybe a oneshot triggered by the system going live (ie triggered by halui.machine.is-on)
linuxcnc.org/docs/2.7/html/man/man9/oneshot.9.html
Use the out-not (active low) output and an and2 component to mask the fault input briefly.

The advantage here is that the delay is only there at power-up rather than at all times.

That said, a 25mS delay in responding to a drive fault is unlikely to be a problem, how far can the machine travel in that time?

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

More
11 Mar 2019 14:15 #128347 by azrockcrawler
Thank you all for the input.

@Todd: Yeah, that could work. I missed the tristate_bit and oneshot somehow. I may try this first. I would prefer not to have a 25ms delay in the e-stop chain for the drive alarm.

@bevins: I wondered about CL also, just haven't ventured into that space yet. I think that could work, the problem is, guaranteeing that the CL timer and relay are in place before the drive blips the alarm. I think that should be no problem.

Thanks again.

Barry

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

More
11 Mar 2019 20:07 #128378 by azrockcrawler
Andy,

You and Todd have similar ideas. I missed the oneshot and tristate logic components and I think this is just what I was after.

Movement over 25ms is like between 20 and 50 thou at wildly optimistic rapid speeds and immensely less than that at regular cutting speeds so...that's why the inline delay works fine in practice. It just assaults my fragile sensibilities.

I think I'll change it to the suggested approaches using oneshot and tristate just for the exercise and to make the universe right again.

Thanks again for the help.


Barry

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

More
12 Mar 2019 12:29 #128426 by pl7i92
you can also use a AND2 logic
Mashine must be on
or a Moving command like
program
halui.program.block−delete.is−on bit out

status pin telling that block delete is on

halui.program.block−delete.off bit in

pin for requesting that block delete is off

halui.program.block−delete.on bit in

pin for requesting that block delete is on

halui.program.is−idle bit out

status pin telling that no program is running

halui.program.is−paused bit out

status pin telling that a program is paused

halui.program.is−running bit out

status pin telling that a program is running

halui.program.optional−stop.is−on bit out

status pin telling that the optional stop is on

halui.program.optional−stop.off bit in

pin requesting that the optional stop is off

halui.program.optional−stop.on bit in

pin requesting that the optional stop is on

halui.program.pause bit in

pin for pausing a program

halui.program.resume bit in

pin for resuming a program

halui.program.run bit in

pin for running a program

halui.program.step bit in

pin for stepping in a program

halui.program.stop bit in

pin for stopping a program (note: this pin does the same thing as halui.abort)

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

Time to create page: 0.107 seconds
Powered by Kunena Forum