No timer output on pin in F4 core
Posted: Fri May 08, 2020 6:07 pm
In the libmaple F4 core for stm32f40x and maybe 4xx
i've this code, this is supposed to put a 1khz square waves on PA1. it works on stm32f103 but it seemed it didn't work in F4 core.
i did not get an output on PA1
i'm still debugging the problem and hope to find the 'bug' or 'feature' soon 
i've this code, this is supposed to put a 1khz square waves on PA1. it works on stm32f103 but it seemed it didn't work in F4 core.
i did not get an output on PA1
Code: Select all
Timer2.pause();
Timer2.setPrescaleFactor(1); //36mhz
timer_oc_set_mode(TIMER2,TIMER_CH2,TIMER_OC_MODE_PWM_1,0);
timer_cc_enable(TIMER2, TIMER_CH2);
Timer2.setPeriod(1000); // 1khz
Timer2.setCompare(TIMER_CH2,Timer2.getOverflow()/2);
//Timer 2 Channel 2 timer output is on PA1
//setup pin PA1 for alt function output
gpio_set_mode(PA1, GPIO_AF_OUTPUT_PP);
//Timer2.attachCompare2Interrupt(timer2handle);
// start the timer
Timer2.refresh();
TIMER2->regs.gen->SR = 0; //clear interrupt flags, not really needed but an update event seem to set some flags
Timer2.resume();
