Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

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.