getting started with 8i20
- clematites93
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 0
29 Dec 2014 22:55 #54364
by clematites93
getting started with 8i20 was created by clematites93
Hello,
I've a 8i20 and a 7i43 cards I'm trying to get started with this card but the problem is that I don't really understand from where to start.
I looked at others example:
loadrt trivkins
loadrt motmod servo_period_nsec=200000 num_joints=1
loadrt hostmot2
# 1.24 firmware
loadrt hm2_pci config="firmware=hm2/5i20/sssvst2_2_4_v24.bit num_encoders=1 num_pwmgens=0 num_stepgens=0 num_sserials=1"
#setp hm2_5i20.0.watchdog.timeout_ns 100000000
# load the pyvcp gui
loadusr -Wn 8i20 pyvcp -c 8i20 8i20.xml
loadrt pid num_chan=1
### 2.2kW Motor
# these parameters were set with NVMAXCURRENT = 30 Amps
setp pid.0.Pgain 0.05
setp pid.0.Igain 3.0
### 1kW Motor
# these parameters were set with NVMAXCURRENT = 7.5 Amps
#setp pid.0.Pgain -0.5
#setp pid.0.Igain -30.0
setp pid.0.Dgain 0
setp pid.0.maxoutput 1
setp pid.0.deadband 0.05
### q = encoder, h=hall sensors, i=index
loadrt bldc cfg=qh
net amp-enable 8i20.enable hm2_5i20.0.8i20.0.0.amp_enable
net init-done 8i20.done
net cmd 8i20.command pid.0.command
setp hm2_5i20.0.encoder.00.scale 2000
net fb hm2_5i20.0.encoder.00.velocity pid.0.feedback 8i20.vel
net pid-out pid.0.output bldc.0.value 8i20.val
net count hm2_5i20.0.encoder.00.rawcounts 8i20.count
net angle hm2_5i20.0.8i20.0.0.angle bldc.0.rotor-angle 8i20.angle
setp hm2_5i20.0.8i20.0.0.max_current 30.0
net fault-count hm2_5i20.0.sserial.0.fault-count 8i20.count
net bldc-current bldc.0.out hm2_5i20.0.8i20.0.0.current 8i20.current
### IF cfg==*q* uncomment these lines
setp bldc.0.initvalue 0.5
setp bldc.0.lead-angle 0
#### 2.2kW Motor
setp bldc.0.poles 4
#### 1kW Motor
#setp bldc.0.poles 8
setp bldc.0.scale -2000
net count bldc.0.rawcounts
### IF cfg==*h* uncomment these lines
net amp-enable pid.0.enable
net sa bldc.0.hall1 hm2_5i20.0.gpio.005.in 8i20.a
net sb bldc.0.hall2 hm2_5i20.0.gpio.007.in 8i20.b
net sc bldc.0.hall3 hm2_5i20.0.gpio.009.in 8i20.c
#### 2.2kW Motor
setp bldc.0.pattern 44
#### 1kW Motor
#setp bldc.0.pattern 34
### ELSE uncomment these lines
#net amp-enable bldc.0.init
#net init-done bldc.0.init-done pid.0.enable
### IF cfg==*i* uncomment these lines
#net home-index hm2_5i20.0.encoder.00.index-enable bldc.0.index-enable 8i20.ie
addf hm2_5i20.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.0.do-pid-calcs servo-thread
addf hm2_5i20.0.write servo-thread
addf hm2_5i20.0.pet_watchdog servo-thread
addf bldc.0 servo-thread
start
#waitusr 8i20
I adapted it for the 7i43 but due to my firmware hm2/7i43-2/svss6_6s.bit there was some conflicts.
I have a kind of stub, I was able to read and write parameters but as I said I have little clue on to write in order to actually pilot my motor.
How can I help myself (I looked at other examples but I wasn't able to close the gap). ?
I've a 8i20 and a 7i43 cards I'm trying to get started with this card but the problem is that I don't really understand from where to start.
I looked at others example:
loadrt trivkins
loadrt motmod servo_period_nsec=200000 num_joints=1
loadrt hostmot2
# 1.24 firmware
loadrt hm2_pci config="firmware=hm2/5i20/sssvst2_2_4_v24.bit num_encoders=1 num_pwmgens=0 num_stepgens=0 num_sserials=1"
#setp hm2_5i20.0.watchdog.timeout_ns 100000000
# load the pyvcp gui
loadusr -Wn 8i20 pyvcp -c 8i20 8i20.xml
loadrt pid num_chan=1
### 2.2kW Motor
# these parameters were set with NVMAXCURRENT = 30 Amps
setp pid.0.Pgain 0.05
setp pid.0.Igain 3.0
### 1kW Motor
# these parameters were set with NVMAXCURRENT = 7.5 Amps
#setp pid.0.Pgain -0.5
#setp pid.0.Igain -30.0
setp pid.0.Dgain 0
setp pid.0.maxoutput 1
setp pid.0.deadband 0.05
### q = encoder, h=hall sensors, i=index
loadrt bldc cfg=qh
net amp-enable 8i20.enable hm2_5i20.0.8i20.0.0.amp_enable
net init-done 8i20.done
net cmd 8i20.command pid.0.command
setp hm2_5i20.0.encoder.00.scale 2000
net fb hm2_5i20.0.encoder.00.velocity pid.0.feedback 8i20.vel
net pid-out pid.0.output bldc.0.value 8i20.val
net count hm2_5i20.0.encoder.00.rawcounts 8i20.count
net angle hm2_5i20.0.8i20.0.0.angle bldc.0.rotor-angle 8i20.angle
setp hm2_5i20.0.8i20.0.0.max_current 30.0
net fault-count hm2_5i20.0.sserial.0.fault-count 8i20.count
net bldc-current bldc.0.out hm2_5i20.0.8i20.0.0.current 8i20.current
### IF cfg==*q* uncomment these lines
setp bldc.0.initvalue 0.5
setp bldc.0.lead-angle 0
#### 2.2kW Motor
setp bldc.0.poles 4
#### 1kW Motor
#setp bldc.0.poles 8
setp bldc.0.scale -2000
net count bldc.0.rawcounts
### IF cfg==*h* uncomment these lines
net amp-enable pid.0.enable
net sa bldc.0.hall1 hm2_5i20.0.gpio.005.in 8i20.a
net sb bldc.0.hall2 hm2_5i20.0.gpio.007.in 8i20.b
net sc bldc.0.hall3 hm2_5i20.0.gpio.009.in 8i20.c
#### 2.2kW Motor
setp bldc.0.pattern 44
#### 1kW Motor
#setp bldc.0.pattern 34
### ELSE uncomment these lines
#net amp-enable bldc.0.init
#net init-done bldc.0.init-done pid.0.enable
### IF cfg==*i* uncomment these lines
#net home-index hm2_5i20.0.encoder.00.index-enable bldc.0.index-enable 8i20.ie
addf hm2_5i20.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.0.do-pid-calcs servo-thread
addf hm2_5i20.0.write servo-thread
addf hm2_5i20.0.pet_watchdog servo-thread
addf bldc.0 servo-thread
start
#waitusr 8i20
I adapted it for the 7i43 but due to my firmware hm2/7i43-2/svss6_6s.bit there was some conflicts.
I have a kind of stub, I was able to read and write parameters but as I said I have little clue on to write in order to actually pilot my motor.
How can I help myself (I looked at other examples but I wasn't able to close the gap). ?
Please Log in or Create an account to join the conversation.
29 Dec 2014 23:55 #54368
by PCW
Replied by PCW on topic getting started with 8i20
Setting up commutation with a random motor/encoder is not very easy as there are
multiple parameters that have to be correct before you can spin the motor
The first step is probably to read the BLDC manual page, decide
which commutation mode suits your hardware and then build a hal file using
the BLDC component. Then you need to plug in the correct parameters to match
your hardware/commutation mode, and in my experience some experimentation
is always needed (either with encoder directions,Hall patterns, index position etc etc)
BTW minlimit and maxlimit should be symmetrical and of opposite signs for a 8I20:
setp hm2_7i43.0.8i20.0.2.current-maxlim 7.2
setp hm2_7i43.0.8i20.0.2.current-minlim -7.2
(or just dont set them in the hal file at all, since they default to +- nvmaxcurrent)
multiple parameters that have to be correct before you can spin the motor
The first step is probably to read the BLDC manual page, decide
which commutation mode suits your hardware and then build a hal file using
the BLDC component. Then you need to plug in the correct parameters to match
your hardware/commutation mode, and in my experience some experimentation
is always needed (either with encoder directions,Hall patterns, index position etc etc)
BTW minlimit and maxlimit should be symmetrical and of opposite signs for a 8I20:
setp hm2_7i43.0.8i20.0.2.current-maxlim 7.2
setp hm2_7i43.0.8i20.0.2.current-minlim -7.2
(or just dont set them in the hal file at all, since they default to +- nvmaxcurrent)
The following user(s) said Thank You: clematites93
Please Log in or Create an account to join the conversation.
- clematites93
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 0
05 Jan 2015 05:47 #54558
by clematites93
Replied by clematites93 on topic getting started with 8i20
After reading and tinkering with the bldc documentation I made the attached configuration.
I checked the configuration with halrun -f <file.hal> and it loads without errors, starts also works without errors.
I would like to have a feedback on it as I'm a bit reluctant to enable the power due to potential motor runaway.
So there is an enable on the 8i20, for the moment I have a mechanical switch to set it to 1 or 0, I guess it's not a good final solution. What would be a correct solution ?
I discovered the n tag (for no motor feedback) can I use it without any risk ( just to test without any real load) ?
I'm attaching the show pin output and show param too.
Note:my motor is not equiped with HAL sensors
I checked the configuration with halrun -f <file.hal> and it loads without errors, starts also works without errors.
I would like to have a feedback on it as I'm a bit reluctant to enable the power due to potential motor runaway.
So there is an enable on the 8i20, for the moment I have a mechanical switch to set it to 1 or 0, I guess it's not a good final solution. What would be a correct solution ?
I discovered the n tag (for no motor feedback) can I use it without any risk ( just to test without any real load) ?
I'm attaching the show pin output and show param too.
Note:my motor is not equiped with HAL sensors
Please Log in or Create an account to join the conversation.
05 Jan 2015 23:54 #54588
by PCW
Replied by PCW on topic getting started with 8i20
If you are worried about runaway, disconnect you motor from any
motion mechanics so a runaway cannot hurt anything
That said a runaway is a good thing in some respects, it means you have commutation working!
motion mechanics so a runaway cannot hurt anything
That said a runaway is a good thing in some respects, it means you have commutation working!
Please Log in or Create an account to join the conversation.
- clematites93
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 0
06 Jan 2015 05:29 #54620
by clematites93
Replied by clematites93 on topic getting started with 8i20
Hi Peter,
thanks for your reply.
I tried one more time with halrun command, after start the motor go back and forth a little (kind of vibrating) then it turns slowly counter clockwise without stopping.
According to what i understand from bldc man page there is a "homing phase". When the motor is homed , bldc set a pin and should stop the motor.
But it seems it's not the case for me here (maybe homing is not complete ???).
Also I dont understand the meaning of : bldc.N.rawcount.
Furthermore bldc.N.initdone is a simple indicator or should be link in my hal file ?
thanks for your reply.
I tried one more time with halrun command, after start the motor go back and forth a little (kind of vibrating) then it turns slowly counter clockwise without stopping.
According to what i understand from bldc man page there is a "homing phase". When the motor is homed , bldc set a pin and should stop the motor.
But it seems it's not the case for me here (maybe homing is not complete ???).
Also I dont understand the meaning of : bldc.N.rawcount.
Furthermore bldc.N.initdone is a simple indicator or should be link in my hal file ?
Please Log in or Create an account to join the conversation.
06 Jan 2015 08:01 - 06 Jan 2015 08:01 #54627
by PCW
Replied by PCW on topic getting started with 8i20
If you have one of the commutation modes that uses index to set the reference position,
the BLDC comp will search for index at startup.
If index is not working or not netted in hal to BLDC it will search forever
BLDC rawcount is the raw encoder count that must come from the raw count pin of the encoder
BLDC initdone should be wired in hal such that it holds off machine on until BLDC initialization is complete
the BLDC comp will search for index at startup.
If index is not working or not netted in hal to BLDC it will search forever
BLDC rawcount is the raw encoder count that must come from the raw count pin of the encoder
BLDC initdone should be wired in hal such that it holds off machine on until BLDC initialization is complete
Last edit: 06 Jan 2015 08:01 by PCW.
The following user(s) said Thank You: clematites93
Please Log in or Create an account to join the conversation.
- clematites93
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 0
07 Jan 2015 15:00 #54703
by clematites93
Replied by clematites93 on topic getting started with 8i20
Hi Peter,
For the bldc component, the configuration tags and the personality seems to be :
INPUTS (lower-case) shift one bit
hall sensors h --> 0x01 --> 0001 (binary)
absolute encoders a --> 0x02 --> 0010
quadrature encoders q --> 0x04 --> 0100
use of index encoder i --> 0x08 --> 1000
and so on.....
OUTPUTS (upper-case)
bit level B --> 0x100
6 outputs 6 --> 0x200
emulated Hall sensors H --> 0x400
and so on.......
My tags are qi (quadrature encoder and use of index of the encoder for homing sequence for my motor)
Some pins or parameters are presents only if personality match a mask
Example 1 : bldc.N.init-done seems valable if
personality & 0x05 == 4 mask : 0x05 (hexa) --> 0101 (binary)
if only : q and i are presents
q --> 0100
i --> 1000
qi --> 1100 1100 (binary) or 12 (decimal) or 0x0C (hexa)
now mask
qi --> 1100
mask --> 0101
after 0100 0100 (binary) or 4 (decimal) q i
> OK
Example 2 (wrong !!!!!!) personality q h i (h with i no compatible)
qhi --> 1101
mask --> 0101
0101 0101 or 5 (decimal) qhi
> NO OK
1) Question : is my logic correct ?
To complete ( ?) the homing sequence (in my hal file)
net x-index-enable hm2_7i43.0.encoder.01.index.enable <=> bldc.0.index.enable
net rawcounts <= hm2_7i43.0.encoder.01.rawcounts
net rawcounts => bldc.0.rawcounts
my motor goes back and forth then rotates a little and then stops.
2) Question : Is the homing sequence is correct ?
For the bldc component, the configuration tags and the personality seems to be :
INPUTS (lower-case) shift one bit
hall sensors h --> 0x01 --> 0001 (binary)
absolute encoders a --> 0x02 --> 0010
quadrature encoders q --> 0x04 --> 0100
use of index encoder i --> 0x08 --> 1000
and so on.....
OUTPUTS (upper-case)
bit level B --> 0x100
6 outputs 6 --> 0x200
emulated Hall sensors H --> 0x400
and so on.......
My tags are qi (quadrature encoder and use of index of the encoder for homing sequence for my motor)
Some pins or parameters are presents only if personality match a mask
Example 1 : bldc.N.init-done seems valable if
personality & 0x05 == 4 mask : 0x05 (hexa) --> 0101 (binary)
if only : q and i are presents
q --> 0100
i --> 1000
qi --> 1100 1100 (binary) or 12 (decimal) or 0x0C (hexa)
now mask
qi --> 1100
mask --> 0101
after 0100 0100 (binary) or 4 (decimal) q i
> OK
Example 2 (wrong !!!!!!) personality q h i (h with i no compatible)
qhi --> 1101
mask --> 0101
0101 0101 or 5 (decimal) qhi
> NO OK
1) Question : is my logic correct ?
To complete ( ?) the homing sequence (in my hal file)
net x-index-enable hm2_7i43.0.encoder.01.index.enable <=> bldc.0.index.enable
net rawcounts <= hm2_7i43.0.encoder.01.rawcounts
net rawcounts => bldc.0.rawcounts
my motor goes back and forth then rotates a little and then stops.
2) Question : Is the homing sequence is correct ?
Please Log in or Create an account to join the conversation.
07 Jan 2015 20:36 #54710
by andypugh
do you have the bldc.0.init pin connected to anything?
Replied by andypugh on topic getting started with 8i20
net x-index-enable hm2_7i43.0.encoder.01.index.enable <=> bldc.0.index.enable
net rawcounts <= hm2_7i43.0.encoder.01.rawcounts
net rawcounts => bldc.0.rawcounts
my motor goes back and forth then rotates a little and then stops.?
do you have the bldc.0.init pin connected to anything?
Please Log in or Create an account to join the conversation.
- clematites93
- Offline
- Senior Member
Less
More
- Posts: 62
- Thank you received: 0
07 Jan 2015 21:09 #54712
by clematites93
Replied by clematites93 on topic getting started with 8i20
Hi,
thanks for your fast answer.
In my hal file, I forced this pin to 1
*start of BLDC
setp bldc.0.init 1
is it correct ?
thanks for your fast answer.
In my hal file, I forced this pin to 1
*start of BLDC
setp bldc.0.init 1
is it correct ?
Please Log in or Create an account to join the conversation.
07 Jan 2015 21:17 #54713
by andypugh
That ought to work. There might be something to be said for connecting it to amp-enable or machine.is-on.
Replied by andypugh on topic getting started with 8i20
*start of BLDC
setp bldc.0.init 1
is it correct ?
That ought to work. There might be something to be said for connecting it to amp-enable or machine.is-on.
The following user(s) said Thank You: clematites93
Please Log in or Create an account to join the conversation.
Time to create page: 0.091 seconds