Search found 5 matches

by jsuijs
Thu Dec 24, 2020 8:26 am
Forum: General discussion
Topic: [Solved] Set alternate function for quadrature encoder pins.
Replies: 9
Views: 7866

Re: Set alternate function.

Hi, To finalize this, below the working version of the quadrature encoder setup on TIM4 and TIM2. Difference is TimerClock and AlternateFucnction are enabled. Hope one day this will be useful for someone. Joep HardwareSerial Serial(PA3, PA2); void setup() { Serial.begin(115200); Serial.println("...
by jsuijs
Thu Dec 24, 2020 7:55 am
Forum: General discussion
Topic: [Solved] Set alternate function for quadrature encoder pins.
Replies: 9
Views: 7866

Re: Set alternate function.

Hi, Yes, that's what I needed :) I combined your two answers and some research into arduino->stm pins into a function to switch a pin to an Alternate function. It works as a charm now, thanks again. Joep //----------------------------------------------------------------------------- // pinModeAF - c...
by jsuijs
Wed Dec 23, 2020 6:37 pm
Forum: General discussion
Topic: [Solved] Set alternate function for quadrature encoder pins.
Replies: 9
Views: 7866

Re: Set alternate function.

Hi, I'm almost there, it works but it needs quite some cleanup. On of the issues was LL_GPIO_SetAFPin_8_15() and LL_GPIO_SetAFPin_0_7() do set the AFR-register, but do not activate the AF-mode in the MODER register. Is there a function or macro to set these bits, except HAL_GPIO_Init()? Regards, Joep
by jsuijs
Tue Dec 22, 2020 5:53 pm
Forum: General discussion
Topic: [Solved] Set alternate function for quadrature encoder pins.
Replies: 9
Views: 7866

Re: Set alternate function.

Hi, Thank you for your reply. Unfortunately this hasn't solved it yet. Spent the whole day on this and running out of ideas :( . Below is the current program, have tried many variants but timers stay at zero. Any suggestions? Joep HardwareSerial Serial(PA3, PA2); void setup() { Serial.begin(115200);...
by jsuijs
Tue Dec 22, 2020 2:05 pm
Forum: General discussion
Topic: [Solved] Set alternate function for quadrature encoder pins.
Replies: 9
Views: 7866

[Solved] Set alternate function for quadrature encoder pins.

Hi, I'm using timers to decode a quadrature signal but have trouble getting this running on an stmf4 with stm32 core. In detail: PB6/PB7 on timer4 and PA0/PA1 on timer2, on a 'Black F407VE'. I do have this running on the same hardware, using CMSIS files, mostly dated 2011. However, I'd like to switc...

Go to advanced search