Hi,
I am working with microbasic pro for ARM complier and trying to get PWM signal out from STM32F030K6. I used compiler's own PWM library and also tested with example PWM code. But did not work.
I tested with STM32F107VC and it is working. Then I tested STM32F030K6 with microC Pro for ARM compiler (example PWM code) it is working well. So I did not understand what is the problem with basic compiler. And also ADC library is not working with STM32F030K6 with basic compiler too. Configurations are same in both compiler.
**************************************************************************************
This code is working with STM32F030K6 (microC). GPIO.B7 toggling and PWM out working
void main() {
GPIO_Digital_Output(&GPIOB_BASE, _GPIO_PINMASK_7);
pwm_period = PWM_TIM3_Init(15000);
PWM_TIM3_Set_Duty(pwm_period/2, _PWM_NON_INVERTED, _PWM_CHANNEL4); // Set current duty for PWM_TIM1
PWM_TIM3_Start(_PWM_CHANNEL4, &_GPIO_MODULE_TIM3_CH4_PB1);
while (1) { // endless loop
GPIOB_ODR.B7 =~ GPIOB_ODR.B7;
}
}
***********************************************************************************
This code is not working with STM32F030K6 (microBasic). GPIO.B7 toggling but PWM out NOTworking
dim pwm_period as word
main:
' Main program
GPIO_Digital_Output(@GPIOB_BASE, _GPIO_PINMASK_7)
pwm_period = PWM_TIM3_Init(15000)
PWM_TIM3_Set_Duty(pwm_period/2, _PWM_NON_INVERTED, _PWM_CHANNEL4)
PWM_TIM3_Start(_PWM_CHANNEL4,@_GPIO_MODULE_TIM3_CH4_PB1)
while true
GPIOB_ODR.B7 = not GPIOB_ODR.B7
wend
end.
PWM issue with STM32F030K6 and C8
- dusan.poluga
- mikroElektronika team
- Posts: 780
- Joined: 02 Feb 2017 14:21
Re: PWM issue with STM32F030K6 and C8
Hi,
I have your ticket regarding this issue.
We will continue our conversation on the ticket.
Best Regards,
I have your ticket regarding this issue.
We will continue our conversation on the ticket.
Best Regards,
Dusan Poluga.
Re: PWM issue with STM32F030K6 and C8
Hi,
I tested PWM library with STM32F070CB MCU and it is working with it. But now has ADC library issue. MCU is locking when read ADC channel. This issue also happen with STM030 series MCUs.
Again, everythings is good with microC compiler.
Sir, I need solution urgently please..
**************************************************************
program ADC_Demo
dim adc_result as longword
main:
GPIO_Digital_Output(@GPIOD_ODR, _GPIO_PINMASK_ALL) ' Set PORTD as output
ADC_Set_Input_Channel(_ADC_CHANNEL_3) ' Choose ADC channel
ADC1_Init()
PWM_TIM1_Init(15000)
PWM_TIM1_Start(_PWM_CHANNEL3, @_GPIO_MODULE_TIM1_CH3_PA10)
adc_result = 100
PWM_TIM1_Set_Duty(adc_result, _PWM_NON_INVERTED, _PWM_CHANNEL3)
Delay_ms(1000)
while TRUE
adc_result = ADC1_Get_Sample(3) '<<<<<<<<<<< MCU is locking here >>>>>>>>>>>>
Delay_ms(20)
PWM_TIM1_Set_Duty(adc_result, _PWM_NON_INVERTED, _PWM_CHANNEL3)
wend
end.
I tested PWM library with STM32F070CB MCU and it is working with it. But now has ADC library issue. MCU is locking when read ADC channel. This issue also happen with STM030 series MCUs.
Again, everythings is good with microC compiler.
Sir, I need solution urgently please..
**************************************************************
program ADC_Demo
dim adc_result as longword
main:
GPIO_Digital_Output(@GPIOD_ODR, _GPIO_PINMASK_ALL) ' Set PORTD as output
ADC_Set_Input_Channel(_ADC_CHANNEL_3) ' Choose ADC channel
ADC1_Init()
PWM_TIM1_Init(15000)
PWM_TIM1_Start(_PWM_CHANNEL3, @_GPIO_MODULE_TIM1_CH3_PA10)
adc_result = 100
PWM_TIM1_Set_Duty(adc_result, _PWM_NON_INVERTED, _PWM_CHANNEL3)
Delay_ms(1000)
while TRUE
adc_result = ADC1_Get_Sample(3) '<<<<<<<<<<< MCU is locking here >>>>>>>>>>>>
Delay_ms(20)
PWM_TIM1_Set_Duty(adc_result, _PWM_NON_INVERTED, _PWM_CHANNEL3)
wend
end.
- dusan.poluga
- mikroElektronika team
- Posts: 780
- Joined: 02 Feb 2017 14:21
Re: PWM issue with STM32F030K6 and C8
Hi,
Please continue this conversation on the ticket.
Best Regards,
Please continue this conversation on the ticket.
Best Regards,
Dusan Poluga.