MotorWare f2806x Driver API Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
drv8301.h File Reference

Contains public interface to various functions related to the DRV8301 object. More...

#include "sw/drivers/spi/src/32b/f28x/f2806x/spi.h"
#include "sw/drivers/gpio/src/32b/f28x/f2806x/gpio.h"

Go to the source code of this file.

Data Structures

struct  _DRV_SPI_8301_Stat1_t_
 
struct  _DRV_SPI_8301_Stat2_t_
 
struct  _DRV_SPI_8301_CTRL1_t_
 
struct  _DRV_SPI_8301_CTRL2_t_
 
struct  _DRV_SPI_8301_Vars_t_
 
struct  _DRV8301_Obj_
 Defines the DRV8301 object. More...
 

Macros

#define DRV8301_ADDR_MASK   (0x7800)
 Defines the address mask. More...
 
#define DRV8301_DATA_MASK   (0x07FF)
 Defines the data mask. More...
 
#define DRV8301_RW_MASK   (0x8000)
 Defines the R/W mask. More...
 
#define DRV8301_FAULT_TYPE_MASK   (0x07FF)
 Defines the R/W mask. More...
 
#define DRV8301_STATUS1_FETLC_OC_BITS   (1 << 0)
 Defines the location of the FETLC_OC (FET Low side, Phase C Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FETHC_OC_BITS   (1 << 1)
 Defines the location of the FETLC_OC (FET High side, Phase C Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FETLB_OC_BITS   (1 << 2)
 Defines the location of the FETLC_OC (FET Low side, Phase B Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FETHB_OC_BITS   (1 << 3)
 Defines the location of the FETLC_OC (FET High side, Phase B Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FETLA_OC_BITS   (1 << 4)
 Defines the location of the FETLC_OC (FET Low side, Phase A Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FETHA_OC_BITS   (1 << 5)
 Defines the location of the FETLC_OC (FET High side, Phase A Over Current) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_OTW_BITS   (1 << 6)
 Defines the location of the OTW (Over Temperature Warning) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_OTSD_BITS   (1 << 7)
 Defines the location of the OTSD (Over Temperature Shut Down) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_PVDD_UV_BITS   (1 << 8)
 Defines the location of the PVDD_UV (Power supply Vdd, Under Voltage) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_GVDD_UV_BITS   (1 << 9)
 Defines the location of the GVDD_UV (DRV8301 Vdd, Under Voltage) bits in the Status 1 register. More...
 
#define DRV8301_STATUS1_FAULT_BITS   (1 << 10)
 Defines the location of the FAULT bits in the Status 1 register. More...
 
#define DRV8301_STATUS2_ID_BITS   (15 << 0)
 Defines the location of the Device ID bits in the Status 2 register. More...
 
#define DRV8301_STATUS2_GVDD_OV_BITS   (1 << 7)
 Defines the location of the GVDD_OV (DRV8301 Vdd, Over Voltage) bits in the Status 2 register. More...
 
#define DRV8301_CTRL1_GATE_CURRENT_BITS   (3 << 0)
 Defines the location of the GATE_CURRENT bits in the Control 1 register. More...
 
#define DRV8301_CTRL1_GATE_RESET_BITS   (1 << 2)
 Defines the location of the GATE_RESET bits in the Control 1 register. More...
 
#define DRV8301_CTRL1_PWM_MODE_BITS   (1 << 3)
 Defines the location of the PWM_MODE bits in the Control 1 register. More...
 
#define DRV8301_CTRL1_OC_MODE_BITS   (3 << 4)
 Defines the location of the OC_MODE bits in the Control 1 register. More...
 
#define DRV8301_CTRL1_OC_ADJ_SET_BITS   (31 << 6)
 Defines the location of the OC_ADJ bits in the Control 1 register. More...
 
#define DRV8301_CTRL2_OCTW_SET_BITS   (3 << 0)
 Defines the location of the OCTW_SET bits in the Control 2 register. More...
 
#define DRV8301_CTRL2_GAIN_BITS   (3 << 2)
 Defines the location of the GAIN bits in the Control 2 register. More...
 
#define DRV8301_CTRL2_DC_CAL_1_BITS   (1 << 4)
 Defines the location of the DC_CAL_1 bits in the Control 2 register. More...
 
#define DRV8301_CTRL2_DC_CAL_2_BITS   (1 << 5)
 Defines the location of the DC_CAL_2 bits in the Control 2 register. More...
 
#define DRV8301_CTRL2_OC_TOFF_BITS   (1 << 6)
 Defines the location of the OC_TOFF bits in the Control 2 register. More...
 

Typedefs

typedef struct _DRV_SPI_8301_Stat1_t_ DRV_SPI_8301_Stat1_t_
 
typedef struct _DRV_SPI_8301_Stat2_t_ DRV_SPI_8301_Stat2_t_
 
typedef struct _DRV_SPI_8301_CTRL1_t_ DRV_SPI_8301_CTRL1_t_
 
typedef struct _DRV_SPI_8301_CTRL2_t_ DRV_SPI_8301_CTRL2_t_
 
typedef struct _DRV_SPI_8301_Vars_t_ DRV_SPI_8301_Vars_t
 
typedef struct _DRV8301_Obj_ DRV8301_Obj
 Defines the DRV8301 object. More...
 
typedef struct _DRV8301_Obj_DRV8301_Handle
 Defines the DRV8301 handle. More...
 
typedef uint16_t DRV8301_Word_t
 Defines the DRV8301 Word type. More...
 

Enumerations

enum  DRV8301_CtrlMode_e { DRV8301_CtrlMode_Read = 1 << 15, DRV8301_CtrlMode_Write = 0 << 15 }
 Enumeration for the R/W modes. More...
 
enum  DRV8301_DcCalMode_e { DRV8301_DcCalMode_Ch1_Load = (0 << 4), DRV8301_DcCalMode_Ch1_NoLoad = (1 << 4), DRV8301_DcCalMode_Ch2_Load = (0 << 5), DRV8301_DcCalMode_Ch2_NoLoad = (1 << 5) }
 Enumeration for the DC calibration modes. More...
 
enum  DRV8301_FaultType_e {
  DRV8301_FaultType_NoFault = (0 << 0), DRV8301_FaultType_FETLC_OC = (1 << 0), DRV8301_FaultType_FETHC_OC = (1 << 1), DRV8301_FaultType_FETLB_OC = (1 << 2),
  DRV8301_FaultType_FETHB_OC = (1 << 3), DRV8301_FaultType_FETLA_OC = (1 << 4), DRV8301_FaultType_FETHA_OC = (1 << 5), DRV8301_FaultType_OTW = (1 << 6),
  DRV8301_FaultType_OTSD = (1 << 7), DRV8301_FaultType_PVDD_UV = (1 << 8), DRV8301_FaultType_GVDD_UV = (1 << 9), DRV8301_FaultType_GVDD_OV = (1 << 10)
}
 Enumeration for the fault types. More...
 
enum  DRV8301_OcMode_e { DRV8301_OcMode_CurrentLimit = 0 << 4, DRV8301_OcMode_LatchShutDown = 1 << 4, DRV8301_OcMode_ReportOnly = 2 << 4, DRV8301_OcMode_Disabled = 3 << 4 }
 Enumeration for the Over Current modes. More...
 
enum  DRV8301_OcOffTimeMode_e { DRV8301_OcOffTimeMode_Normal = 0 << 6, DRV8301_OcOffTimeMode_Ctrl = 1 << 6 }
 Enumeration for the Over Current Off Time modes. More...
 
enum  DRV8301_OcTwMode_e { DRV8301_OcTwMode_Both = 0 << 0, DRV8301_OcTwMode_OT_Only = 1 << 0, DRV8301_OcTwMode_OC_Only = 2 << 0 }
 Enumeration for the Over Current, Temperature Warning modes. More...
 
enum  DRV8301_PeakCurrent_e { DRV8301_PeakCurrent_1p70_A = 0 << 0, DRV8301_PeakCurrent_0p70_A = 1 << 0, DRV8301_PeakCurrent_0p25_A = 2 << 0 }
 Enumeration for the drv8301 peak current levels. More...
 
enum  DRV8301_PwmMode_e { DRV8301_PwmMode_Six_Inputs = 0 << 3, DRV8301_PwmMode_Three_Inputs = 1 << 3 }
 Enumeration for the PWM modes. More...
 
enum  DRV8301_RegName_e { DRV8301_RegName_Status_1 = 0 << 11, DRV8301_RegName_Status_2 = 1 << 11, DRV8301_RegName_Control_1 = 2 << 11, DRV8301_RegName_Control_2 = 3 << 11 }
 Enumeration for the register names. More...
 
enum  DRV8301_Reset_e { DRV8301_Reset_Normal = 0 << 2, DRV8301_Reset_All = 1 << 2 }
 Enumeration for the shunt amplifier gains. More...
 
enum  DRV8301_ShuntAmpGain_e { DRV8301_ShuntAmpGain_10VpV = 0 << 2, DRV8301_ShuntAmpGain_20VpV = 1 << 2, DRV8301_ShuntAmpGain_40VpV = 2 << 2, DRV8301_ShuntAmpGain_80VpV = 3 << 2 }
 Enumeration for the shunt amplifier gains. More...
 
enum  DRV8301_ShuntAmpNumber_e { DRV8301_ShuntAmpNumber_1 = 1, DRV8301_ShuntAmpNumber_2 = 2 }
 Enumeration for the shunt amplifier number. More...
 
enum  DRV8301_VdsLevel_e {
  DRV8301_VdsLevel_0p060_V = 0 << 6, DRV8301_VdsLevel_0p068_V = 1 << 6, DRV8301_VdsLevel_0p076_V = 2 << 6, DRV8301_VdsLevel_0p086_V = 3 << 6,
  DRV8301_VdsLevel_0p097_V = 4 << 6, DRV8301_VdsLevel_0p109_V = 5 << 6, DRV8301_VdsLevel_0p123_V = 6 << 6, DRV8301_VdsLevel_0p138_V = 7 << 6,
  DRV8301_VdsLevel_0p155_V = 8 << 6, DRV8301_VdsLevel_0p175_V = 9 << 6, DRV8301_VdsLevel_0p197_V = 10 << 6, DRV8301_VdsLevel_0p222_V = 11 << 6,
  DRV8301_VdsLevel_0p250_V = 12 << 6, DRV8301_VdsLevel_0p282_V = 13 << 6, DRV8301_VdsLevel_0p317_V = 14 << 6, DRV8301_VdsLevel_0p358_V = 15 << 6,
  DRV8301_VdsLevel_0p403_V = 16 << 6, DRV8301_VdsLevel_0p454_V = 17 << 6, DRV8301_VdsLevel_0p511_V = 18 << 6, DRV8301_VdsLevel_0p576_V = 19 << 6,
  DRV8301_VdsLevel_0p648_V = 20 << 6, DRV8301_VdsLevel_0p730_V = 21 << 6, DRV8301_VdsLevel_0p822_V = 22 << 6, DRV8301_VdsLevel_0p926_V = 23 << 6,
  DRV8301_VdsLevel_1p043_V = 24 << 6, DRV8301_VdsLevel_1p175_V = 25 << 6, DRV8301_VdsLevel_1p324_V = 26 << 6, DRV8301_VdsLevel_1p491_V = 27 << 6,
  DRV8301_VdsLevel_1p679_V = 28 << 6, DRV8301_VdsLevel_1p892_V = 29 << 6, DRV8301_VdsLevel_2p131_V = 30 << 6, DRV8301_VdsLevel_2p400_V = 31 << 6
}
 Enumeration for the Vds level for th over current adjustment. More...
 
enum  Drv8301SpiOutputDataSelect_e { DRV8301_GETID =0 }
 

Functions

static DRV8301_Word_t DRV8301_buildCtrlWord (const DRV8301_CtrlMode_e ctrlMode, const DRV8301_RegName_e regName, const uint16_t data)
 Builds the control word. More...
 
DRV8301_DcCalMode_e DRV8301_getDcCalMode (DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber)
 Gets the DC calibration mode. More...
 
void DRV8301_enable (DRV8301_Handle handle)
 Enables the DRV8301. More...
 
DRV8301_FaultType_e DRV8301_getFaultType (DRV8301_Handle handle)
 Gets the fault type. More...
 
uint16_t DRV8301_getId (DRV8301_Handle handle)
 Gets the device ID. More...
 
DRV8301_VdsLevel_e DRV8301_getOcLevel (DRV8301_Handle handle)
 Gets the over current level. More...
 
DRV8301_OcMode_e DRV8301_getOcMode (DRV8301_Handle handle)
 Gets the over current mode. More...
 
DRV8301_OcOffTimeMode_e DRV8301_getOcOffTimeMode (DRV8301_Handle handle)
 Gets the over current off time mode. More...
 
DRV8301_OcTwMode_e DRV8301_getOcTwMode (DRV8301_Handle handle)
 Gets the over current, temperature warning mode. More...
 
DRV8301_PeakCurrent_e DRV8301_getPeakCurrent (DRV8301_Handle handle)
 Gets the peak current value. More...
 
DRV8301_PwmMode_e DRV8301_getPwmMode (DRV8301_Handle handle)
 Gets the PWM mode. More...
 
DRV8301_ShuntAmpGain_e DRV8301_getShuntAmpGain (DRV8301_Handle handle)
 Gets the shunt amplifier gain value. More...
 
uint16_t DRV8301_getStatusRegister1 (DRV8301_Handle handle)
 Gets the status register 1 value. More...
 
uint16_t DRV8301_getStatusRegister2 (DRV8301_Handle handle)
 Gets the status register 2 value. More...
 
DRV8301_Handle DRV8301_init (void *pMemory, const size_t numBytes)
 Initializes the DRV8301 object. More...
 
bool DRV8301_isFault (DRV8301_Handle handle)
 Determines if DRV8301 fault has occurred. More...
 
bool DRV8301_isReset (DRV8301_Handle handle)
 Determines if DRV8301 is in reset. More...
 
uint16_t DRV8301_readSpi (DRV8301_Handle handle, const DRV8301_RegName_e regName)
 Reads data from the DRV8301 register. More...
 
void DRV8301_reset (DRV8301_Handle handle)
 Resets the DRV8301. More...
 
static void DRV8301_resetEnableTimeout (DRV8301_Handle handle)
 Resets the enable timeout flag. More...
 
static void DRV8301_resetRxTimeout (DRV8301_Handle handle)
 Resets the RX fifo timeout flag. More...
 
void DRV8301_setDcCalMode (DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber, const DRV8301_DcCalMode_e mode)
 Sets the DC calibration mode. More...
 
void DRV8301_setGpioHandle (DRV8301_Handle handle, GPIO_Handle gpioHandle)
 Sets the GPIO handle in the DRV8301. More...
 
void DRV8301_setGpioNumber (DRV8301_Handle handle, GPIO_Number_e gpioNumber)
 Sets the GPIO number in the DRV8301. More...
 
void DRV8301_setOcLevel (DRV8301_Handle handle, const DRV8301_VdsLevel_e VdsLevel)
 Sets the over current level in terms of Vds. More...
 
void DRV8301_setOcMode (DRV8301_Handle handle, const DRV8301_OcMode_e mode)
 Sets the over current mode. More...
 
void DRV8301_setOcOffTimeMode (DRV8301_Handle handle, const DRV8301_OcOffTimeMode_e mode)
 Sets the over current off time mode. More...
 
void DRV8301_setOcTwMode (DRV8301_Handle handle, const DRV8301_OcTwMode_e mode)
 Sets the over current, temperature warning mode. More...
 
void DRV8301_setPeakCurrent (DRV8301_Handle handle, const DRV8301_PeakCurrent_e peakCurrent)
 Sets the peak current value. More...
 
void DRV8301_setPwmMode (DRV8301_Handle handle, const DRV8301_PwmMode_e mode)
 Sets the PWM mode. More...
 
void DRV8301_setShuntAmpGain (DRV8301_Handle handle, const DRV8301_ShuntAmpGain_e gain)
 Sets the shunt amplifier gain value. More...
 
void DRV8301_setSpiHandle (DRV8301_Handle handle, SPI_Handle spiHandle)
 Sets the SPI handle in the DRV8301. More...
 
void DRV8301_writeSpi (DRV8301_Handle handle, const DRV8301_RegName_e regName, const uint16_t data)
 Writes data to the DRV8301 register. More...
 
void DRV8301_writeData (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
 Interface to all 8301 SPI variables. More...
 
void DRV8301_readData (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
 
void DRV8301_setupSpi (DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
 Initialize the interface to all 8301 SPI variables. More...
 

Detailed Description

Contains public interface to various functions related to the DRV8301 object.

(C) Copyright 2015, Texas Instruments, Inc.

Definition in file drv8301.h.