Commit 2d60720f authored by Jacob Odgaard Hausted's avatar Jacob Odgaard Hausted
Browse files

Fixed PWM frequency. Was set to 200 Hz, much lower than the bandwidth of the...

Fixed PWM frequency. Was set to 200 Hz, much lower than the bandwidth of the motors, and as such, should be seen as voltage pulses and not an average voltage across the motors.

Changed the frequency to 20k matching the max PWM frequency of the VNH5019 motor driver.
parent f6f643b8
......@@ -199,7 +199,7 @@ void StartDefaultTask(void *argument)
// Create a timer for the publisher
rclc_timer_init_default(&rear_wheel_state_timer,
&support,
RCL_MS_TO_NS(1000),
RCL_MS_TO_NS(10),
&EncoderDataPublish_cb);
// Create subscriber
......@@ -295,8 +295,7 @@ void StartMotorControl(void *argument)
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);
osDelay(10);
osDelay(5);
}
osThreadTerminate(NULL);
......
......@@ -88,7 +88,7 @@ void MX_TIM3_Init(void)
/* USER CODE END TIM3_Init 1 */
htim3.Instance = TIM3;
htim3.Init.Prescaler = 100 - 1;
htim3.Init.Prescaler = 1 - 1;
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
htim3.Init.Period = 0x0FFF;
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
......@@ -132,7 +132,7 @@ void MX_TIM4_Init(void)
/* USER CODE END TIM4_Init 1 */
htim4.Instance = TIM4;
htim4.Init.Prescaler = 100 - 1;
htim4.Init.Prescaler = 1 - 1;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 0x0FFF;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
......
......@@ -87,7 +87,7 @@ PC14-OSC32_IN.Mode=LSE-External-Oscillator
RCC.VCOInputFreq_Value=1000000
PA14.Mode=Serial_Wire
Dma.USART2_TX.1.Instance=DMA1_Stream6
TIM3.Prescaler=100 - 1
TIM3.Prescaler=1 - 1
File.Version=6
Dma.USART2_RX.0.Instance=DMA1_Stream5
PH1-OSC_OUT.Locked=true
......@@ -181,7 +181,7 @@ PB5.Locked=true
RCC.VCOInputMFreq_Value=1000000
ProjectManager.RegisterCallBack=
RCC.USBFreq_Value=168000000
TIM4.Prescaler=100 - 1
TIM4.Prescaler=1 - 1
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
PA1.Signal=S_TIM5_CH2
PB1.Locked=true
......@@ -280,4 +280,4 @@ SH.S_TIM5_CH1.ConfNb=1
PA3.GPIO_Label=USART_RX
TIM3.OCMode_PWM-PWM\ Generation2\ CH2=TIM_OCMODE_PWM1
PA6.Locked=true
isbadioc=true
isbadioc=false
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment