mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-22 08:04:07 +08:00
Import TI drivers for drv8301
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@ C_SOURCES = \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
|
||||
Drivers/DRV8301/drv8301.c \
|
||||
Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
|
||||
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
|
||||
Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
|
||||
@@ -102,6 +103,7 @@ C_INCLUDES += -IDrivers/CMSIS/Device/ST/STM32F4xx/Include
|
||||
C_INCLUDES += -IDrivers/CMSIS/Include
|
||||
C_INCLUDES += -IDrivers/STM32F4xx_HAL_Driver/Inc
|
||||
C_INCLUDES += -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy
|
||||
C_INCLUDES += -IDrivers/DRV8301
|
||||
C_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
|
||||
C_INCLUDES += -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc
|
||||
C_INCLUDES += -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS
|
||||
|
||||
+34
-1
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "adc.h"
|
||||
#include "tim.h"
|
||||
#include "spi.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
@@ -19,8 +20,35 @@ static int test_base = 0;
|
||||
static int test = 0;
|
||||
static int test2 = 0;
|
||||
|
||||
void test_main(void) {
|
||||
void start_DRV8301() {
|
||||
|
||||
//Init PWM
|
||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
|
||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
|
||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
|
||||
HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_4);
|
||||
|
||||
//Turn off output
|
||||
__HAL_TIM_MOE_DISABLE(&htim1);
|
||||
|
||||
//Enable driver
|
||||
HAL_GPIO_WritePin(EN_GATE_GPIO_Port, EN_GATE_Pin, GPIO_PIN_SET);
|
||||
|
||||
//Wait for startup
|
||||
osDelay(10);
|
||||
|
||||
//Do SPI comms
|
||||
HAL_GPIO_WritePin(M0_nCS_GPIO_Port, M0_nCS_Pin, GPIO_PIN_RESET);
|
||||
osDelay(1);
|
||||
|
||||
|
||||
|
||||
osDelay(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void test_adc_trigger() {
|
||||
//Set trigger to mid phase to check for trigger polarity
|
||||
htim1.Instance->CCR4 = 2048;
|
||||
|
||||
@@ -30,6 +58,11 @@ void test_main(void) {
|
||||
//Warp field stabilize.
|
||||
osDelay(2);
|
||||
__HAL_ADC_ENABLE_IT(&hadc2, ADC_IT_JEOC);
|
||||
}
|
||||
|
||||
void test_main(void) {
|
||||
|
||||
start_DRV8301();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user