Mitsub_vfd - back to back speed commands causes error
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
20 Jun 2024 20:58 #303444
by jimwhiting
Mitsub_vfd - back to back speed commands causes error was created by jimwhiting
Hi,
I've switched my lathe to use the Mitsub_vfd rs485 driver. All working great, except when fusion puts two m3 commands almost back to back... one G97 one G96, the second command causes the VFD to error out and stop on the second command.
The issue goes away of I pop an M1 in between the two. So I guess it is a timing issue and the interface needs to be told to wait for the previous command to complete?
Has anyone else experienced anything similar?
Thanks!
I've switched my lathe to use the Mitsub_vfd rs485 driver. All working great, except when fusion puts two m3 commands almost back to back... one G97 one G96, the second command causes the VFD to error out and stop on the second command.
The issue goes away of I pop an M1 in between the two. So I guess it is a timing issue and the interface needs to be told to wait for the previous command to complete?
Has anyone else experienced anything similar?
Thanks!
Please Log in or Create an account to join the conversation.
20 Jun 2024 21:47 #303450
by PCW
Replied by PCW on topic Mitsub_vfd - back to back speed commands causes error
Rather than an error at the modbus level, is it possible that
the back to back G96/G97 commands are causing a step in
the commanded RPM that generates a drive fault of some kind
say from lack of a braking resistor during decell?
the back to back G96/G97 commands are causing a step in
the commanded RPM that generates a drive fault of some kind
say from lack of a braking resistor during decell?
Please Log in or Create an account to join the conversation.
20 Jun 2024 23:37 #303455
by cmorley
Replied by cmorley on topic Mitsub_vfd - back to back speed commands causes error
Can you post any error messages?
Please Log in or Create an account to join the conversation.
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
24 Jun 2024 21:04 #303713
by jimwhiting
Replied by jimwhiting on topic Mitsub_vfd - back to back speed commands causes error
I'm not seeing any error messages. (Not made easy by the gladevcp errors I get on the console all the time).
G code:
Looking at the sequence being printed for debug it appears the commands are not making it to the python code...
Faulting case: (M1 disabled)
working case: (With M1 enabled)
G code:
N10 G7
N11 G18
N12 G90
N13 G64 P0.001
N14 G21
N15 G53 G0 X200.
N16 G53 G0 Z200.
(FACE1 2)
N17 M0 (CHANGE TO T10 ON REAR TOOL POST)
N18 T10 M6 G43
N20 G54
N21 G97 S700 M3
N22 G95
N23 G90 G0 X55. Z5.
N24 G96 D700 S200 M3
N25 G0 Z1.414
N26 X35.
N27 G1 X27.828 F0.2
N28 X25. Z0.
N29 X-0.8 F0.1
N30 X2.028 Z1.414 F0.2
N31 G0 X55.
N32 Z5.
N33 G97 S700 M3
(PROFILE ROUGHING1 2)
N34 M5
N35 M1
N36 G97 S700 M3
N37 G95
N38 G0 X45. Z5.
N39 G96 D700 S200 M3
N40 G0 Z0.375
N41 X23.5
N42 G1 Z-24.9 F0.1
N43 X25.
Looking at the sequence being printed for debug it appears the commands are not making it to the python code...
Faulting case: (M1 disabled)
DEBUG: PREPPEDDATA: 01FA1027B
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01ED11704E7
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01FA10079
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
working case: (With M1 enabled)
DEBUG: PREPPEDDATA: 01FA1027B
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01ED11704E7
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01ED10000DB
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01FA10079
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01FA1027B
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01ED11704E7
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01FA10079
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
DEBUG: PREPPEDDATA: 01ED10000DB
SLAVE: 01 ackg
DEBUG: ,0,1, 0x6 0x30 0x31
Please Log in or Create an account to join the conversation.
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
24 Jun 2024 21:07 - 24 Jun 2024 21:08 #303714
by jimwhiting
Replied by jimwhiting on topic Mitsub_vfd - back to back speed commands causes error
Sorry, should have added that the commands are:
xxFA102xx Sets forward rotation.
xxFA100xx Stops.
xxED1ssssxx Sets Hz. (ssss is Hz in .1Hz increments)
xxFA102xx Sets forward rotation.
xxFA100xx Stops.
xxED1ssssxx Sets Hz. (ssss is Hz in .1Hz increments)
Last edit: 24 Jun 2024 21:08 by jimwhiting.
Please Log in or Create an account to join the conversation.
25 Jun 2024 02:49 #303727
by cmorley
Replied by cmorley on topic Mitsub_vfd - back to back speed commands causes error
can you also post the HAL code that you use to setup mitsub?
Please Log in or Create an account to join the conversation.
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
25 Jun 2024 07:32 #303738
by jimwhiting
Replied by jimwhiting on topic Mitsub_vfd - back to back speed commands causes error
# Module loaded in main hal.
loadusr mitsub_vfd --baud 19200 --port /dev/ttyUSB0 mitsub=01
# custom_postgui.hal Connections for mitsub as it is a user module.
net estop-out mitsub.estop
net spindle-vel-cmd-rpm-abs => mitsub.motor-cmd
net spindle-enable => mitsub.run
net spindle-cw => mitsub.fwd
setp mitsub.scale-cmd .084175
loadusr mitsub_vfd --baud 19200 --port /dev/ttyUSB0 mitsub=01
# custom_postgui.hal Connections for mitsub as it is a user module.
net estop-out mitsub.estop
net spindle-vel-cmd-rpm-abs => mitsub.motor-cmd
net spindle-enable => mitsub.run
net spindle-cw => mitsub.fwd
setp mitsub.scale-cmd .084175
Please Log in or Create an account to join the conversation.
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
25 Jun 2024 11:52 #303748
by jimwhiting
Replied by jimwhiting on topic Mitsub_vfd - back to back speed commands causes error
Just to add, I've been hovering over the lathe and unpausing it very quickly while the motor is still running. This works fine, so I think that rules out the VFD sensing any issue.
I've not jumped into the code to check this yet... but what flow control is the on the HAL -> user module signals? It appears to me that you could end up sending multiple commands to the user module, but are they buffered in any way? What happens if the user module is already dealing with a previous command?
I've not jumped into the code to check this yet... but what flow control is the on the HAL -> user module signals? It appears to me that you could end up sending multiple commands to the user module, but are they buffered in any way? What happens if the user module is already dealing with a previous command?
Please Log in or Create an account to join the conversation.
- jimwhiting
- Offline
- Junior Member
Less
More
- Posts: 34
- Thank you received: 6
27 Jun 2024 20:17 #303930
by jimwhiting
Replied by jimwhiting on topic Mitsub_vfd - back to back speed commands causes error
Hi,
I've managed to get it to work on my machine now.
It appears there is a race condition in the run/fwd signal handling. My machine shows run == false, and fwd == true at the top of the code below, but run == true, fwd == true at the end where the transfer to last_fwd and last_run takes place. Moving the assignment to just after the comparison solves the issue.
I've included the butchered code to show what I mean. I'll revert and just test my single change next.
I've managed to get it to work on my machine now.
It appears there is a race condition in the run/fwd signal handling. My machine shows run == false, and fwd == true at the top of the code below, but run == true, fwd == true at the end where the transfer to last_fwd and last_run takes place. Moving the assignment to just after the comparison solves the issue.
I've included the butchered code to show what I mean. I'll revert and just test my single change next.
# SET RUN AND DIRECTION
# address FA sets the start and direction
# it expects a 2 character hex representing a 8 bit (b0 - b7) binary number
# bit 1 sets forward, 4 sets reverse, 0 stop
# depending on the inverter and options other bits are possible,
# but these three are consistent
if not self['last_run%d'%index] == self.h[index]['run'] or not self['last_fwd%d'%index] == self.h[index]['fwd']:
print('MITSUB_VFD: Run: ', self.h[index]['run'], ' FWD: ', self.h[index]['fwd'])
print('MITSUB_VFD: LastRun: ', self['last_run%d'%index], ' LastFWD: ', self['last_fwd%d'%index])
self['last_run%d'%index] = self.h[index]['run']
self['last_fwd%d'%index] = self.h[index]['fwd']
if self.h[index]['run']:
if self.h[index]['fwd']:
cmd = "FA";data ="02"
else:
cmd = "FA";data ="04"
else:
cmd = "FA";data ="00"
word = self.prepare_data(cmd,data)
self.ser.write(word)
time.sleep(.05)
# self['last_run%d'%index] = self.h[index]['run']
# self['last_fwd%d'%index] = self.h[index]['fwd']
# if self.h[index]['debug']:
string,chr_list,chr_hex = self.poll_output()
# print('DEBUG: ',chr_list,chr_hex)
Please Log in or Create an account to join the conversation.
Time to create page: 0.124 seconds