We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I had a design counting pulses from pin T3IN on GPT1-T3. The design now requires a pulse width to be measured instead of pulses being counted. Our hardware has access ONLY to T3IN, not CAPIN etc.
Problem: How can I set up GPT1/2 to measure the pulse width with only T3IN pin ?
Still getting to grips with capture/reload and interrupts, but reckon someone's done this before...!
Thanks for any advice. Rup.
Thanks for your note Thomas.
The next sentence in the manual after your extract reads: Note: A transition of the gate signal at pin T3IN does not cause an interrupt request.
This is the killer for me! Best for me would be an interrupt (or PEC transfer) to take the result into a variable. I want to avoid a timer value for both the mark and the space of the PWM signal. So triggering an IRQ on (either) a rising or falling edge would be perfect. CAPIN through CAPREL in GPT2 seems to be exactly what I need - but I don't have access to CAPIN pin!
I think I can make a workaround by sensing the status of T3IN when I read GPT1_T3 - but this will be asynchronous with the PWM signal.
Rup
You can capture timer T5 value to CAPREL register on T3IN transition(s), and get an interrupt. Read timer block GPT2 description.
Sauli
Thanks Sauli, I ended up coding a solution through GPT5, T3 and CAPREL as the manual shows, although this gives an interrupt on both edges, (unless I've misunderstood it)which as I said I don't want. The benefit is measurement of the mark and space values for safety checking, so that'll do.