CALPOLY MECHATRONICS
Documentation for all Mechatronics Labs
ME405_FP_DRV8847.DRV8847 Class Reference

The DRV8847 class is used to enable and dissable the DRV8847 motor controller board as well as handle fault detection. More...

Public Member Functions

def __init__ (self, nSLEEP_pin, nFAULT_pin, maxFaultSep=500)
 A method to initialize a DRV8847 object. More...
 
def enable (self)
 A method to enable the motor by pulling the sleep pin high.
 
def disable (self)
 A method to disable the motor by pulling the sleep pin low.
 
def fault_CB (self, IRQ_src)
 An interrupt used to dissable the motors and enter a fault state if the DRV8847 board signals a fault. More...
 
def clear_fault (self)
 A method used to clear a fault so that the motors can be enabled. More...
 
def channel (self, INx_pin, INx_ch, INy_pin, INy_ch, INxy_timer)
 A method to create a DRV8847_channel object for controlling individual motors. More...
 

Public Attributes

 nSLEEP
 The pyb.Pin object that enables and diables the motor.
 
 nFault
 The pyb.Timer object used to generate PWM for the motor.
 
 faultInt
 
 fault
 Wether or not the DRV8847 object is in a fault condition. More...
 
 maxFaultSep
 
 lastFaultTime
 

Detailed Description

The DRV8847 class is used to enable and dissable the DRV8847 motor controller board as well as handle fault detection.

Note that the DRV8847 class does not control either motor conected to the board. Individual motors are controlled by the DRV8847_channel class.

Constructor & Destructor Documentation

◆ __init__()

def ME405_FP_DRV8847.DRV8847.__init__ (   self,
  nSLEEP_pin,
  nFAULT_pin,
  maxFaultSep = 500 
)

A method to initialize a DRV8847 object.

Parameters
nSLEEP_pinA pyb.Pin object that is connected to the nSLEEP_pin on the DRV8847 board.
nFAULT_pinA pyb.Pin object that is connected to the nFAULT_pin on the DRV8847 board.
maxFaultSepThe maximum sepperation between board faults to trigger a fault and disable the motors (in ms)

Member Function Documentation

◆ channel()

def ME405_FP_DRV8847.DRV8847.channel (   self,
  INx_pin,
  INx_ch,
  INy_pin,
  INy_ch,
  INxy_timer 
)

A method to create a DRV8847_channel object for controlling individual motors.

Parameters
INx_pinA pyb.Pin object connected to one lead of the motor via the DRV8847 board.
INx_chThe timer channel corresponding to INx_pin (integer).
INy_pinA pyb.Pin object connected to the other lead of the motor via the DRV8847 board.
INy_chThe timer channel corresponding to INy_pin (integer).
INxy_timerA pyb.Timer object to use for PWM on both the motor leads.
Returns
A DRV8847_channel object to set the duty cycle of the motor.

◆ clear_fault()

def ME405_FP_DRV8847.DRV8847.clear_fault (   self)

A method used to clear a fault so that the motors can be enabled.

The fault will only clear if the DRV8847 board is not currently in a fault condition.

Returns
Wether or not the fault was sucsesfully cleared. True = cleared, False = not cleared.

◆ fault_CB()

def ME405_FP_DRV8847.DRV8847.fault_CB (   self,
  IRQ_src 
)

An interrupt used to dissable the motors and enter a fault state if the DRV8847 board signals a fault.

Due to the sensititivy of the fault pin on the DRV8847 board, a fault is only triggered if two faults occur within DRV8847.maxFaultSep milliseconds of eachother (default is 500 ms).

Member Data Documentation

◆ fault

ME405_FP_DRV8847.DRV8847.fault

Wether or not the DRV8847 object is in a fault condition.

The motors will not enable until DRV8847.clear_fault is called.


The documentation for this class was generated from the following file: