MSPM0L1306BrushedMotorControlLibrary  1.0
Data Structures | Enumerations | Functions
drv8706-q1.h File Reference

Detailed Description

Brushed Motor Driver Library DRV8706-Q1 Motor Driver Module.


#include "hal.h"
Include dependency graph for drv8706-q1.h:

Go to the source code of this file.

Data Structures

struct  DRV8706Q1_INSTANCE
 Internal structure that represents a specific DRV8706-Q1. More...
 

Enumerations

enum  DRV8706Q1_MODES {
  DRV8706Q1_H_BRIDGE = 0,
  DRV8706Q1_PH_EN,
  DRV8706Q1_HALF_BRIDGE,
  DRV8706Q1_SPLIT_SOLENOID
}
 Represents the four different input control modes the DRV8706-Q1 supports. More...
 
enum  DRV8706Q1_H_BRIDGE_DRIVES {
  DRV8706Q1_H_BRIDGE_COAST = 0,
  DRV8706Q1_H_BRIDGE_REVERSE,
  DRV8706Q1_H_BRIDGE_FORWARD,
  DRV8706Q1_H_BRIDGE_ACTIVE_FREEWHEEL
}
 Represents all the different configurations the H-Bridge control mode supports. More...
 
enum  DRV8706Q1_PHASE_DRIVES {
  DRV8706Q1_PHASE_REVERSE = 0,
  DRV8706Q1_PHASE_FORWARD,
  DRV8706Q1_PHASE_ACTIVE_FREEWHEEL
}
 Represents all the different configurations the Phase Enable control mode supports. More...
 
enum  DRV8706Q1_SOLENOID_DRIVES {
  DRV8706Q1_SOLENOID_DISABLE = 0,
  DRV8706Q1_SOLENOID_PWM
}
 Represents all the different configurations the Solenoid control mode supports. More...
 
enum  DRV8706Q1_HALF_BRIDGE_DRIVES {
  DRV8706Q1_HALF_BRIDGE_HI_Z = 0,
  DRV8706Q1_HALF_BRIDGE_PWM
}
 Represents all the different configurations the Half Bridge control mode supports. More...
 
enum  DRV8706Q1_PWM_CHANNELS {
  DRV8706Q1_PWM_CHANNEL_0 = 0,
  DRV8706Q1_PWM_CHANNEL_1
}
 Represents the motor driver's input pins that expects a PWM signal. More...
 
enum  DRV8706Q1_SPI_ADDR {
  DRV8706Q1_SPI_ADDR_IC_STAT_1 = 0,
  DRV8706Q1_SPI_ADDR_VGS_VDS_STAT,
  DRV8706Q1_SPI_ADDR_IC_STAT_2,
  DRV8706Q1_SPI_ADDR_RSVD_STAT,
  DRV8706Q1_SPI_ADDR_IC_CTRL,
  DRV8706Q1_SPI_ADDR_BRG_CTRL,
  DRV8706Q1_SPI_ADDR_DRV_CTRL_1,
  DRV8706Q1_SPI_ADDR_DRV_CTRL_2,
  DRV8706Q1_SPI_ADDR_DRV_CTRL_3,
  DRV8706Q1_SPI_ADDR_VDS_CTRL_1,
  DRV8706Q1_SPI_ADDR_VDS_CTRL_2,
  DRV8706Q1_SPI_ADDR_OLSC_CTRL,
  DRV8706Q1_SPI_ADDR_UVOV_CTRL,
  DRV8706Q1_SPI_ADDR_CSA_CTRL
}
 Represents the addresses for all the SPI registers. More...
 
enum  DRV8706Q1_CSA_GAINS {
  DRV8706Q1_CSA_GAIN_10 = 10,
  DRV8706Q1_CSA_GAIN_20 = 20,
  DRV8706Q1_CSA_GAIN_40 = 40,
  DRV8706Q1_CSA_GAIN_80 = 80
}
 Represents all the current sense amplifier gain settings. More...
 
enum  DRV8706Q1_CSA_DIV {
  DRV8706Q1_CSA_DIV_2 = 2,
  DRV8706Q1_CSA_DIV_8 = 8
}
 Represents all the current sense amplifier reference voltage divider settings. More...
 

Functions

void DRV8706Q1_init (DRV8706Q1_INSTANCE *drv)
 Initialized critical structure representing specific instance of the motor driver. Important Not calling this function will result in unexpected results. More...
 
uint16_t DRV8706Q1_switchToHBridgeDrive (DRV8706Q1_INSTANCE *drv, DRV8706Q1_H_BRIDGE_DRIVES drive)
 Function will program the motor driver to switch to H-bridge control mode and reconfigure the pin to the selected H-bridge mode pin configuration to use. Important Note this function updates the motor driver registers via SPI. More...
 
void DRV8706Q1_changeHBridgeDrive (DRV8706Q1_INSTANCE drv, DRV8706Q1_H_BRIDGE_DRIVES drive)
 Function will reconfigure the pins for the specific H-bridge mode configuration. Unlike DRV8706Q1_switchToHBridgeDrive this function does not update the control mode via SPI. So the device must be configured to H-bridge mode already. More...
 
uint16_t DRV8706Q1_switchToPhaseDrive (DRV8706Q1_INSTANCE *drv, DRV8706Q1_PHASE_DRIVES drive)
 Function will program the motor driver to switch to Phase control mode and reconfigure the pin to the selected Phase mode pin configuration to use. Note this function updates the motor driver registers via SPI. More...
 
void DRV8706Q1_changePhaseDrive (DRV8706Q1_INSTANCE drv, DRV8706Q1_PHASE_DRIVES drive)
 Function will reconfigure the pins for the specific Phase enable mode configuration. Unlike DRV8706Q1_switchToPhaseDrive this function does not update the control mode via SPI. So the device must be configured to Phase enable mode already. More...
 
void DRV8706Q1_changeSolenoidDrive (DRV8706Q1_INSTANCE drv, DRV8706Q1_SOLENOID_DRIVES drive)
 Function will reconfigure the pins for the specific Solenoid mode configuration. Unlike DRV8706Q1_switchToSolenoidDrive this function does not update the control mode via SPI. So the device must be configured to solenoid already. More...
 
void DRV8706Q1_changeHalfBridgeDrive (DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvChan, DRV8706Q1_HALF_BRIDGE_DRIVES drive)
 Function will reconfigure the pins for the specific Half Bridge mode configuration. Unlike DRV8706Q1_switchToHalfBridgeDrive this function does not update the control mode via SPI. So the device must be configured to Phase enable mode already. More...
 
uint16_t DRV8706Q1_switchToHalfBridgeDrive (DRV8706Q1_INSTANCE *drv, DRV8706Q1_HALF_BRIDGE_DRIVES driveChan0, DRV8706Q1_HALF_BRIDGE_DRIVES driveChan1)
 Function will reconfigure the pins for the specific Half Bridge mode configuration. Also the control mode will be updated via SPI. More...
 
uint16_t DRV8706Q1_switchToSolenoidDrive (DRV8706Q1_INSTANCE *drv, DRV8706Q1_SOLENOID_DRIVES drive)
 Function will program the motor driver to switch to Solenoid control mode and reconfigure the pin to the selected Solenoid mode pin configuration to use. Note this function updates the motor driver registers via SPI. More...
 
uint16_t DRV8706Q1_spiUpdateRegister (DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr, uint8_t mask, uint8_t value)
 Function to allow a user to modify a specific bitfield in one of the motor driver's registers. This function automatically converts the parameters to the data format needed for SPI communication with the DRV8706-Q1. More...
 
