This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with stm32f4 pwm output -- TIM3

please find the line "TIM3_PWM_Init(500-1,84-1);" and build output compiling main.c...
main.c(23): warning: #223-D: function "TIM3_PWM_Init" declared implicitly TIM3_PWM_Init(500-1,84-1);
main.c: 1 warning, 0 errors

Output is not achieved. can someone help me how to solve this?

code below...

int main(void)
{ u16 led0pwmval=0; u8 dir=1;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); delay_init(168); uart_init(115200);

TIM3_PWM_Init(500-1,84-1); //This lines shows warning (output pwm is not achieved :(

while(1) { delay_ms(10);

if(dir) led0pwmval++;//dir==1 led0pwmvalµÝÔö else led0pwmval--; //dir==0 led0pwmvalµÝ¼õ

if(led0pwmval>300) dir=0;

if(led0pwmval==0) dir=1;

TIM_SetCompare1(TIM14,led0pwmval); }
}

BUILD OUTPUT

Rebuild target 'PWM'
compiling main.c...
main.c(23): warning: #223-D: function "TIM3_PWM_Init" declared implicitly TIM3_PWM_Init(500-1,84-1); //84M/84=1MhzµÄ¼ÆÊýƵÂÊ,ÖØ×°ÔØÖµ500£¬ËùÒÔPWMƵÂÊΪ 1M/500=2Khz.
main.c: 1 warning, 0 errors

compiling stm32f4xx_it.c...
compiling system_stm32f4xx.c...
compiling led.c...
compiling pwm.c...
compiling delay.c...
compiling sys.c...
compiling usart.c...
assembling startup_stm32f40_41xxx.s...
compiling misc.c...
compiling stm32f4xx_gpio.c...
compiling stm32f4xx_usart.c...
compiling stm32f4xx_tim.c...
compiling stm32f4xx_syscfg.c...
compiling stm32f4xx_rcc.c...
linking...
Program Size: Code=8596 RO-data=424 RW-data=48 ZI-data=1832
FromELF: creating hex file...
"..\OBJ\PWM.axf" - 0 Error(s), 1 Warning(s).
Load "..\\OBJ\\PWM.axf"
Set JLink Project File to "D:\Library 48 _ stm32f4_discovery\Test-work on\tim3_PA6 PWM output experiment\USER\JLinkSettings.ini"
* JLink Info: Device "STM32F407ZG" selected (1024 KB flash, 128 KB RAM).

JLink info:
------------
DLL: V4.80g, compiled Feb 13 2014 20:50:02
Firmware: J-Link ARM V8 compiled Nov 25 2013 19:20:08
Hardware: V8.00
S/N : 99991999
Feature(s) : RDI,FlashDL,FlashBP,JFlash,GDBFULL

* JLink Info: Found SWD-DP with ID 0x2BA01477
* JLink Info: Found SWD-DP with ID 0x2BA01477
* JLink Info: Found Cortex-M4 r0p1, Little endian.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: TPIU fitted.
* JLink Info: ETM fitted.
ROMTableAddr = 0xE00FF003

Target info:
------------
Device: STM32F407ZG
VTarget = 3.332V
State of Pins:
TCK: 0, TDI: 1, TDO: 1, TMS: 1, TRES: 1, TRST: 1
Hardware-Breakpoints: 6
Software-Breakpoints: 8192
Watchpoints: 4
JTAG speed: 1000 kHz

Erase Done.
Programming Done.
Verify OK.
Application running ...