MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

drv8301.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2 * Copyright (c) 2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * --/COPYRIGHT--*/
32 #ifndef _DRV8301_H_
33 #define _DRV8301_H_
34
40
41
42 // **************************************************************************
43 // the includes
44
45 // drivers
46 #include "sw/drivers/spi/src/32b/f28x/f2806x/spi.h"
47 #include "sw/drivers/gpio/src/32b/f28x/f2806x/gpio.h"
48
49 // modules
50
51 // solutions
52
53
56
59
60
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66
67 // **************************************************************************
68 // the defines
69
72 #define DRV8301_ADDR_MASK (0x7800)
73
74
77 #define DRV8301_DATA_MASK (0x07FF)
78
79
82 #define DRV8301_RW_MASK (0x8000)
83
84
87 #define DRV8301_FAULT_TYPE_MASK (0x07FF)
88
89
92 #define DRV8301_STATUS1_FETLC_OC_BITS (1 << 0)
93
96 #define DRV8301_STATUS1_FETHC_OC_BITS (1 << 1)
97
100 #define DRV8301_STATUS1_FETLB_OC_BITS (1 << 2)
101
104 #define DRV8301_STATUS1_FETHB_OC_BITS (1 << 3)
105
108 #define DRV8301_STATUS1_FETLA_OC_BITS (1 << 4)
109
112 #define DRV8301_STATUS1_FETHA_OC_BITS (1 << 5)
113
116 #define DRV8301_STATUS1_OTW_BITS (1 << 6)
117
120 #define DRV8301_STATUS1_OTSD_BITS (1 << 7)
121
124 #define DRV8301_STATUS1_PVDD_UV_BITS (1 << 8)
125
128 #define DRV8301_STATUS1_GVDD_UV_BITS (1 << 9)
129
132 #define DRV8301_STATUS1_FAULT_BITS (1 << 10)
133
134
137 #define DRV8301_STATUS2_ID_BITS (15 << 0)
138
141 #define DRV8301_STATUS2_GVDD_OV_BITS (1 << 7)
142
143
146 #define DRV8301_CTRL1_GATE_CURRENT_BITS (3 << 0)
147
150 #define DRV8301_CTRL1_GATE_RESET_BITS (1 << 2)
151
154 #define DRV8301_CTRL1_PWM_MODE_BITS (1 << 3)
155
158 #define DRV8301_CTRL1_OC_MODE_BITS (3 << 4)
159
162 #define DRV8301_CTRL1_OC_ADJ_SET_BITS (31 << 6)
163
164
167 #define DRV8301_CTRL2_OCTW_SET_BITS (3 << 0)
168
171 #define DRV8301_CTRL2_GAIN_BITS (3 << 2)
172
175 #define DRV8301_CTRL2_DC_CAL_1_BITS (1 << 4)
176
179 #define DRV8301_CTRL2_DC_CAL_2_BITS (1 << 5)
180
183 #define DRV8301_CTRL2_OC_TOFF_BITS (1 << 6)
184
185
186 // **************************************************************************
187 // the typedefs
188
191 typedef enum
192 {
193 DRV8301_CtrlMode_Read = 1 << 15,
194 DRV8301_CtrlMode_Write = 0 << 15
195 } DRV8301_CtrlMode_e;
196
197
200 typedef enum
201 {
202 DRV8301_DcCalMode_Ch1_Load = (0 << 4),
203 DRV8301_DcCalMode_Ch1_NoLoad = (1 << 4),
204 DRV8301_DcCalMode_Ch2_Load = (0 << 5),
205 DRV8301_DcCalMode_Ch2_NoLoad = (1 << 5)
206 } DRV8301_DcCalMode_e;
207
208
211 typedef enum
212 {
213 DRV8301_FaultType_NoFault = (0 << 0),
214 DRV8301_FaultType_FETLC_OC = (1 << 0),
215 DRV8301_FaultType_FETHC_OC = (1 << 1),
216 DRV8301_FaultType_FETLB_OC = (1 << 2),
217 DRV8301_FaultType_FETHB_OC = (1 << 3),
218 DRV8301_FaultType_FETLA_OC = (1 << 4),
219 DRV8301_FaultType_FETHA_OC = (1 << 5),
220 DRV8301_FaultType_OTW = (1 << 6),
221 DRV8301_FaultType_OTSD = (1 << 7),
222 DRV8301_FaultType_PVDD_UV = (1 << 8),
223 DRV8301_FaultType_GVDD_UV = (1 << 9),
224 DRV8301_FaultType_GVDD_OV = (1 << 10)
225 } DRV8301_FaultType_e;
226
227
230 typedef enum
231 {
232 DRV8301_OcMode_CurrentLimit = 0 << 4,
233 DRV8301_OcMode_LatchShutDown = 1 << 4,
234 DRV8301_OcMode_ReportOnly = 2 << 4,
235 DRV8301_OcMode_Disabled = 3 << 4
236 } DRV8301_OcMode_e;
237
238
241 typedef enum
242 {
243 DRV8301_OcOffTimeMode_Normal = 0 << 6,
244 DRV8301_OcOffTimeMode_Ctrl = 1 << 6
245 } DRV8301_OcOffTimeMode_e;
246
247
250 typedef enum
251 {
252 DRV8301_OcTwMode_Both = 0 << 0,
253 DRV8301_OcTwMode_OT_Only = 1 << 0,
254 DRV8301_OcTwMode_OC_Only = 2 << 0
255 } DRV8301_OcTwMode_e;
256
257
260 typedef enum
261 {
262 DRV8301_PeakCurrent_1p70_A = 0 << 0,
263 DRV8301_PeakCurrent_0p70_A = 1 << 0,
264 DRV8301_PeakCurrent_0p25_A = 2 << 0
265 } DRV8301_PeakCurrent_e;
266
267
270 typedef enum
271 {
272 DRV8301_PwmMode_Six_Inputs = 0 << 3,
273 DRV8301_PwmMode_Three_Inputs = 1 << 3
274 } DRV8301_PwmMode_e;
275
276
279 typedef enum
280 {
281 DRV8301_RegName_Status_1 = 0 << 11,
282 DRV8301_RegName_Status_2 = 1 << 11,
283 DRV8301_RegName_Control_1 = 2 << 11,
284 DRV8301_RegName_Control_2 = 3 << 11
285 } DRV8301_RegName_e;
286
287
288
291 typedef enum
292 {
293 DRV8301_Reset_Normal = 0 << 2,
294 DRV8301_Reset_All = 1 << 2
295 } DRV8301_Reset_e;
296
297
300 typedef enum
301 {
302 DRV8301_ShuntAmpGain_10VpV = 0 << 2,
303 DRV8301_ShuntAmpGain_20VpV = 1 << 2,
304 DRV8301_ShuntAmpGain_40VpV = 2 << 2,
305 DRV8301_ShuntAmpGain_80VpV = 3 << 2
306 } DRV8301_ShuntAmpGain_e;
307
308
311 typedef enum
312 {
313 DRV8301_ShuntAmpNumber_1 = 1,
314 DRV8301_ShuntAmpNumber_2 = 2
315 } DRV8301_ShuntAmpNumber_e;
316
317
320 typedef enum
321 {
322 DRV8301_VdsLevel_0p060_V = 0 << 6,
323 DRV8301_VdsLevel_0p068_V = 1 << 6,
324 DRV8301_VdsLevel_0p076_V = 2 << 6,
325 DRV8301_VdsLevel_0p086_V = 3 << 6,
326 DRV8301_VdsLevel_0p097_V = 4 << 6,
327 DRV8301_VdsLevel_0p109_V = 5 << 6,
328 DRV8301_VdsLevel_0p123_V = 6 << 6,
329 DRV8301_VdsLevel_0p138_V = 7 << 6,
330 DRV8301_VdsLevel_0p155_V = 8 << 6,
331 DRV8301_VdsLevel_0p175_V = 9 << 6,
332 DRV8301_VdsLevel_0p197_V = 10 << 6,
333 DRV8301_VdsLevel_0p222_V = 11 << 6,
334 DRV8301_VdsLevel_0p250_V = 12 << 6,
335 DRV8301_VdsLevel_0p282_V = 13 << 6,
336 DRV8301_VdsLevel_0p317_V = 14 << 6,
337 DRV8301_VdsLevel_0p358_V = 15 << 6,
338 DRV8301_VdsLevel_0p403_V = 16 << 6,
339 DRV8301_VdsLevel_0p454_V = 17 << 6,
340 DRV8301_VdsLevel_0p511_V = 18 << 6,
341 DRV8301_VdsLevel_0p576_V = 19 << 6,
342 DRV8301_VdsLevel_0p648_V = 20 << 6,
343 DRV8301_VdsLevel_0p730_V = 21 << 6,
344 DRV8301_VdsLevel_0p822_V = 22 << 6,
345 DRV8301_VdsLevel_0p926_V = 23 << 6,
346 DRV8301_VdsLevel_1p043_V = 24 << 6,
347 DRV8301_VdsLevel_1p175_V = 25 << 6,
348 DRV8301_VdsLevel_1p324_V = 26 << 6,
349 DRV8301_VdsLevel_1p491_V = 27 << 6,
350 DRV8301_VdsLevel_1p679_V = 28 << 6,
351 DRV8301_VdsLevel_1p892_V = 29 << 6,
352 DRV8301_VdsLevel_2p131_V = 30 << 6,
353 DRV8301_VdsLevel_2p400_V = 31 << 6
354 } DRV8301_VdsLevel_e;
355
356
357 typedef enum
358 {
359 DRV8301_GETID=0
360 } Drv8301SpiOutputDataSelect_e;
361
362
363 typedef struct _DRV_SPI_8301_Stat1_t_
364 {
365 bool FAULT;
366 bool GVDD_UV;
367 bool PVDD_UV;
368 bool OTSD;
369 bool OTW;
370 bool FETHA_OC;
371 bool FETLA_OC;
372 bool FETHB_OC;
373 bool FETLB_OC;
374 bool FETHC_OC;
375 bool FETLC_OC;
376 }DRV_SPI_8301_Stat1_t_;
377
378
379 typedef struct _DRV_SPI_8301_Stat2_t_
380 {
381 bool GVDD_OV;
382 uint16_t DeviceID;
383 }DRV_SPI_8301_Stat2_t_;
384
385
386 typedef struct _DRV_SPI_8301_CTRL1_t_
387 {
388 DRV8301_PeakCurrent_e DRV8301_CURRENT;
389 DRV8301_Reset_e DRV8301_RESET;
390 DRV8301_PwmMode_e PWM_MODE;
391 DRV8301_OcMode_e OC_MODE;
392 DRV8301_VdsLevel_e OC_ADJ_SET;
393 }DRV_SPI_8301_CTRL1_t_;
394
395
396 typedef struct _DRV_SPI_8301_CTRL2_t_
397 {
398 DRV8301_OcTwMode_e OCTW_SET;
399 DRV8301_ShuntAmpGain_e GAIN;
400 DRV8301_DcCalMode_e DC_CAL_CH1p2;
401 DRV8301_OcOffTimeMode_e OC_TOFF;
402 }DRV_SPI_8301_CTRL2_t_;
403
404
405 typedef struct _DRV_SPI_8301_Vars_t_
406 {
407 DRV_SPI_8301_Stat1_t_ Stat_Reg_1;
408 DRV_SPI_8301_Stat2_t_ Stat_Reg_2;
409 DRV_SPI_8301_CTRL1_t_ Ctrl_Reg_1;
410 DRV_SPI_8301_CTRL2_t_ Ctrl_Reg_2;
411 bool SndCmd;
412 bool RcvCmd;
413 }DRV_SPI_8301_Vars_t;
414
415
418 typedef struct _DRV8301_Obj_
419 {
420 SPI_Handle spiHandle;
421 GPIO_Handle gpioHandle;
422 GPIO_Number_e gpioNumber;
423 bool RxTimeOut;
424 bool enableTimeOut;
425 } DRV8301_Obj;
426
427
430 typedef struct _DRV8301_Obj_ *DRV8301_Handle;
431
432
435 typedef uint16_t DRV8301_Word_t;
436
437
438 // **************************************************************************
439 // the globals
440
441
442
443 // **************************************************************************
444 // the function prototypes
445
446
452 static inline DRV8301_Word_t DRV8301_buildCtrlWord(const DRV8301_CtrlMode_e ctrlMode,
453 const DRV8301_RegName_e regName,
454 const uint16_t data)
455 {
456 DRV8301_Word_t ctrlWord = ctrlMode | regName | (data & DRV8301_DATA_MASK);
457
458 return(ctrlWord);
459 } // end of DRV8301_buildCtrlWord() function
460
461
466 extern DRV8301_DcCalMode_e DRV8301_getDcCalMode(DRV8301_Handle handle,
467 const DRV8301_ShuntAmpNumber_e ampNumber);
468
471 extern void DRV8301_enable(DRV8301_Handle handle);
472
473
477 extern DRV8301_FaultType_e DRV8301_getFaultType(DRV8301_Handle handle);
478
479
483 extern uint16_t DRV8301_getId(DRV8301_Handle handle);
484
485
489 extern DRV8301_VdsLevel_e DRV8301_getOcLevel(DRV8301_Handle handle);
490
491
495 extern DRV8301_OcMode_e DRV8301_getOcMode(DRV8301_Handle handle);
496
497
501 extern DRV8301_OcOffTimeMode_e DRV8301_getOcOffTimeMode(DRV8301_Handle handle);
502
503
507 extern DRV8301_OcTwMode_e DRV8301_getOcTwMode(DRV8301_Handle handle);
508
509
513 extern DRV8301_PeakCurrent_e DRV8301_getPeakCurrent(DRV8301_Handle handle);
514
515
519 extern DRV8301_PwmMode_e DRV8301_getPwmMode(DRV8301_Handle handle);
520
521
525 extern DRV8301_ShuntAmpGain_e DRV8301_getShuntAmpGain(DRV8301_Handle handle);
526
527
531 extern uint16_t DRV8301_getStatusRegister1(DRV8301_Handle handle);
532
533
537 extern uint16_t DRV8301_getStatusRegister2(DRV8301_Handle handle);
538
539
544 extern DRV8301_Handle DRV8301_init(void *pMemory,const size_t numBytes);
545
546
550 extern bool DRV8301_isFault(DRV8301_Handle handle);
551
552
556 extern bool DRV8301_isReset(DRV8301_Handle handle);
557
558
563 extern uint16_t DRV8301_readSpi(DRV8301_Handle handle,const DRV8301_RegName_e regName);
564
565
568 extern void DRV8301_reset(DRV8301_Handle handle);
569
570
573 static inline void DRV8301_resetEnableTimeout(DRV8301_Handle handle)
574 {
575 DRV8301_Obj *obj = (DRV8301_Obj *)handle;
576
577 obj->enableTimeOut = false;
578
579 return;
580 }
581
582
585 static inline void DRV8301_resetRxTimeout(DRV8301_Handle handle)
586 {
587 DRV8301_Obj *obj = (DRV8301_Obj *)handle;
588
589 obj->RxTimeOut = false;
590
591 return;
592 }
593
594
599 extern void DRV8301_setDcCalMode(DRV8301_Handle handle,
600 const DRV8301_ShuntAmpNumber_e ampNumber,
601 const DRV8301_DcCalMode_e mode);
602
603
607 void DRV8301_setGpioHandle(DRV8301_Handle handle,GPIO_Handle gpioHandle);
608
609
613 void DRV8301_setGpioNumber(DRV8301_Handle handle,GPIO_Number_e gpioNumber);
614
615
619 extern void DRV8301_setOcLevel(DRV8301_Handle handle,const DRV8301_VdsLevel_e VdsLevel);
620
621
625 extern void DRV8301_setOcMode(DRV8301_Handle handle,const DRV8301_OcMode_e mode);
626
627
631 extern void DRV8301_setOcOffTimeMode(DRV8301_Handle handle,const DRV8301_OcOffTimeMode_e mode);
632
633
637 extern void DRV8301_setOcTwMode(DRV8301_Handle handle,const DRV8301_OcTwMode_e mode);
638
639
643 extern void DRV8301_setPeakCurrent(DRV8301_Handle handle,const DRV8301_PeakCurrent_e peakCurrent);
644
645
649 extern void DRV8301_setPwmMode(DRV8301_Handle handle,const DRV8301_PwmMode_e mode);
650
651
655 extern void DRV8301_setShuntAmpGain(DRV8301_Handle handle,const DRV8301_ShuntAmpGain_e gain);
656
657
661 void DRV8301_setSpiHandle(DRV8301_Handle handle,SPI_Handle spiHandle);
662
663
668 extern void DRV8301_writeSpi(DRV8301_Handle handle,const DRV8301_RegName_e regName,const uint16_t data);
669
670
692 extern void DRV8301_writeData(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
693
694
697 extern void DRV8301_readData(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
698
699
702 extern void DRV8301_setupSpi(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
703
704
705 #ifdef __cplusplus
706 }
707 #endif // extern "C"
708
710
711 #endif // end of _DRV8301_H_ definition
712
713
714
715
716
DRV8301_ShuntAmpNumber_1
Shunt amplifier number 1.
Definition: drv8301.h:313
_DRV_SPI_8301_CTRL2_t_::OC_TOFF
DRV8301_OcOffTimeMode_e OC_TOFF
Definition: drv8301.h:401
DRV8301_getFaultType
DRV8301_FaultType_e DRV8301_getFaultType(DRV8301_Handle handle)
Gets the fault type.
Definition: drv8301.c:116
DRV8301_FaultType_FETHC_OC
FET High side, Phase C Over Current fault.
Definition: drv8301.h:215
DRV8301_VdsLevel_0p511_V
Vds = 0.511 V.
Definition: drv8301.h:340
_SPI_Obj_
Defines the serial peripheral interface (SPI) object.
Definition: spi.h:346
DRV8301_VdsLevel_1p679_V
Vds = 1.679 V.
Definition: drv8301.h:350
DRV8301_setPwmMode
void DRV8301_setPwmMode(DRV8301_Handle handle, const DRV8301_PwmMode_e mode)
Sets the PWM mode.
Definition: drv8301.c:547
DRV8301_DcCalMode_e
DRV8301_DcCalMode_e
Enumeration for the DC calibration modes.
Definition: drv8301.h:200
DRV8301_VdsLevel_0p250_V
Vds = 0.250 V.
Definition: drv8301.h:334
DRV8301_OcOffTimeMode_Normal
normal CBC operation
Definition: drv8301.h:243
_DRV_SPI_8301_Stat1_t_::FETHB_OC
bool FETHB_OC
Definition: drv8301.h:372
_DRV8301_Obj_::enableTimeOut
bool enableTimeOut
the timeout flag for drv8301 enable
Definition: drv8301.h:424
DRV8301_resetEnableTimeout
static void DRV8301_resetEnableTimeout(DRV8301_Handle handle)
Resets the enable timeout flag.
Definition: drv8301.h:573
DRV8301_readData
void DRV8301_readData(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
Definition: drv8301.c:642
DRV8301_ShuntAmpNumber_e
DRV8301_ShuntAmpNumber_e
Enumeration for the shunt amplifier number.
Definition: drv8301.h:311
DRV8301_VdsLevel_0p097_V
Vds = 0.097 V.
Definition: drv8301.h:326
_DRV_SPI_8301_Vars_t_::Ctrl_Reg_1
DRV_SPI_8301_CTRL1_t_ Ctrl_Reg_1
Definition: drv8301.h:409
DRV8301_setSpiHandle
void DRV8301_setSpiHandle(DRV8301_Handle handle, SPI_Handle spiHandle)
Sets the SPI handle in the DRV8301.
Definition: drv8301.c:306
DRV8301_VdsLevel_0p175_V
Vds = 0.175 V.
Definition: drv8301.h:331
DRV8301_getPeakCurrent
DRV8301_PeakCurrent_e DRV8301_getPeakCurrent(DRV8301_Handle handle)
Gets the peak current value.
Definition: drv8301.c:219
DRV8301_Word_t
uint16_t DRV8301_Word_t
Defines the DRV8301 Word type.
Definition: drv8301.h:435
_DRV_SPI_8301_Stat1_t_::FAULT
bool FAULT
Definition: drv8301.h:365
DRV8301_DcCalMode_Ch2_NoLoad
Shunt amplifier 2 disconnected from load and input pins are shorted.
Definition: drv8301.h:205
DRV8301_setGpioNumber
void DRV8301_setGpioNumber(DRV8301_Handle handle, GPIO_Number_e gpioNumber)
Sets the GPIO number in the DRV8301.
Definition: drv8301.c:295
_DRV8301_Obj_
Defines the DRV8301 object.
Definition: drv8301.h:418
_DRV_SPI_8301_CTRL2_t_::DC_CAL_CH1p2
DRV8301_DcCalMode_e DC_CAL_CH1p2
Definition: drv8301.h:400
DRV8301_FaultType_NoFault
No fault.
Definition: drv8301.h:213
DRV8301_DcCalMode_Ch1_Load
Shunt amplifier 1 connected to load via input pins.
Definition: drv8301.h:202
_DRV_SPI_8301_CTRL1_t_::OC_ADJ_SET
DRV8301_VdsLevel_e OC_ADJ_SET
Definition: drv8301.h:392
_DRV_SPI_8301_CTRL1_t_
Definition: drv8301.h:386
DRV_SPI_8301_Stat1_t_
struct _DRV_SPI_8301_Stat1_t_ DRV_SPI_8301_Stat1_t_
DRV8301_writeSpi
void DRV8301_writeSpi(DRV8301_Handle handle, const DRV8301_RegName_e regName, const uint16_t data)
Writes data to the DRV8301 register.
Definition: drv8301.c:589
gpio.h
Contains public interface to general purpose I/O (GPIO) methods.
DRV8301_PwmMode_e
DRV8301_PwmMode_e
Enumeration for the PWM modes.
Definition: drv8301.h:270
DRV8301_init
DRV8301_Handle DRV8301_init(void *pMemory, const size_t numBytes)
Initializes the DRV8301 object.
Definition: drv8301.c:264
DRV8301_OcTwMode_OC_Only
report only OC at /OCTW pin
Definition: drv8301.h:254
_DRV_SPI_8301_CTRL1_t_::PWM_MODE
DRV8301_PwmMode_e PWM_MODE
Definition: drv8301.h:390
_DRV_SPI_8301_CTRL1_t_::OC_MODE
DRV8301_OcMode_e OC_MODE
Definition: drv8301.h:391
DRV8301_setOcMode
void DRV8301_setOcMode(DRV8301_Handle handle, const DRV8301_OcMode_e mode)
Sets the over current mode.
Definition: drv8301.c:463
DRV8301_VdsLevel_1p043_V
Vds = 1.403 V.
Definition: drv8301.h:346
DRV8301_VdsLevel_0p358_V
Vds = 0.358 V.
Definition: drv8301.h:337
DRV8301_VdsLevel_0p926_V
Vds = 0.926 V.
Definition: drv8301.h:345
DRV8301_setDcCalMode
void DRV8301_setDcCalMode(DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber, const DRV8301_DcCalMode_e mode)
Sets the DC calibration mode.
Definition: drv8301.c:413
DRV8301_OcTwMode_OT_Only
report only OT at /OCTW pin
Definition: drv8301.h:253
_DRV_SPI_8301_Stat1_t_::FETHC_OC
bool FETHC_OC
Definition: drv8301.h:374
DRV8301_FaultType_GVDD_UV
DRV8301 Vdd Under Voltage fault.
Definition: drv8301.h:223
DRV8301_VdsLevel_0p197_V
Vds = 0.197 V.
Definition: drv8301.h:332
DRV8301_OcTwMode_e
DRV8301_OcTwMode_e
Enumeration for the Over Current, Temperature Warning modes.
Definition: drv8301.h:250
DRV8301_setPeakCurrent
void DRV8301_setPeakCurrent(DRV8301_Handle handle, const DRV8301_PeakCurrent_e peakCurrent)
Sets the peak current value.
Definition: drv8301.c:526
_DRV_SPI_8301_CTRL2_t_::GAIN
DRV8301_ShuntAmpGain_e GAIN
Definition: drv8301.h:399
DRV8301_Reset_e
DRV8301_Reset_e
Enumeration for the shunt amplifier gains.
Definition: drv8301.h:291
DRV8301_VdsLevel_1p892_V
Vds = 1.892 V.
Definition: drv8301.h:351
DRV8301_ShuntAmpNumber_2
Shunt amplifier number 2.
Definition: drv8301.h:314
DRV8301_OcTwMode_Both
report both OT and OC at /OCTW pin
Definition: drv8301.h:252
DRV8301_getOcTwMode
DRV8301_OcTwMode_e DRV8301_getOcTwMode(DRV8301_Handle handle)
Gets the over current, temperature warning mode.
Definition: drv8301.c:204
DRV8301_Reset_All
reset all
Definition: drv8301.h:294
DRV8301_VdsLevel_0p076_V
Vds = 0.076 V.
Definition: drv8301.h:324
DRV8301_buildCtrlWord
static DRV8301_Word_t DRV8301_buildCtrlWord(const DRV8301_CtrlMode_e ctrlMode, const DRV8301_RegName_e regName, const uint16_t data)
Builds the control word.
Definition: drv8301.h:452
_DRV_SPI_8301_Stat2_t_::GVDD_OV
bool GVDD_OV
Definition: drv8301.h:381
DRV8301_FaultType_FETLB_OC
FET Low side, Phase B Over Current fault.
Definition: drv8301.h:216
DRV8301_getShuntAmpGain
DRV8301_ShuntAmpGain_e DRV8301_getShuntAmpGain(DRV8301_Handle handle)
Gets the shunt amplifier gain value.
Definition: drv8301.c:249
DRV8301_VdsLevel_0p403_V
Vds = 0.403 V.
Definition: drv8301.h:338
DRV8301_OcOffTimeMode_e
DRV8301_OcOffTimeMode_e
Enumeration for the Over Current Off Time modes.
Definition: drv8301.h:241
DRV8301_VdsLevel_0p086_V
Vds = 0.086 V.
Definition: drv8301.h:325
DRV8301_FaultType_FETHB_OC
FET High side, Phase B Over Current fault.
Definition: drv8301.h:217
DRV8301_DcCalMode_Ch1_NoLoad
Shunt amplifier 1 disconnected from load and input pins are shorted.
Definition: drv8301.h:203
DRV8301_ShuntAmpGain_40VpV
40 V per V
Definition: drv8301.h:304
DRV8301_VdsLevel_0p648_V
Vds = 0.648 V.
Definition: drv8301.h:342
DRV8301_RegName_e
DRV8301_RegName_e
Enumeration for the register names.
Definition: drv8301.h:279
DRV8301_Obj
struct _DRV8301_Obj_ DRV8301_Obj
Defines the DRV8301 object.
DRV8301_PwmMode_Three_Inputs
three independent nputs
Definition: drv8301.h:273
_DRV_SPI_8301_Vars_t_::SndCmd
bool SndCmd
Definition: drv8301.h:411
DRV8301_FaultType_OTSD
Over Temperature Shut Down fault.
Definition: drv8301.h:221
DRV8301_getPwmMode
DRV8301_PwmMode_e DRV8301_getPwmMode(DRV8301_Handle handle)
Gets the PWM mode.
Definition: drv8301.c:234
DRV8301_OcMode_Disabled
OC protection disabled.
Definition: drv8301.h:235
spi.h
Contains public interface to various functions related to the serial peripheral interface (SPI) objec...
DRV_SPI_8301_Vars_t
struct _DRV_SPI_8301_Vars_t_ DRV_SPI_8301_Vars_t
DRV8301_GETID
Definition: drv8301.h:359
DRV8301_enable
void DRV8301_enable(DRV8301_Handle handle)
Enables the DRV8301.
Definition: drv8301.c:66
_DRV_SPI_8301_Stat1_t_::OTW
bool OTW
Definition: drv8301.h:369
DRV8301_FaultType_FETLA_OC
FET Low side, Phase A Over Current fault.
Definition: drv8301.h:218
_DRV_SPI_8301_Vars_t_::Ctrl_Reg_2
DRV_SPI_8301_CTRL2_t_ Ctrl_Reg_2
Definition: drv8301.h:410
DRV8301_readSpi
uint16_t DRV8301_readSpi(DRV8301_Handle handle, const DRV8301_RegName_e regName)
Reads data from the DRV8301 register.
Definition: drv8301.c:353
DRV8301_OcMode_LatchShutDown
latch shut down when OC detected
Definition: drv8301.h:233
DRV8301_VdsLevel_0p155_V
Vds = 0.155 V.
Definition: drv8301.h:330
DRV8301_reset
void DRV8301_reset(DRV8301_Handle handle)
Resets the DRV8301.
Definition: drv8301.c:395
DRV8301_RegName_Control_2
Control Register 2.
Definition: drv8301.h:284
DRV8301_VdsLevel_0p317_V
Vds = 0.317 V.
Definition: drv8301.h:336
_GPIO_Obj_
Defines the General Purpose I/O (GPIO) object.
Definition: gpio.h:423
_DRV8301_Obj_::gpioHandle
GPIO_Handle gpioHandle
the gpio handle that is connected to the drv8301 enable pin
Definition: drv8301.h:421
DRV8301_OcMode_CurrentLimit
current limit when OC detected
Definition: drv8301.h:232
DRV8301_VdsLevel_0p068_V
Vds = 0.068 V.
Definition: drv8301.h:323
DRV8301_FaultType_OTW
Over Temperature Warning fault.
Definition: drv8301.h:220
DRV8301_VdsLevel_0p138_V
Vds = 0.138 V.
Definition: drv8301.h:329
_DRV_SPI_8301_Stat1_t_::FETLB_OC
bool FETLB_OC
Definition: drv8301.h:373
_DRV_SPI_8301_Stat1_t_
Definition: drv8301.h:363
DRV8301_OcOffTimeMode_Ctrl
off time control during OC
Definition: drv8301.h:244
DRV8301_VdsLevel_0p282_V
Vds = 0.282 V.
Definition: drv8301.h:335
DRV8301_VdsLevel_2p400_V
Vds = 2.400 V.
Definition: drv8301.h:353
DRV8301_getDcCalMode
DRV8301_DcCalMode_e DRV8301_getDcCalMode(DRV8301_Handle handle, const DRV8301_ShuntAmpNumber_e ampNumber)
Gets the DC calibration mode.
Definition: drv8301.c:93
DRV8301_PeakCurrent_0p25_A
drv8301 driver peak current 0.25A
Definition: drv8301.h:264
_DRV_SPI_8301_Stat1_t_::FETLC_OC
bool FETLC_OC
Definition: drv8301.h:375
DRV8301_getStatusRegister2
uint16_t DRV8301_getStatusRegister2(DRV8301_Handle handle)
Gets the status register 2 value.
DRV8301_ShuntAmpGain_e
DRV8301_ShuntAmpGain_e
Enumeration for the shunt amplifier gains.
Definition: drv8301.h:300
DRV8301_VdsLevel_0p454_V
Vds = 0.454 V.
Definition: drv8301.h:339
_DRV_SPI_8301_Stat1_t_::PVDD_UV
bool PVDD_UV
Definition: drv8301.h:367
DRV8301_getOcLevel
DRV8301_VdsLevel_e DRV8301_getOcLevel(DRV8301_Handle handle)
Gets the over current level.
Definition: drv8301.c:160
_DRV_SPI_8301_Vars_t_::Stat_Reg_2
DRV_SPI_8301_Stat2_t_ Stat_Reg_2
Definition: drv8301.h:408
_DRV_SPI_8301_CTRL1_t_::DRV8301_CURRENT
DRV8301_PeakCurrent_e DRV8301_CURRENT
Definition: drv8301.h:388
DRV8301_FaultType_FETHA_OC
FET High side, Phase A Over Current fault.
Definition: drv8301.h:219
DRV8301_OcMode_ReportOnly
report only when OC detected
Definition: drv8301.h:234
_DRV_SPI_8301_Stat1_t_::GVDD_UV
bool GVDD_UV
Definition: drv8301.h:366
DRV8301_setGpioHandle
void DRV8301_setGpioHandle(DRV8301_Handle handle, GPIO_Handle gpioHandle)
Sets the GPIO handle in the DRV8301.
Definition: drv8301.c:284
_DRV_SPI_8301_Stat1_t_::FETHA_OC
bool FETHA_OC
Definition: drv8301.h:370
DRV8301_setupSpi
void DRV8301_setupSpi(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
Initialize the interface to all 8301 SPI variables.
Definition: drv8301.c:695
DRV8301_ShuntAmpGain_80VpV
80 V per V
Definition: drv8301.h:305
DRV8301_FaultType_FETLC_OC
FET Low side, Phase C Over Current fault.
Definition: drv8301.h:214
DRV8301_Reset_Normal
normal
Definition: drv8301.h:293
_DRV_SPI_8301_Stat2_t_::DeviceID
uint16_t DeviceID
Definition: drv8301.h:382
DRV8301_CtrlMode_Read
Read Mode.
Definition: drv8301.h:193
DRV8301_getOcMode
DRV8301_OcMode_e DRV8301_getOcMode(DRV8301_Handle handle)
Gets the over current mode.
Definition: drv8301.c:174
_DRV8301_Obj_::spiHandle
SPI_Handle spiHandle
the handle for the serial peripheral interface
Definition: drv8301.h:420
DRV8301_setOcOffTimeMode
void DRV8301_setOcOffTimeMode(DRV8301_Handle handle, const DRV8301_OcOffTimeMode_e mode)
Sets the over current off time mode.
Definition: drv8301.c:484
DRV8301_RegName_Status_2
Status Register 2.
Definition: drv8301.h:282
_DRV8301_Obj_::gpioNumber
GPIO_Number_e gpioNumber
the gpio number that is connected to the drv8301 enable pin
Definition: drv8301.h:422
DRV8301_VdsLevel_2p131_V
Vds = 2.131 V.
Definition: drv8301.h:352
DRV8301_VdsLevel_0p576_V
Vds = 0.576 V.
Definition: drv8301.h:341
DRV8301_PeakCurrent_1p70_A
drv8301 driver peak current 1.70A
Definition: drv8301.h:262
DRV8301_ShuntAmpGain_10VpV
10 V per V
Definition: drv8301.h:302
DRV8301_VdsLevel_e
DRV8301_VdsLevel_e
Enumeration for the Vds level for th over current adjustment.
Definition: drv8301.h:320
DRV8301_PeakCurrent_0p70_A
drv8301 driver peak current 0.70A
Definition: drv8301.h:263
DRV8301_ShuntAmpGain_20VpV
20 V per V
Definition: drv8301.h:303
DRV8301_FaultType_GVDD_OV
DRV8301 Vdd Over Voltage fault.
Definition: drv8301.h:224
DRV8301_VdsLevel_0p822_V
Vds = 0.822 V.
Definition: drv8301.h:344
_DRV_SPI_8301_Vars_t_
Definition: drv8301.h:405
_DRV_SPI_8301_Stat2_t_
Definition: drv8301.h:379
DRV8301_RegName_Status_1
Status Register 1.
Definition: drv8301.h:281
DRV8301_PeakCurrent_e
DRV8301_PeakCurrent_e
Enumeration for the drv8301 peak current levels.
Definition: drv8301.h:260
DRV8301_setOcTwMode
void DRV8301_setOcTwMode(DRV8301_Handle handle, const DRV8301_OcTwMode_e mode)
Sets the over current, temperature warning mode.
Definition: drv8301.c:505
DRV8301_writeData
void DRV8301_writeData(DRV8301_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
Interface to all 8301 SPI variables.
Definition: drv8301.c:610
DRV8301_VdsLevel_0p060_V
Vds = 0.060 V.
Definition: drv8301.h:322
_DRV_SPI_8301_CTRL2_t_::OCTW_SET
DRV8301_OcTwMode_e OCTW_SET
Definition: drv8301.h:398
DRV8301_getStatusRegister1
uint16_t DRV8301_getStatusRegister1(DRV8301_Handle handle)
Gets the status register 1 value.
DRV8301_VdsLevel_0p222_V
Vds = 0.222 V.
Definition: drv8301.h:333
DRV_SPI_8301_CTRL1_t_
struct _DRV_SPI_8301_CTRL1_t_ DRV_SPI_8301_CTRL1_t_
DRV8301_CtrlMode_Write
Write Mode.
Definition: drv8301.h:194
DRV8301_VdsLevel_1p491_V
Vds = 1.491 V.
Definition: drv8301.h:349
DRV8301_setOcLevel
void DRV8301_setOcLevel(DRV8301_Handle handle, const DRV8301_VdsLevel_e VdsLevel)
Sets the over current level in terms of Vds.
Definition: drv8301.c:442
DRV_SPI_8301_CTRL2_t_
struct _DRV_SPI_8301_CTRL2_t_ DRV_SPI_8301_CTRL2_t_
DRV8301_Handle
struct _DRV8301_Obj_ * DRV8301_Handle
Defines the DRV8301 handle.
Definition: drv8301.h:430
_DRV_SPI_8301_Vars_t_::RcvCmd
bool RcvCmd
Definition: drv8301.h:412
_DRV_SPI_8301_Stat1_t_::OTSD
bool OTSD
Definition: drv8301.h:368
DRV8301_VdsLevel_1p175_V
Vds = 1.175 V.
Definition: drv8301.h:347
_DRV_SPI_8301_Stat1_t_::FETLA_OC
bool FETLA_OC
Definition: drv8301.h:371
DRV8301_resetRxTimeout
static void DRV8301_resetRxTimeout(DRV8301_Handle handle)
Resets the RX fifo timeout flag.
Definition: drv8301.h:585
DRV8301_VdsLevel_0p123_V
Vds = 0.123 V.
Definition: drv8301.h:328
DRV8301_DcCalMode_Ch2_Load
Shunt amplifier 2 connected to load via input pins.
Definition: drv8301.h:204
DRV8301_PwmMode_Six_Inputs
six independent inputs
Definition: drv8301.h:272
DRV8301_setShuntAmpGain
void DRV8301_setShuntAmpGain(DRV8301_Handle handle, const DRV8301_ShuntAmpGain_e gain)
Sets the shunt amplifier gain value.
Definition: drv8301.c:568
_DRV_SPI_8301_Vars_t_::Stat_Reg_1
DRV_SPI_8301_Stat1_t_ Stat_Reg_1
Definition: drv8301.h:407
_DRV_SPI_8301_CTRL1_t_::DRV8301_RESET
DRV8301_Reset_e DRV8301_RESET
Definition: drv8301.h:389
DRV8301_VdsLevel_1p324_V
Vds = 1.324 V.
Definition: drv8301.h:348
DRV8301_FaultType_PVDD_UV
Power supply Vdd Under Voltage fault.
Definition: drv8301.h:222
DRV8301_FaultType_e
DRV8301_FaultType_e
Enumeration for the fault types.
Definition: drv8301.h:211
DRV8301_isReset
bool DRV8301_isReset(DRV8301_Handle handle)
Determines if DRV8301 is in reset.
Definition: drv8301.c:335
DRV8301_isFault
bool DRV8301_isFault(DRV8301_Handle handle)
Determines if DRV8301 fault has occurred.
Definition: drv8301.c:317
_DRV8301_Obj_::RxTimeOut
bool RxTimeOut
the timeout flag for the RX fifo
Definition: drv8301.h:423
DRV_SPI_8301_Stat2_t_
struct _DRV_SPI_8301_Stat2_t_ DRV_SPI_8301_Stat2_t_
DRV8301_DATA_MASK
#define DRV8301_DATA_MASK
Defines the data mask.
Definition: drv8301.h:77
_DRV_SPI_8301_CTRL2_t_
Definition: drv8301.h:396
DRV8301_CtrlMode_e
DRV8301_CtrlMode_e
Enumeration for the R/W modes.
Definition: drv8301.h:191
GPIO_Number_e
GPIO_Number_e
Enumeration to define the general purpose I/O (GPIO) numbers.
Definition: gpio.h:361
DRV8301_getId
uint16_t DRV8301_getId(DRV8301_Handle handle)
Gets the device ID.
Definition: drv8301.c:145
DRV8301_getOcOffTimeMode
DRV8301_OcOffTimeMode_e DRV8301_getOcOffTimeMode(DRV8301_Handle handle)
Gets the over current off time mode.
Definition: drv8301.c:189
DRV8301_VdsLevel_0p109_V
Vds = 0.109 V.
Definition: drv8301.h:327
DRV8301_RegName_Control_1
Control Register 1.
Definition: drv8301.h:283
DRV8301_OcMode_e
DRV8301_OcMode_e
Enumeration for the Over Current modes.
Definition: drv8301.h:230
Drv8301SpiOutputDataSelect_e
Drv8301SpiOutputDataSelect_e
Definition: drv8301.h:357
DRV8301_VdsLevel_0p730_V
Vds = 0.730 V.
Definition: drv8301.h:343