RA Flexible Software Package Documentation
Release v5.2.0
|
|
Usual control of a SPM motor on RA MCUs. This module implements the Motor Sensorless Vector Control (rm_motor_sensorless).
The motor sensorless vector control is used to control a motor rotation in an appication. This module is implemented with using SPM motor. User can start/stop motor rotation simply.
The Motor Sensorless Module has below features.
The below figure shows an example of target hardware of this Motor Sensorless Module.
The below figures show block diaram of sensorless vector motor control. The 1st shows as an open-loop state, 2nd as a PI feedback loop state.
The below figure shows a state transition diagram. Internal state is managed by "SYSTEM MODE".
(1) SYSTEM MODE "SYSTEM MODE" indicates the operating states of the system. The state transits on occurrence of each event (EVENT). "SYSTEM MODE" has 3 states that are motor drive stop (INACTIVE), motor drive (ACTIVE), and abnormal condition (ERROR).
(2) EVENT When "EVENT" occurs in each "SYSTEM MODE", "SYSTEM MODE" changes as shown the table in above figure, according to that "EVENT". The occurrence factors of each event are shown below.
EVENT name | Occurrence factor |
---|---|
STOP | by user operation |
RUN | by user operation |
ERROR | when the system detects an error |
RESET | by user operation |
The below figures show flowcharts of motor sensorless module.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configuration | Options | Default | Description |
---|---|---|---|
General | |||
Name | Name must be a valid C symbol | g_motor_sensorless0 | Module name. |
Limit of over current (A) | Must be a valid value | 0.42F | Limit of over current.(Detection threshold) |
Limit of over voltage (V) | Must be a valid value | 28.0F | Limit of over voltage.(Detection threshold) |
Limit of over speed (rpm) | Must be a valid value | 3000.0F | Limit of over speed.(Detection threshold) |
Limit of low voltage (V) | Must be a valid value | 14.0F | Limit of low voltage.(Detection threshold) |
Interrupts | |||
Callback | Name must be a valid C symbol | NULL | A user callback function. If this callback function is provided, it is called at speed control cyclic interrupt. |
This module doesn't depend on clock setting, because this module is a simple status transition process.
This module does not use I/O pins. Please set used pins on configuration of each hardware modules.
This is a basic example of minimal use of the Motor Sensorless in an application.
fsp_err_t RM_MOTOR_SENSORLESS_Open | ( | motor_ctrl_t *const | p_ctrl, |
motor_cfg_t const *const | p_cfg | ||
) |
Configure the MOTOR in register start mode. Implements motor_api_t::open.
This function should only be called once as MOTOR configuration registers can only be written to once so subsequent calls will have no effect.
Example:
FSP_SUCCESS | MOTOR successfully configured. |
FSP_ERR_ASSERTION | Null pointer, or one or more configuration options is invalid. |
FSP_ERR_ALREADY_OPEN | Module is already open. This module can only be opened once. |
FSP_ERR_INVALID_ARGUMENT | Configuration parameter error. |
fsp_err_t RM_MOTOR_SENSORLESS_Close | ( | motor_ctrl_t *const | p_ctrl | ) |
Disables specified Motor Sensorless Control block. Implements motor_api_t::close.
Example:
FSP_SUCCESS | Successfully closed. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_Reset | ( | motor_ctrl_t *const | p_ctrl | ) |
Reset Motor Sensorless Control block. Implements motor_api_t::reset.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_Run | ( | motor_ctrl_t *const | p_ctrl | ) |
Run Motor (Start motor rotation). Implements motor_api_t::run.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_Stop | ( | motor_ctrl_t *const | p_ctrl | ) |
Stop Motor (Stop motor rotation). Implements motor_api_t::stop.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_ErrorSet | ( | motor_ctrl_t *const | p_ctrl, |
motor_error_t const | error | ||
) |
Set error information. Implements motor_api_t::errorSet.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_SpeedSet | ( | motor_ctrl_t *const | p_ctrl, |
float const | speed_rpm | ||
) |
Set speed reference[rpm]. Implements motor_api_t::speedSet.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
fsp_err_t RM_MOTOR_SENSORLESS_StatusGet | ( | motor_ctrl_t *const | p_ctrl, |
uint8_t *const | p_status | ||
) |
Get current control status. Implements motor_api_t::statusGet.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Data received pointer is invalid.. |
fsp_err_t RM_MOTOR_SENSORLESS_AngleGet | ( | motor_ctrl_t *const | p_ctrl, |
float *const | p_angle_rad | ||
) |
Get current rotor angle. Implements motor_api_t::angleGet.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Data received pointer is invalid.. |
fsp_err_t RM_MOTOR_SENSORLESS_SpeedGet | ( | motor_ctrl_t *const | p_ctrl, |
float *const | p_speed_rpm | ||
) |
Get rotational speed. Implements motor_api_t::speedGet.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Data received pointer is invalid.. |
fsp_err_t RM_MOTOR_SENSORLESS_ErrorCheck | ( | motor_ctrl_t *const | p_ctrl, |
uint16_t *const | p_error | ||
) |
Check the occurunce of Error. Implements motor_api_t::errorCheck.
Example:
FSP_SUCCESS | Successfully resetted. |
FSP_ERR_ASSERTION | Null pointer. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Data received pointer is invalid.. |
fsp_err_t RM_MOTOR_SENSORLESS_PositionSet | ( | motor_ctrl_t *const | p_ctrl, |
motor_speed_position_data_t const *const | p_position | ||
) |
Set position reference. Implements motor_api_t::positionSet.
FSP_ERR_UNSUPPORTED | Unsupported. |
fsp_err_t RM_MOTOR_SENSORLESS_WaitStopFlagGet | ( | motor_ctrl_t *const | p_ctrl, |
motor_wait_stop_flag_t *const | p_flag | ||
) |
Get wait stop flag. Implements motor_api_t::waitStopFlagGet.
FSP_ERR_UNSUPPORTED | Unsupported. |
fsp_err_t RM_MOTOR_SENSORLESS_FunctionSelect | ( | motor_ctrl_t *const | p_ctrl, |
motor_function_select_t const | function | ||
) |
Select function. Implements motor_api_t::functionSelect.
FSP_ERR_UNSUPPORTED | Unsupported. |