Skip to main content
RKage.2
Associate
January 18, 2021
Question

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

  • January 18, 2021
  • 2 replies
  • 683 views

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
This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
January 18, 2021

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 VenmoUp vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
January 19, 2021

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

JW