-
1. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 10, 2015 10:37 AM (in response to user_475588202)Depends on what you are doing in ISR, Global clock settings, consider posting your
project so we can take a look at it.
Could also be not declaring global variables used in ISR as volatile.
http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword Volatile
Consider posting your project, makes life easier to troubleshoot.
“File” Designer
“Archive Project”
Regards, Dana.
-
2. Re: Missing Counter16 TC Interrupt
user_475588202 Aug 11, 2015 7:02 AM (in response to user_475588202)Thanks for the response, Dana. My main problem was lack of resources, so I ended up circumventing the problem using a few dynamic reconfigurations to get the extra 8 bits I needed in each counter, eliminating the need for counting rollovers. And it was much less painless of a learning process than I had initially imagined.
-
3. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 12, 2015 3:27 AM (in response to user_475588202)Excellent way to solve the problem. One of the strengths of PSOC 1/3/4/5LP is
the dynamic reconfig, although its being de-emphasized in 3/4/5LP families.
Biggest caution in using it is pay attention to the fine print foot notes of other effects
register changes have.
Regards, Dana.
-
4. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 12, 2015 4:51 AM (in response to user_475588202)As an aside I did some freq cntr work on PSOC 1 and used a timer to provide the gate,
tied that in HW to counter enables. And to a buffer to gen an interrupt at end of gate period.
That was done to avoid latency and eliminate uncertainty due to ISR servicing. That being
said my counters were big enough (you do not have the luxury of) to never overflow, so
my challenges less than yours.
Here is some ref material that may be of interest -
https://www.dropbox.com/sh/prpc74bdga7yijz/AAAeC-Dmmn5sYbWwRrl0-ZUoa?dl=0
Regards, Dana.
-
5. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 12, 2015 2:41 PM (in response to user_475588202)What ISRs do you have in addition to the counter related ISR ? Also consider internal clock
accuracy specs, unless you are running on external xtal, its quite significant in timing inaccuracy.
Additionally any blocking functions you use can impact this. Thats why non ISR approach,
and external xtal, will get the best results.
Regards, Dana.
Regards, Dana.
-
6. Re: Missing Counter16 TC Interrupt
user_475588202 Aug 12, 2015 3:35 PM (in response to user_475588202)Thanks for being on top of this thread. I learned that that system had been previously programmed at 5v. With all components running on 3.3v, things were breaking down. So I've flashed a new system and now my counts are actually above the input frequencies. There is some roughly 200mV noise on these incoming frequencies, but I don't think that this should have any impact on clocking or counting when riding on a 3.3v square wave. Reading the counter datasheet doesnt provide any clues on the clocking of the counters either.
-
7. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 12, 2015 4:34 PM (in response to user_475588202)Are you on an xtal for main clock or internal PSOC clock ? What freq are
you running for COU clock ?
Its not the clock in I am concerned with, its the time base you use to
interpret the counts in the counter. Thats the one with the greatest impact
on chip to chip accuracy.
Regards, Dana.
-
8. Re: Missing Counter16 TC Interrupt
user_475588202 Aug 13, 2015 8:08 AM (in response to user_475588202)You're correct. I was using the internal 32kHz clock for my timer module, so my sampling times were not quite 1Hz, just a bit under that. I used VC3 as a 1MHz timebase instead, got much more precise timing, and the overcounting resolved itself. thanks!
-
9. Re: Missing Counter16 TC Interrupt
user_14586677 Aug 13, 2015 8:49 AM (in response to user_475588202)For a 29466 the timing accuracy using internal clocks are attached.
As you can see the ILO is +/- 100%, pretty poor. The IMO is ~ +/- 2.5%
Regards, Dana.