Entity: motor_driver

Diagram

PWM_BITS PWMBW clk_i pwm_clk_i rst_n_i run_i star_delta_i dir_i [2:0] position_i [PWMBW:0] pwm_duty_i AH_o BH_o CH_o AL_o BL_o CL_o

Description



Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.

In this HDL repository, there are many different and unique modules, consisting of various HDL (Verilog or VHDL) components. The individual modules are developed independently, and may be accompanied by separate and unique license terms.

The user should read each of these license terms, and understand the freedoms and responsibilities that he or she has by using this source/core.

This core is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Redistribution and use of source or resulting binaries, with or without modification of this file, are permitted under one of the following two license terms:

  1. The GNU General Public License version 2 as published by the Free Software Foundation, which can be found in the top level directory of this repository (LICENSE_GPL2), and also online at: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

OR

  1. An ADI specific BSD license, which can be found in the top level directory of this repository (LICENSE_ADIBSD), and also on-line at: https://github.com/analogdevicesinc/hdl/blob/master/LICENSE_ADIBSD This will allow to generate bit files and not release the source code, as long as it attaches to an ADI device.

*

----------- Module Declaration -----------------------------------------------

Generics

Generic name Type Value Description
PWM_BITS 11
PWMBW PWM_BITS - 1

Ports

Port name Direction Type Description
clk_i input
pwm_clk_i input
rst_n_i input
run_i input
star_delta_i input 1 STAR, 0 DELTA
dir_i input 1 CW, 0 CCW
position_i input [2:0]
pwm_duty_i input [PWMBW:0]
AH_o output
BH_o output
CH_o output
AL_o output
BL_o output
CL_o output

Signals

Name Type Description
pwm_s reg ------------------------------------------------------------------------------ ----------- Registers Declarations ------------------------------------------- ------------------------------------------------------------------------------
motor_state reg [ 3:0]
align_counter reg [15:0]
position_s reg [ 2:0]
pwm_cnt reg [PWMBW:0]
align_complete wire ------------------------------------------------------------------------------ ----------- Wires Declarations ----------------------------------------------- ------------------------------------------------------------------------------
pwm_duty_s wire [PWMBW:0]
commutation_table wire [1:0]
pwm_al_s wire
pwm_ah_s wire
pwm_bl_s wire
pwm_bh_s wire
pwm_cl_s wire
pwm_ch_s wire
pwmd_al_s wire
pwmd_ah_s wire
pwmd_bl_s wire
pwmd_bh_s wire
pwmd_cl_s wire
pwmd_ch_s wire

Constants

Name Type Value Description
PWMBW PWM_BITS - 1
OFF 3'b001 ------------------------------------------------------------------------------ ----------- Local Parameters ------------------------------------------------- ------------------------------------------------------------------------------
ALIGN 3'b010
RUN 3'b100
DT 20
ALIGN_PWM_DUTY [PWMBW:0] 2**(PWMBW) + 2
ALIGN_TIME [15:0] 16'h8000
COMMUTATION_TABLE_DELTA_CW_0 [1:0] {
2'd1,
-2'd1,
2'd1,
-2'd1,
2'd1,
-2'd1}
COMMUTATION_TABLE_DELTA_CW_1 [1:0] {
-2'd1,
2'd1,
2'd1,
-2'd1,
-2'd1,
2'd1}
COMMUTATION_TABLE_DELTA_CW_2 [1:0] {
-2'd1,
-2'd1,
-2'd1,
2'd1,
2'd1,
2'd1}
COMMUTATION_TABLE_DELTA_CCW_0 [1:0] {
-2'd1,
2'd1,
-2'd1,
2'd1,
-2'd1,
2'd1}
COMMUTATION_TABLE_DELTA_CCW_1 [1:0] {
2'd1,
-2'd1,
-2'd1,
2'd1,
2'd1,
-2'd1}
COMMUTATION_TABLE_DELTA_CCW_2 [1:0] {
2'd1,
2'd1,
2'd1,
-2'd1,
-2'd1,
-2'd1}
COMMUTATION_TABLE_STAR_CW_0 [1:0] {
2'd1,
-2'd1,
2'd0,
2'd0,
2'd1,
-2'd1}
COMMUTATION_TABLE_STAR_CW_1 [1:0] {
2'd0,
2'd1,
2'd1,
-2'd1,
-2'd1,
2'd0}
COMMUTATION_TABLE_STAR_CW_2 [1:0] {
-2'd1,
2'd0,
-2'd1,
2'd1,
2'd0,
2'd1}
COMMUTATION_TABLE_STAR_CCW_0 [1:0] {
-2'd1,
2'd1,
2'd0,
2'd0,
-2'd1,
2'd1}
COMMUTATION_TABLE_STAR_CCW_1 [1:0] {
2'd0,
-2'd1,
-2'd1,
2'd1,
2'd1,
2'd0}
COMMUTATION_TABLE_STAR_CCW_2 [1:0] {
2'd1,
2'd0,
2'd1,
-2'd1,
2'd0,
-2'd1}

Processes

Type: always

Description
Control the current motor state

Type: always

Description
Generate the PWM signal

Instantiations

State machines

  • Control the current motor state
undefined