Only getting 0 back :/

This commit is contained in:
Oskar Weigl
2016-06-03 23:18:46 +02:00
parent b6ba25c4e7
commit 5986280f77
4 changed files with 36 additions and 7 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ void DRV8301_enable(DRV8301_Handle handle)
HAL_GPIO_WritePin(handle->EngpioHandle, handle->EngpioNumber, GPIO_PIN_SET);
//Wait for driver to come online
osDelay(20);
osDelay(10);
// Make sure the Fault bit is not set during startup
while((DRV8301_readSpi(handle,DRV8301_RegName_Status_1) & DRV8301_STATUS1_FAULT_BITS) != 0);
+1 -1
View File
@@ -116,7 +116,7 @@ ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CFLAGS += -MD -MP -MF .dep/$(@F).d
CFLAGS += -std=c99 -MD -MP -MF .dep/$(@F).d
#######################################
# LDFLAGS
+33 -4
View File
@@ -20,8 +20,7 @@ static int test_base = 0;
static int test = 0;
static int test2 = 0;
void start_DRV8301() {
void start_pwm_triggering(){
//Init PWM
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
@@ -31,6 +30,9 @@ void start_DRV8301() {
//Turn off output
__HAL_TIM_MOE_DISABLE(&htim1);
}
void start_DRV8301() {
//Enable driver
HAL_GPIO_WritePin(EN_GATE_GPIO_Port, EN_GATE_Pin, GPIO_PIN_SET);
@@ -65,14 +67,41 @@ void test_adc_trigger() {
__HAL_ADC_ENABLE_IT(&hadc2, ADC_IT_JEOC);
}
void DRV8301_setup() {
DRV8301_Obj gate_drivers[] = {
{
//M0
.spiHandle = &hspi3,
//Note: this board has the EN_Gate pin shared!
.EngpioHandle = EN_GATE_GPIO_Port,
.EngpioNumber = EN_GATE_Pin,
.nCSgpioHandle = M0_nCS_GPIO_Port,
.nCSgpioNumber = M0_nCS_Pin,
.RxTimeOut = false,
.enableTimeOut = false
}
};
static const int num_motors = sizeof(gate_drivers)/sizeof(gate_drivers[0]);
void test_DRV8301_setup() {
//Local view of DRV registers
DRV_SPI_8301_Vars_t gate_driver_regs[num_motors];
//The DRV_8301 driver instance
//DRV8301_Obj gate_drivers[NUM_MOTORS];
for (int i = 0; i < num_motors; ++i) {
DRV8301_enable(&gate_drivers[i]);
DRV8301_setupSpi(&gate_drivers[i], &gate_driver_regs[i]);
osDelay(1);
}
}
void test_main(void) {
//start_DRV8301();
DRV8301_setup();
test_DRV8301_setup();
}
// Simple loop to read ADC1