- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to create a pulse train of LOW (1000 ms) and HIGH (250 ms) on the PSoC 6 BLE board.
I am quite new to PSoC, and my attempt shown below does not produce any output.
Both timers are configured as one-shot. The idea I am trying to implement is that Timer1 will toggle the flip-flop at t1, also starting Timer2, which will then toggle the flip-flop at t1 + dt, simultaneously restarting Timer1. Maybe it has to do with the overflow/start timings, but the above does not work.
(I realise that 1000ms/250ms pulse can be created using PWM, but I may need much shorter pulses - like 1000ms + 10 us, which may not be possible with PWM because of the duty cycle resolution.)
I've attached the project as well. Thank you for any help.
Regards
Mahesh
Solved! Go to Solution.
- Tags:
- psoc6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mahesh,
The reason why your design does not work is that because -
1. You have not started the Timer2 in the code. I guess you assumed Start will start the timer. Note that Start actually does the necessary initialization and enables the timer, which is required for proper operation. Since you have enabled hardware start in the component, the Start WILL NOT trigger a start i.e. the timer will simply be enabled and initialized. So you should call Timer2_Start().
2. Since both the timers are waiting for each others overflow signal for starting there is dead lock here i.e. both are waiting for the other to trigger the start whereas none of them have been started. Again, I believe this is from your understanding how the Start works In order to start the timer, you should use the "Cy_TCPWM_TriggerStart(Timer1_HW, Timer1_CNT_MASK);" for triggering the start.
Please try the above and see if that helps - I have another feeling about the pulse width of the overflow signal (which is typically just 1 pulse wide - 1 kHz) that will it be enough to trigger the start (which is sync'ed to the 1 kHz clock as well). So as xzng mentioned, it would be less cumbersome to use PWM than this approach
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The PWM resolution in P6 can reach 32bit resolution, it should be enable to generate shorter pulses - like 1000ms + 10 us.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mahesh,
The reason why your design does not work is that because -
1. You have not started the Timer2 in the code. I guess you assumed Start will start the timer. Note that Start actually does the necessary initialization and enables the timer, which is required for proper operation. Since you have enabled hardware start in the component, the Start WILL NOT trigger a start i.e. the timer will simply be enabled and initialized. So you should call Timer2_Start().
2. Since both the timers are waiting for each others overflow signal for starting there is dead lock here i.e. both are waiting for the other to trigger the start whereas none of them have been started. Again, I believe this is from your understanding how the Start works In order to start the timer, you should use the "Cy_TCPWM_TriggerStart(Timer1_HW, Timer1_CNT_MASK);" for triggering the start.
Please try the above and see if that helps - I have another feeling about the pulse width of the overflow signal (which is typically just 1 pulse wide - 1 kHz) that will it be enough to trigger the start (which is sync'ed to the 1 kHz clock as well). So as xzng mentioned, it would be less cumbersome to use PWM than this approach
Regards,
Meenakshi Sundaram R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much for that clarification. Works nicely now.
Yes, I had assumed that connecting "start" in the component would start the timer. Appreciate the quick help!
Regards
Mahesh