2018-01-22 01:28 AM
Hey everyone,
I'm using a stm32f722ze
I've got a small issue considering the prescaler on the timers. I'm using this to trigger an input capture and DMA request after 8 clock cycles, although the prescaler seems to have a slightly odd issue.
The issue:
first rising edge -> triggers input capture timer which triggers DMA
every eight rising edges after -> triggers input capture timer which triggers DMA
If I've set the prescaler to 8, I ideally would never want it to trigger on the first edge, but definetly on every 8th edge.
This completely screws up my timing as it need to only be triggered on every eight edges.
Ideally what I'd like is that first edge to never trigger the input capture, but rather every eight edges from the beginning. Is there any way that I can change this so that the first trigger doesn't happen?
Thanks in advance for any help. Its really appreciated.
#input-capture-mode #prescaler #stm32f7 Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-01-22 07:29 AM
Also is there a way that I can manipulate the amount of rising edges the prescaler has seen? At some point Id like to reset it to 0 if its seen 4 rising edges. Which register stores the amount of edges ?
2018-01-22 08:31 AM
This register is not exposed so there's no direct way to manipulate it.
JW
2018-01-22 08:33 AM
So there's no way that i can reset it to 0? No timer function,etc that would allow this?
:(
2018-01-22 08:43 AM
I'd say that resetting the timer (e.g. through RCC_APBxRSTR) will put it into some defined state, but it may well be one-before-trigger-whatever-the-divider-is.
It may also well be that disabling the given channel in TIMx_CCER will do the same.
These things can be easily experimented. However, you should either find a more thorough description or get somebody from ST to give such in a binding enough form, prior using it.
JW
2018-01-22 08:50 AM
2018-01-22 09:37 AM
Thank you WJ,
This does work perfectly, by setting CC1E to 0 and back to 1, the prescaler is reset. One last issue I have is when the triggering starts as mentioned in the original question. If I can find a solution for this, it will completely solve my problems.
I do apologize for hassling you with questions. Is there anyway I can set it so that It doesn't trigger on the first rising edge, but rather on every 8th. I have the prescaler set to 8, although it triggers on the first edge and then every eigth after. Id like to skip this first rising edge if at all possible. I've searched the forums and manual, although I could have missed something, as I did with the CC1E register
Thank you for all the help thus far.
2018-01-22 10:58 AM
I doubt there's anything obvious there.
Try to tell us more about your application, maybe there's some better option how to solve it.
JW
2018-01-22 11:08 AM
Hi JW,
I plan on using a input capture timer and DMA to read in data via the gpio pins (as in the following example:
http://www.st.com/en/embedded-software/x-cube-paral-com.html
The input capture will read in 16 bits (2x 8 bit shift registers) from a shift register. The shift register receives data from an ADC. Having the shift register will allow me to have more time to process the data and send it out to an sd card. The only problem is with the shift register I'll need the input capture to activate on every 8th clock. If the timing is off it will cause the read in to be completely wrong and I'll miss bits.
I'm thinking I might need to look for a hardware solution like some prescaler instead of a software solution. I've been working on embedded systems for about a year, so any advice is really appreciated!