cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-L073RZ Encoder Working in one project and not the other

RKage.2
Associate II

I'm developing a project with a lot of peripherals running at once. I wanted to add a rotary encoder on Timer 3 but it refused to do anything at all. The TIM3->CNT Register just sits at 0. Otherwise one PWM Channel of Timer 21 as well as the RTC are running.

Then I tried it on an empty project and with the exact same code it is working without a hitch.

Could any of the peripherals interfere with the timer in encoder mode?

all used peripherals (all working already):

  • one adc pin
  • rtc with sleep mode
  • Timer21 Ch1 PWM OUT
  • SPI1 in master only mode
  • rng
  • the usb pins to flash via the dfu bootloader
2 REPLIES 2

Things stuck at zero suggest the clock on the bus isn't enabled. Check RCC registers, and that you're enabling on the right bus.

Diff the projects.

You created or automated tools? Watch for nonsense buried in the MSP files. Watch for ordering, the horse goes in front of the cart, synchronous logic needs a clock.

Watch for code blindly writing to peripheral registers that can break or disable prior settings.

>>Could any of the peripherals interfere with the timer in encoder mode?

Doubt it, the peripherals don't tread on each other, and function is muxed at a pin level.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Read out and check/post TIM and relevant GPIO registers content.

JW