2013-07-10 08:17 AM
I'm not sure how to remap pins that do not line up correctly with the alternate functions specified in the datasheet. For example, the picture below shows the pin out of my microcontroller where OCx-LOW are pwm out and ICx are pwm in. Comparing it to the datasheet's alternate function listing, only some pins line up to timer channels. For example, OC1-LOW and OC2-LOW pin's alternate functions match up to timer 9 channel 2 and 1, but OC3-LOW and OC4-LOW don't match up to any timers on their alternate functions so I'm not sure how to use these pins with the timers for pwm out/in.
When they match, you can do something like the following, but not sure what to do when they don't line up.GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOI, &GPIO_InitStructure);
/* Connect pins to TIM8 AF2 */
GPIO_PinAFConfig(GPIOI, GPIO_PinSource2, GPIO_AF_TIM8);
Sorry if it's a simple solution, I've never programmed any microcontroller before.
2016-07-18 01:21 AM
Hi Clive,
It is Eugenia again from the post STM32f207 PWM output. I was refering to this post of yours which I followed to get a software generated PWM.. But as soon as I try to configure the PWM output then I completely lose the PWM signal. I am using Timer 1