Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


You are viewing a reply to Input Capture does not work  

Input Capture does not work

I usually do not use the STM HAL in my projects, so I can’t say for certain if your setup is correct because I’m not sure what some of the HAL-defined symbols equate to.

However, with that disclaimer out of the way, I’d say that your setup appears to be correct for both input capture configuration for TIM8 using CC1 on PC6.

To determine if the HAL is doing what you think it should be, I’d suggest running your application under the debugger, and following execution of the above code, check the contents of TIM8->CCMR1. I would expect it to be set to 0x??01 (MSB sets CC2 configuration so its value is not relevant)
IC1F = 0b0000 — no filter
IC1PSC = 0b00 — prescaler x1
CC1S = 0b01 — IC1 mapped to TI1, input capture mode

Check the value in TIM8->CCER:
Bit 0 (CC1E) should be 1/set (CC1 input capture enabled)
Bits 1,2 (CC1P) should be 0b01 (capture on positive edge)
All other bits are dont-care

Confirm that CC1’s interrupt is enabled in TIM8->DIER:
Bit 1 (CC1IE) is 1/set (CC1 event interrupt enabled)
Other bits are dont-care

Rotate your encoder, then break your program and check if bit 1 in TIM8->SR (CC1IF) is set. CC1IF = CC1 event interrupt flag

If all the above is confirmed, but you’re not seeing interrupts (have you defined the TIM8_CC_IRQHandler ?) then try changing the NVIC PreemptionPriority for it. I don’t recall if ‘0’ is the lowest or highest priority. Try setting it to 1 instead.

I’ve used input capture in some of my own applications (albeit not on the F407) and have used a setup similar to what you describe here, using the same sort of timer. As far as I can tell w/o greater familiarity with the HAL, your setup looks good.

 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs