PWM issue with STM32F030K6 and C8

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
devrim
Posts: 17
Joined: 17 Oct 2014 12:14

PWM issue with STM32F030K6 and C8

#1 Post by devrim » 31 Jul 2017 12:12

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.

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: PWM issue with STM32F030K6 and C8

#2 Post by dusan.poluga » 03 Aug 2017 10:22

Hi,

I have your ticket regarding this issue.
We will continue our conversation on the ticket.

Best Regards,
Dusan Poluga.

devrim
Posts: 17
Joined: 17 Oct 2014 12:14

Re: PWM issue with STM32F030K6 and C8

#3 Post by devrim » 03 Aug 2017 10:40

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.

User avatar
dusan.poluga
mikroElektronika team
Posts: 780
Joined: 02 Feb 2017 14:21

Re: PWM issue with STM32F030K6 and C8

#4 Post by dusan.poluga » 07 Aug 2017 19:07

Hi,

Please continue this conversation on the ticket.

Best Regards,
Dusan Poluga.

Post Reply

Return to “Website & Forums General Discussion”