Initialization Function. freescale Speed Controller
Pubblicità
Pubblicità
C Level API for Function
• decoder_type (uint8_t) – This is the type of decoder (HD, QD or RSLV). This parameter should be assigned a value of:
—
FS_ETPU_SC_QD
(Quadrature Decoder)
—
FS_ETPU_SC_HD_REV_PERIOD
(any Hall Decoder - Revolution period is measured)
—
FS_ETPU_SC_HD_SEC_PERIOD_1
(1-phase Hall Decoder - Sector period is measured)
—
FS_ETPU_SC_HD_SEC_PERIOD_2
(2-phase Hall Decoder - Sector period is measured)
—
FS_ETPU_SC_HD_SEC_PERIOD_3
(3-phase Hall Decoder - Sector period is measured)
—
FS_ETPU_SC_HD_SEC_PERIOD_4
(4-phase Hall Decoder - Sector period is measured)
—
FS_ETPU_SC_RSLV
(Resolver)
• configuration (uint8_t) – This is the required configuration of SC. This parameter should be assigned a value of:
—
FS_ETPU_SC_RAMP_OFF_PID_OFF
(Ramp algorithm is disabled, PID controller is disabled)
—
FS_ETPU_SC_RAMP_OFF_PID_ON
(Ramp algorithm is disabled, PID controller is enabled)
—
FS_ETPU_SC_RAMP_ON_PID_OFF
(Ramp algorithm is disabled, PID controller is disabled)
—
FS_ETPU_SC_RAMP_ON_PID_ON
(Ramp algorithm is enabled, PID controller is enabled)
• period (uint24_t) - This is the update period, as a number of TCR1 clocks. This parameter applies in master mode only (mode=FS_ETPU_SC_MASTER).
• start_offset (uint24_t) - This parameter is used to synchronize various eTPU functions that generate a signal. The first SC update starts start_offset TCR1 clocks after initialization. This parameter applies in master mode only (mode=FS_ETPU_SC_MASTER).
• services_per_irq (uint24_t) - This parameter defines the number of updates after which an interrupt service request is generated to the CPU. When set to 0, no interrupt service requests are generated.
• p_pid_params (s_pid_params_t*) – This is the pointer to a s_pid_params_t structure. The s_pid_params_t structure is defined in etpu_sc.h: typedef struct {
int32_t P_gain;
int32_t I_gain;
int32_t D_gain;
int32_t positive_limit;
int32_t negative_limit;
} s_pid_params_t;
Where:
• P_gain (int32_t) - This is the proportional gain and its value must be in the 9.15 format that means in the range of (-256, 256). To switch off proportional portion set this parameter to zero.
• I_gain (int32_t) - This is the Integral gain and its value must be in the 9.15 format that means in the range of (-256, 256). To switch off calculation of integral portion set this parameter to zero.
Using the Speed Controller (SC) eTPU Function, Rev. 2
6 Freescale Semiconductor
C Level API for Function
• D_gain (int32_t) - This is the derivative gain and its value must be in the 9.15 format that means in the range of (-256, 256). To switch off calculation of derivative portion set this parameter to zero.
• positive_limit (int32_t) - This is the positive output limit and its value must be in the 9.15 format that means in the range of (-256, 256).
• negative_limit (int32_t) - This is the negative output limit and its value must be in the 9.15 format that means in the range of (-256, 256).
• p_ramp_params (s_ramp_params_t*) – This is the pointer to a s_ramp_params_t structure.
The s_ramp_params_t structure is defined in etpu_sc.h: typedef struct {
fract24_t ramp_incr_up;
fract24_t ramp_incr_down;
} s_ramp_params_t;
Where:
• ramp_incr_up (fract24_t) - This is the step increment up, and its value must be in the range (0, 1).
• ramp_incr_down (fract24_t) - This is the step increment down, and its value must be in the range (0, 1).
• HD_QD_RSLV_chan (uint8_t) – This is the number of the channel the HD, QD or RSLV functions is assigned to. This parameter should be assigned a value of 0-31 for ETPU_A, and
64-95 for ETPU_B.
• output_chan (uint8_t) – SC writes the PID output to a recipient function input parameter. This is the recipient function channel number. This parameter should be assigned a value of 0-31 for
ETPU_A, and 64-95 for ETPU_B.
• output_offset (uint16_t) – SC writes the PID output to a recipient function input parameter. This is the recipient function parameter offset. Function parameter offsets are defined in etpu_<func>_auto.h file..
• link_chan (uint8_t) – This is the channel number of a channel which receives a link after SC updates output. If SC updates PWM duty-cycles it should be a PWMMDC channel. This parameter should be assigned a value of 0-31 for ETPU_A, and 64-95 for ETPU_B.
• omega_max_rpm (uint24_t) – This is the maximum possible motor speed in rpm.
• omega_min_rpm (uint24_t) – This is the minimum possible motor speed in rpm.
• pole_pairs (uint8_t) – This is the number of motor pole-pairs.
• HD_QD_etpu_tcr_freq (uint32_t) – This is the frequency of TCR clock used by the HD or QD channel, in Hz. If Resolver is used (decoder_type=FS_ETPU_SC_RSLV) this parameter value does not apply.
• rslv_freq (uint32_t) – If Resolver is used (decoder_type=FS_ETPU_SC_RSLV), this is the resolver update frequency in Hz.
Freescale Semiconductor
Using the Speed Controller (SC) eTPU Function, Rev. 2
7
Scarica
Pubblicità