Add Aggregate PWM on Pin29 (PB10/TIM2CH3) (needs bodgewire to R175)
This commit is contained in:
parent
9aca436798
commit
36e57e5671
|
@ -44,12 +44,13 @@ void ChannelControl_UpdatePWMs(
|
|||
uint8_t radiatorfans,
|
||||
uint8_t pwmpumps,
|
||||
uint8_t tsacfans,
|
||||
uint8_t pwmaggregat // TODO: Emulate PWN via PCA9535D!
|
||||
){
|
||||
uint8_t pwmaggregat)
|
||||
{
|
||||
|
||||
pwmtimer3->Instance->CCR1 = radiatorfans << 8;
|
||||
pwmtimer3->Instance->CCR4 = pwmpumps << 8;
|
||||
pwmtimer2->Instance->CCR2 = tsacfans << 8;
|
||||
pwmtimer2->Instance->CCR3 = pwmaggregat << 8;
|
||||
|
||||
if (timer3_running) {
|
||||
if ((pwmpumps == 0) && (radiatorfans == 0)) {
|
||||
|
@ -62,18 +63,20 @@ void ChannelControl_UpdatePWMs(
|
|||
timer3_running = 1;
|
||||
HAL_TIM_PWM_Start(pwmtimer3, TIM_CHANNEL_4);
|
||||
HAL_TIM_PWM_Start(pwmtimer3, TIM_CHANNEL_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timer2_running) {
|
||||
if (tsacfans == 0) {
|
||||
if ( (tsacfans == 0) || (pwmaggregat == 0) ) {
|
||||
timer2_running = 0;
|
||||
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_2);
|
||||
HAL_TIM_PWM_Stop(pwmtimer2, TIM_CHANNEL_3);
|
||||
}
|
||||
} else {
|
||||
if (tsacfans != 0) {
|
||||
if ( (tsacfans != 0) || (pwmaggregat != 0) ) {
|
||||
timer2_running = 1;
|
||||
HAL_TIM_PWM_Start(pwmtimer2, TIM_CHANNEL_2);
|
||||
HAL_TIM_PWM_Start(pwmtimer2, TIM_CHANNEL_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -472,6 +472,10 @@ static void MX_TIM2_Init(void)
|
|||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_3) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM2_Init 2 */
|
||||
|
||||
/* USER CODE END TIM2_Init 2 */
|
||||
|
|
|
@ -494,9 +494,10 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
|||
/* USER CODE END TIM2_MspPostInit 0 */
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**TIM2 GPIO Configuration
|
||||
PB10 ------> TIM2_CH3
|
||||
PB3 ------> TIM2_CH2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_3;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_3;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#MicroXplorer Configuration settings - do not modify
|
||||
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_1
|
||||
ADC1.DMAContinuousRequests=ENABLE
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DMAContinuousRequests
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,OffsetNumber-0\#ChannelRegularConversion,Offset-0\#ChannelRegularConversion,NbrOfConversionFlag,master,DMAContinuousRequests,NbrOfConversion
|
||||
ADC1.NbrOfConversion=1
|
||||
ADC1.NbrOfConversionFlag=1
|
||||
ADC1.Offset-0\#ChannelRegularConversion=0
|
||||
ADC1.OffsetNumber-0\#ChannelRegularConversion=ADC_OFFSET_NONE
|
||||
|
@ -82,36 +83,37 @@ Mcu.Pin13=PA7
|
|||
Mcu.Pin14=PC4
|
||||
Mcu.Pin15=PB0
|
||||
Mcu.Pin16=PB1
|
||||
Mcu.Pin17=PB12
|
||||
Mcu.Pin18=PB13
|
||||
Mcu.Pin19=PB14
|
||||
Mcu.Pin17=PB10
|
||||
Mcu.Pin18=PB12
|
||||
Mcu.Pin19=PB13
|
||||
Mcu.Pin2=PC0
|
||||
Mcu.Pin20=PB15
|
||||
Mcu.Pin21=PC6
|
||||
Mcu.Pin22=PC7
|
||||
Mcu.Pin23=PC8
|
||||
Mcu.Pin24=PC9
|
||||
Mcu.Pin25=PA9
|
||||
Mcu.Pin26=PA10
|
||||
Mcu.Pin27=PA11
|
||||
Mcu.Pin28=PA12
|
||||
Mcu.Pin29=PA13
|
||||
Mcu.Pin20=PB14
|
||||
Mcu.Pin21=PB15
|
||||
Mcu.Pin22=PC6
|
||||
Mcu.Pin23=PC7
|
||||
Mcu.Pin24=PC8
|
||||
Mcu.Pin25=PC9
|
||||
Mcu.Pin26=PA9
|
||||
Mcu.Pin27=PA10
|
||||
Mcu.Pin28=PA11
|
||||
Mcu.Pin29=PA12
|
||||
Mcu.Pin3=PC1
|
||||
Mcu.Pin30=PA14
|
||||
Mcu.Pin31=PA15
|
||||
Mcu.Pin32=PB3
|
||||
Mcu.Pin33=PB4
|
||||
Mcu.Pin34=PB7
|
||||
Mcu.Pin35=PB9
|
||||
Mcu.Pin36=VP_SYS_VS_Systick
|
||||
Mcu.Pin37=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin30=PA13
|
||||
Mcu.Pin31=PA14
|
||||
Mcu.Pin32=PA15
|
||||
Mcu.Pin33=PB3
|
||||
Mcu.Pin34=PB4
|
||||
Mcu.Pin35=PB7
|
||||
Mcu.Pin36=PB9
|
||||
Mcu.Pin37=VP_SYS_VS_Systick
|
||||
Mcu.Pin38=VP_TIM6_VS_ClockSourceINT
|
||||
Mcu.Pin4=PC2
|
||||
Mcu.Pin5=PC3
|
||||
Mcu.Pin6=PA0
|
||||
Mcu.Pin7=PA1
|
||||
Mcu.Pin8=PA2
|
||||
Mcu.Pin9=PA3
|
||||
Mcu.PinsNb=38
|
||||
Mcu.PinsNb=39
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F302RBTx
|
||||
|
@ -206,6 +208,8 @@ PB0.Locked=true
|
|||
PB0.Signal=GPIO_Output
|
||||
PB1.Locked=true
|
||||
PB1.Signal=S_TIM3_CH4
|
||||
PB10.Locked=true
|
||||
PB10.Signal=S_TIM2_CH3
|
||||
PB12.GPIOParameters=GPIO_Label
|
||||
PB12.GPIO_Label=DSEL 3
|
||||
PB12.Locked=true
|
||||
|
@ -354,12 +358,15 @@ SH.ADCx_IN9.0=ADC1_IN9,IN9-Single-Ended
|
|||
SH.ADCx_IN9.ConfNb=1
|
||||
SH.S_TIM2_CH2.0=TIM2_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM2_CH2.ConfNb=1
|
||||
SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3
|
||||
SH.S_TIM2_CH3.ConfNb=1
|
||||
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
||||
SH.S_TIM3_CH1.ConfNb=1
|
||||
SH.S_TIM3_CH4.0=TIM3_CH4,PWM Generation4 CH4
|
||||
SH.S_TIM3_CH4.ConfNb=1
|
||||
TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM2.IPParameters=Channel-PWM Generation2 CH2,Pulse-PWM Generation2 CH2,Period
|
||||
TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||
TIM2.IPParameters=Channel-PWM Generation2 CH2,Pulse-PWM Generation2 CH2,Period,Channel-PWM Generation3 CH3
|
||||
TIM2.Period=65535
|
||||
TIM2.Pulse-PWM\ Generation2\ CH2=0
|
||||
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||
|
|
|
@ -85,7 +85,7 @@ PREFIX = arm-none-eabi-
|
|||
POSTFIX = "
|
||||
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
|
||||
# either it can be added to the PATH environment variable.
|
||||
GCC_PATH="c:/Users/GETAC/AppData/Roaming/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/13.2.1-1.1.1/.content/bin
|
||||
GCC_PATH="c:/Users/nived/AppData/Roaming/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/12.3.1-1.2.1/.content/bin
|
||||
ifdef GCC_PATH
|
||||
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
|
||||
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
|
||||
|
@ -238,13 +238,13 @@ $(BUILD_DIR):
|
|||
# flash
|
||||
#######################################
|
||||
flash: $(BUILD_DIR)/$(TARGET).elf
|
||||
"C:/USERS/GETAC/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-3.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
|
||||
"C:/USERS/NIVED/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-2.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
|
||||
|
||||
#######################################
|
||||
# erase
|
||||
#######################################
|
||||
erase: $(BUILD_DIR)/$(TARGET).elf
|
||||
"C:/USERS/GETAC/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-3.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
|
||||
"C:/USERS/NIVED/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.12.0-2.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
|
||||
|
||||
#######################################
|
||||
# clean up
|
||||
|
|
Loading…
Reference in New Issue