how can I start timer2 when timer1 reaches TC?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi guys,
Simple question sorry, but I am trying to start a second timer from the CC output of the first.

   

Psoc4100, TCPWM v2.10

TCPWM1 setup:
TC mode.
All 3 ip's tied together:
Reload (Rising Edge)
Start (Falling Edge)
Stop (Rising Edge)
Counter mode: Up
Run mode: Continuous
Capture/Compare: Capture
Interrupt on Terminal Count.
Period: 10000
IP Clock: 1khz
The CC output is wired to Timer2: Start,Stop,Reload pins, ties togther aswell. 
Note: This timer runs ok, and generates a nice interrupt to turn an beeper on after 10 secs.

   

 

   

Timer2 setup:
TC mode. Same as above.
All 3 ip's tied together:
Reload (Falling Edge)
Start (Rising Edge)
Stop (Falling Edge)
Counter mode: Up
Run mode: Continuous
Capture/Compare: Capture
Interrupt on Terminal Count.
Period: 5000
IP Clock: 1khz
Note: This timer does NOT run ok, the interrupt (to turn the beeper off after 5 secs) never occurs.

   

Things I have tried without success:
a) Wire timer1 interrupt op to the timer 2 start ip. This flagged a routing error.  

   

b) Starting timer 2 with API call:
timer2_TriggerCommand(timer2_MASK,timer_door_alarm_timout_CMD_START);
but this didn't work, ie. didn't start the timer. No interrupt generated after 5 secs.

I've attached the project zipped.
Any advice would be appreciated.
Thanks,
David

   


 

0 Likes
7 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, David!

   

I cannot help you with your project, because

   

You are using more resources than available, try to use TCPWMs instead of UDB-based components. You even may use a single PWM or TCPWM to control your buzzer.

   

Your PSoC4 has got four TCPWMs and four 8-bit wide UDBs which you may use. Consider to lower the clocks for UDB-based components to use 8-bit wide components instead of 24 bit or even 32 bit.

   

Lastly: when creating a file to upload your project and all of your settings use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

   

 

   

PS: Where in Germany are you located? I live near Bremen.

0 Likes
Anonymous
Not applicable
        Hey Bob, good to communicate directly after reading lots of your forum posts over the years:) I am in cold cold Berlin and run a technical service to startups building the guts of there projects and ideas. This project is for an unmanned locker system to be used in airports! Thanks for the good advice:) Hmm, I thought I was already using non-udb TCPWMs. Need to take another look... Also I would be really interested to see how you could use a single TCPWM to sound a beeper after 10 secs, the shut it off 5 secs later? Nearly summer:) David   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

PWM period 15 seconds, compare 10 seconds, inverse output. after tc stop in isr.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob, sorry but could you elaborate on that a bit more? - I don't quite understand:/
I am very familiar with capture compare, and generating isrs etc. 
An example would be great, only if you have time.

Many thanks!
David
 

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Example:

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Bob, I was using non-udb timers, as I said in my first post: TCPWM v2.70.
I am puzzled as to why you said 'I am using UDB timers, more resources than available', when the resources are just fine.
Can anyone see why the second timer: timer_door_alarm_timout
does not start?
 

   

PSA Bundle.
Kind regards,
David

   

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I am puzzled as to why you said 'I am using UDB timers, more resources than available', when the resources are just fine.

   

When I built your attached project there was an error stating that you used more resources than available.

   

The project you supplied now looks completely different to the first..

   

 

   

The ov pulse is only 2 bus clock cycles wide, that will not be detected with a 1kHz. clock. Best could be to use a pulse converter component.

   

 

   

Bob

0 Likes