__STATIC_INLINE uint16_t DRV8706Q1_spiWriteCmd (DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr, uint8_t data)
 Perform a SPI write operation. This function already converts the address and data to the data format required by the motor driver. Note that if the motor driver is sleeping then the motor driver will ignore the spi operation. More...
 
__STATIC_INLINE uint16_t DRV8706Q1_spiReadCmd (DRV8706Q1_INSTANCE drv, DRV8706Q1_SPI_ADDR addr)
 Perform a SPI read operation. This function converts the address to the data format required by the motor driver. Note that if the motor driver is sleeping then the motor driver will ignore the spi operation and you will read back 0x0. More...
 
_iq20 DRV8706Q1_getCurrent (DRV8706Q1_INSTANCE drv)
 Return the current read from the DRV8706-Q1 motor driver. More...
 
void DRV8706Q1_setDrivePWMFreq (DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvPwmChan, uint32_t value)
 Sets the PWM frequency for the correct channel based on the drive specified. More...
 
void DRV8706Q1_setDriveDutyCycle (DRV8706Q1_INSTANCE drv, DRV8706Q1_PWM_CHANNELS drvPwmChan, uint8_t value)
 Sets the duty cycle for the correct channel based on the drive specified. More...
 
void DRV8706Q1_reset (DRV8706Q1_INSTANCE *drv)
 This functions resets the SPI registers of the motor driver by putting it to sleep, delaying and waking it up. Note that when this function is called the motor driver sleep pin will be high. This functional internally calls DRV8706Q1_powerOnResetVal. More...
 
void DRV8706Q1_powerOnResetVal (DRV8706Q1_INSTANCE *drv)
 Reset internal DRV structure variables to sync with the motor driver registers power on reset value. More...
 
__STATIC_INLINE void DRV8706Q1_setNSleep (DRV8706Q1_INSTANCE drv, bool value)
 Help function that controls the MCU pin connected to nSleep pin on the motor driver. Note if you manually set nSLEEP low for more than 1 ms then all the register values will be reset to their default values. Therefore, it would be important to immediately call DRV8706Q1_powerOnResetVal whenver you set nSLEEP to high to make sure internal structures are sync. More...
 
__STATIC_INLINE void DRV8706Q1_setDrvOff (DRV8706Q1_INSTANCE drv, bool value)
 Help function that controls the MCU pin connected to DrvOff pin on the motor driver. More...
 
__STATIC_INLINE void DRV8706Q1_setNHiZ1 (DRV8706Q1_INSTANCE drv, bool value)
 Help function that controls the MCU pin connected to nHiZ1 pin on the motor driver. More...
 
__STATIC_INLINE void DRV8706Q1_setNHiZ2 (DRV8706Q1_INSTANCE drv, bool value)
 Help function that controls the MCU pin connected to nHiZ2 pin on the motor driver. More...
 
void DRV8706Q1_setAnalogReference (DRV8706Q1_INSTANCE *drv, _iq20 aRef_V)
 Set voltage connected to the motor driver's AREF pin. This value is needed to properly calculate the motor's current. More...
 
uint16_t DRV8706Q1_setAnalogReferenceDivider (DRV8706Q1_INSTANCE *drv, DRV8706Q1_CSA_DIV csaDiv)
 Set current shunt amplifier reference voltage divider. This function will update the CSA_CTRL.CSA_DIV register bitfield to the specified voltage divider. More...
 
uint16_t DRV8706Q1_setCurrentSenseGain (DRV8706Q1_INSTANCE *drv, DRV8706Q1_CSA_GAINS gcsa)
 Configure the CSA to the gain setting specified. This function will update the CSA_CTRL.CSA_GAIN register bitfield with the gain you specified. More...
 
void DRV8706Q1_setCurrentShuntResistor (DRV8706Q1_INSTANCE *drv, _iq20 rShunt)
 Set the current shunt resistor value used by the current sense amplifier. This value needs to be set based on the used by your hardware. More...
 
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale