RA Flexible Software Package Documentation  Release v5.2.0

 
Motor driver Interface

Detailed Description

Interface for motor driver functions.

Summary

The Motor driver interface for setting the PWM modulation duty

Data Structures

struct  motor_driver_callback_args_t
 
struct  motor_driver_current_get_t
 
struct  motor_driver_cfg_t
 
struct  motor_driver_api_t
 
struct  motor_driver_instance_t
 

Typedefs

typedef void motor_driver_ctrl_t
 

Enumerations

enum  motor_driver_event_t
 
enum  motor_driver_shunt_type_t
 

Data Structure Documentation

◆ motor_driver_callback_args_t

struct motor_driver_callback_args_t

Callback function parameter data

Data Fields
motor_driver_event_t event Event trigger.
void const * p_context Placeholder for user data.

◆ motor_driver_current_get_t

struct motor_driver_current_get_t

Current Data Get Structure

Data Fields
float iu U phase current [A].
float iv V phase current [A].
float iw W phase current [A].
float vdc Main Line Voltage [V].
float va_max maximum magnitude of voltage vector
float sin_ad Induction sensor sin signal.
float cos_ad Induction sensor cos signal.

◆ motor_driver_cfg_t

struct motor_driver_cfg_t

Configuration parameters.

Data Fields

adc_channel_t iu_ad_ch
 A/D Channel for U Phase Current.
 
adc_channel_t iv_ad_ch
 A/D Channel for V Phase Current.
 
adc_channel_t iw_ad_ch
 A/D Channel for W Phase Current.
 
adc_channel_t vdc_ad_ch
 A/D Channel for Main Line Voltage.
 
adc_channel_t sin_ad_ch
 A/D Channel for induction sensor sin signal.
 
adc_channel_t cos_ad_ch
 A/D Channel for induction sensor cos signal.
 
motor_driver_shunt_type_t shunt
 Selection of shunt type.
 
void const * p_context
 Placeholder for user data.
 

◆ motor_driver_api_t

struct motor_driver_api_t

Functions implemented at the HAL layer will follow these APIs.

Data Fields

fsp_err_t(* open )(motor_driver_ctrl_t *const p_ctrl, motor_driver_cfg_t const *const p_cfg)
 
fsp_err_t(* close )(motor_driver_ctrl_t *const p_ctrl)
 
fsp_err_t(* reset )(motor_driver_ctrl_t *const p_ctrl)
 
fsp_err_t(* phaseVoltageSet )(motor_driver_ctrl_t *const p_ctrl, float const u_voltage, float const v_voltage, float const w_voltage)
 
fsp_err_t(* currentGet )(motor_driver_ctrl_t *const p_ctrl, motor_driver_current_get_t *const p_current_get)
 
fsp_err_t(* flagCurrentOffsetGet )(motor_driver_ctrl_t *const p_ctrl, uint8_t *const p_flag_offset)
 
fsp_err_t(* currentOffsetRestart )(motor_driver_ctrl_t *const p_ctrl)
 
fsp_err_t(* parameterUpdate )(motor_driver_ctrl_t *const p_ctrl, motor_driver_cfg_t const *const p_cfg)
 

Field Documentation

◆ open

fsp_err_t(* motor_driver_api_t::open) (motor_driver_ctrl_t *const p_ctrl, motor_driver_cfg_t const *const p_cfg)

Initialize the Motor Driver Module.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_cfgPointer to configuration structure.

◆ close

fsp_err_t(* motor_driver_api_t::close) (motor_driver_ctrl_t *const p_ctrl)

Close the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.

◆ reset

fsp_err_t(* motor_driver_api_t::reset) (motor_driver_ctrl_t *const p_ctrl)

Reset variables of the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.

◆ phaseVoltageSet

fsp_err_t(* motor_driver_api_t::phaseVoltageSet) (motor_driver_ctrl_t *const p_ctrl, float const u_voltage, float const v_voltage, float const w_voltage)

Set (Input) Phase Voltage data into the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.
[in]u_voltageU phase voltage [V]
[in]v_voltageV phase voltage [V]
[in]w_voltageW phase voltage [V]

◆ currentGet

fsp_err_t(* motor_driver_api_t::currentGet) (motor_driver_ctrl_t *const p_ctrl, motor_driver_current_get_t *const p_current_get)

Get Phase current, Vdc and Va_max data from the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.
[out]p_current_getPointer to get data structure.

◆ flagCurrentOffsetGet

fsp_err_t(* motor_driver_api_t::flagCurrentOffsetGet) (motor_driver_ctrl_t *const p_ctrl, uint8_t *const p_flag_offset)

Get the flag of finish current offset detection from the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.
[out]p_flag_offsetFlag of finish current offset detection

◆ currentOffsetRestart

fsp_err_t(* motor_driver_api_t::currentOffsetRestart) (motor_driver_ctrl_t *const p_ctrl)

Restart current offset detection

Parameters
[in]p_ctrlPointer to control structure.

◆ parameterUpdate

fsp_err_t(* motor_driver_api_t::parameterUpdate) (motor_driver_ctrl_t *const p_ctrl, motor_driver_cfg_t const *const p_cfg)

Update Configuration Parameters for the calculation in the Motor Driver Module

Parameters
[in]p_ctrlPointer to control structure.
[in]p_cfgPointer to configuration structure include update parameters.

◆ motor_driver_instance_t

struct motor_driver_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
motor_driver_ctrl_t * p_ctrl Pointer to the control structure for this instance.
motor_driver_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
motor_driver_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ motor_driver_ctrl_t

typedef void motor_driver_ctrl_t

Control block. Allocate an instance specific control block to pass into the API calls.

Enumeration Type Documentation

◆ motor_driver_event_t

Events that can trigger a callback function

Enumerator
MOTOR_DRIVER_EVENT_FORWARD 

Event before Motor Driver Process (before Current Control timing)

MOTOR_DRIVER_EVENT_CURRENT 

Event Current Control timing.

MOTOR_DRIVER_EVENT_BACKWARD 

Event after Motor Driver Process (after PWM duty setting)

◆ motor_driver_shunt_type_t

Selection of shunt type

Enumerator
MOTOR_DRIVER_SHUNT_TYPE_1_SHUNT 

Only use U phase current.

MOTOR_DRIVER_SHUNT_TYPE_2_SHUNT 

Use U and W phase current.

MOTOR_DRIVER_SHUNT_TYPE_3_SHUNT 

Use all phase current.