TCU and Event Capture issues


#1

Hi All.

Am attempting to use the TCU module on a Q2686 (F/W R7.4) to build a simple frequency counter.

First issue: The documentation indicates that you configure the TCU handler with ‘the pin number’ that is to be used to count the events on. No obvious API documentation to indicate that ‘the pin number’ actually refers to one of the INT pins (i.e. INT0 or INT1), not a generic GPIO pin. A trap for the unwary there…

Now that I can actually count events on an interrupt pin, I hit the next snag: I can’t set up an event count duration of 1 second (== 1000 mS == 1000000 uS == 1000 x ‘tcu_EvCaptUnit’ as read from the hardware registry.) If I use 1000 as the adl_tcuEventCaptureSettings_t::Duration value, I get an ADL_RET_ERR_PARAM returned when I do the adl_tcuSubscribe() call. A value of 500 (500mS), or 100 (100mS) works fine - the low level interrupt handler is called as expected. I shouldn’t be overflowing the Duration value as it is supposed to be a u32 type.

Has anyone else had this issue? Being unable to count events over the period of 1 second doesn’t seem that unreasonable to me (it’s a direct conversion to Hz, after all).

The next thing I notice is that with a count period of 500mS, when I ramp the input frequency up over approx 31kHz (measured roughly off the freq. gen. dial, so could be over 32kHz), the Q2686 hangs. Interrupts stop and then I get a WATCHDOG timeout and reboot!

What gives here? I would have expected that the counter would have eventually started missing counts and given a wrong result. All the data types exposed in the API appear to be of type u32, so 32kHz shouldn’t be rolling over an internal counter - unless someone has taken a shortcut and is using a s16 internally somewhere which may be overflowing.

As noted above, I’m using a Q2686 (G modem), running R7.4 firmware and M2M Studio 1.0.2.

Any thoughts would be appreciated.

ciao, Dave


#2

aren’t you somehow stacking interupt upon interrupt, thus overflowing the stack and causing a reset?

just my 2 cents :slight_smile:


#3

Hiya,

That’s probably what’s happening internally. However, it is my understanding that when doing Event Counting (as opposed to Event Timing) my low interrupt handler will only be called at the end of a time period (i.e. every 500mS or 1s or whatever), regardless of how many events occur inside that time period - not on every event…

I guess it all depends on how the WMP processor uses the capture/compare/timer registers. Other micros I have used simply increment (or decrement) a hardware counter each time an event occurs, and the OS then reads and resets this counter at periodic intervals.

I’m going to try using a high level interrupt handler instead of the low level handler and see if that makes any difference.

Still doesn’t solve my issue about using a 1 second period though…

Thanks for your thoughts.

ciao, Dave


#4

Hello davidc, could you explain me what the TCU (module) really is???
Thanks


#5

Hiya,

Timer and Capture Unit

This API provides access to some hardware that is present on the Q2686/Q2687 modules.

It’s only available in R7.xx firmware and associated Oasis 2.xx API

See awneil’s comments here.

ciao, Dave


#6

Forgive my ignorance - the ADL Guide states:

What the heck is the" PTS"?? (the same acronym is also referenced in many other sections of the manual).

Could this be something like “Product Technical Specification” ??? In the interests of improving documentation quality, how about adding an entry in the Glossary to save people guessing?


#7

Yes, it is.

“PTS” was Wavecom-speak for “Datasheet” - now inherited by SiWi…

Yes - good point!

(note that “PTS” is in the list of Abbreviations & Definitions in the AT Commands manual)