cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L452RE-P ALTERNATIVE FUNCTIONS Timer Direct Mode - Gpio Output

MBertocchi
Associate II

Hi, I am experimenting with the Nucleo-L452RE-P the ALTERNATIVE FUNCTIONS of the PA6 pin, what I need is that the pin acquires a rising edge through the Timer Direct Mode generating INTERRUPT, this works correctly

void HAL_TIM_IC_CaptureCallback (TIM_HandleTypeDef * htim)

{

if (htim-> Channel == HAL_TIM_ACTIVE_CHANNEL_1)

{

     }

}

subsequently it must become a GPIO Output keeping the output low and I do this correctly by configuring the pin in this way:

static GPIO_InitTypeDef GPIO_InitStructA = {0,0,0,0,0};

GPIO_InitStructA.Pin = GPIO_PIN_6;

GPIO_InitStructA.Mode = GPIO_MODE_OUTPUT_OD; // Open drain

GPIO_InitStructA.Pull = GPIO_NOPULL;

GPIO_InitStructA.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init (GPIOA, & GPIO_InitStructA);

   HAL_GPIO_WritePin (GPIOA, GPIO_PIN_6, GPIO_PIN_RESET);

Now I just have to find a way to reset the GPIO PA6 as a Timer Direct Mode to wait for a new rising edge, what can I do?

1 ACCEPTED SOLUTION

Accepted Solutions
MBertocchi
Associate II

I solved my problem I did not set the ALTERNATIVE PROPERTY

GPIO_InitStructA.Pin = GPIO_PIN_6;

GPIO_InitStructA.Mode = GPIO_MODE_AF_OD;

GPIO_InitStructA.Alternate = GPIO_AF2_TIM3;

HAL_GPIO_Init (GPIOA, & GPIO_InitStructA);

View solution in original post

2 REPLIES 2
MBertocchi
Associate II

I solved my problem I did not set the ALTERNATIVE PROPERTY

GPIO_InitStructA.Pin = GPIO_PIN_6;

GPIO_InitStructA.Mode = GPIO_MODE_AF_OD;

GPIO_InitStructA.Alternate = GPIO_AF2_TIM3;

HAL_GPIO_Init (GPIOA, & GPIO_InitStructA);

TDK
Guru

You should also be setting the Speed attribute.

Thanks for following up with the solution. Please select your reply and choose "Select as Best" to mark the question answered.

If you feel a post has answered your question, please click "Accept as Solution".