Detect GPIO Low/High state without using interrupt or busy/wait strategy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-29 12:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-29 12:33 AM
Timer Input Capture.
​
JW​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-29 12:45 AM
Can you please refer me to an example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-29 2:27 AM
- enable GPIOx clock in RCC, enable TIMx clock in RCC
- set TIMx_CHx pin to AF in GPIOx_MODER
- set that pin to given AF number for TIMx in GPIOx_AFR[]
- set TIMx_CHx to Input Capture in TIMx_CCMRx.CCxS
- optionally set polarity in TIMx_CCER.CCxP (and CCxNP) and filter in TIMx_CCMRx.ICxF; but the reset values are OK for first experiments so you can simply leave them untouched
- enable Input Capture for TIMx_CHx by setting TIMx_CCER
- enable TIMx counting by setting TIMx_CR1.CEN
Then, whenever you read TIMx_CCRx, it contains the value of TIMx_CNT which was at the moment of latest input edge on TIMx_CHx pin.
Read Input capture mode subchapter of TIM chapter in RM.
If you'd want not just the last edge but also a "history", you'd need to set up DMA to read out TIMx_CCRx into memory upon each capture event, but that's step 2.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-30 3:29 AM
What if I need to know exactly the first input edge occurs, than I must use an interrupt driven design right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-05-30 4:01 AM
One could presumably use DMA to capture time-stamps into a ring buffer
Up vote any posts that you find helpful, it shows what's working..
