Example Projects - Timer Problem

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.
ScEn_283436
Level 5
Level 5
5 sign-ins First solution authored 100 replies posted

I'm using the PSoC Creator with  PSoC3. I am having a problem using the Timer function.

   

I know this may not be the proper forum and that I will be sternly admonished,.

   

1. I tried using the timer to create a simple 1millisecond interrupt but could only get one frequency of interrupt output, regardless of the clock input. I lost many hours trying to figure out what might be wrong with the clock, but then I ran the clock straight into the ISR function and it worked as expected. I also tried the the Timer in UDB mode and it worked. Therefore I concluded that there must be a problem with the timer FF mode (which the datasheet recommends for simple applications like this to save resources).

   

2. I opened a case and someone keeps sending me zip files. I don't understand how I'm supposed to implement the bundled zip files. I unzip them and try to open the project and I get an error message saying that the path is invalid and the project needs to be in a directory of the same name. I create a directory with the name of the project, doesn't work. Same problem. Getting nowhere fast with a deadline coming on. I have attached the file I got from Cypress. You try it.

   

Nick

   

 

   

   

Environment:

       

   

PSoC Creator 2.0 Component Pack 2 (2.0.0.828)

   

 

   

Culture: English (United States)

   

 

   

OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1

   

 

   

CLR Version: 2.0.50727.5466

   

   

CY8CKIT-002 MiniProg3 1.0 Rev**

   

 

   

PSoC Programmer 3.14

   

 

   

PSoC 3 Development Kit 1.0 Rev*A

   

 

   

PSoC Creator 2.0 Component Pack 2

   

 

   

Loaded Plugins:

   

 

   

Name: Addin Discovery

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Discovers PSoC Creator addins (kits, language packs, etc)

   

 

   

Name: Device Catalog

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Device Catalog Plugin

   

 

   

Name: Documentation

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Adds the topics available in the documentation.

   

 

   

Name: Start Page

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Adds a start page to the framework.

   

 

   

Name: Output Window Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Adds the output window

   

 

   

Name: SCC Manager

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Source Code Control Manager is the central class used for SCC actions within PSoC Creator.

   

 

   

Name: Symbol, Schematic and SchMacro Factory

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Symbol and Schematic Factory is used to load, cache, and retrieve symbols and schematics.

   

 

   

Name: Project Manager Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Adds project management related functionality.

   

 

   

Name: File Editor Factory Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Add file editors to the framework.

   

 

   

Name: GDE Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Loads the Symbol and Schematic editors

   

 

   

Name: Language Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Supports user files in multiple languages

   

 

   

Name: Workspace Factory

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Workspace Factory is used to retrieve instances of PSoC Creator workspaces.

   

 

   

Name: Project Factory

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Project Factory is used to retrieve instances of PSoC Creator projects.

   

 

   

Name: 8-bit PSoC Executable Project Template

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: This plugin provides PSoC Creator with the ability to create PSoC Executable projects.

   

 

   

Name: 32-bit PSoC Executable Project Template

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: This plugin provides PSoC Creator with the ability to create PSoC Executable projects.

   

 

   

Name: 32-bit PSoC4 Executable Project Template Loading Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: This plugin provides PSoC Creator with the ability to create PSoC Executable projects.

   

 

   

Name: PSoC Library Project Template

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: This plugin provides PSoC Creator with the ability to create PSoC Library projects.

   

 

   

Name: Empty Workspace Template

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: This plugin provides PSoC Creator with the ability to create empty workspaces.

   

 

   

Name: Platform Manager

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: PSoC Creator Platform Manager

   

 

   

Name: ARM GCC Generic

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: ARM GNU Generic

   

 

   

Name: ARM RVDS Generic

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: RealView ARM RVCT31 Generic

   

 

   

Name: ARM MDK Generic

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: RealView MDK RVCT40 Generic

   

 

   

Name: DP8051 Keil Generic

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: DP8051 Keil Generic

   

 

   

Name: Device Selector

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Adds a dialog that allows the user to select a device.

   

 

   

Name: Transport Framework

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides a generic device communication framework for use by other plugins.

   

 

   

Name: Debugger Core

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Core Debugger provides an architecture independent framework for the common debug features.

   

 

   

Name: PSoC3 Debugger

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides debugging support for the PSoC3 family through a GDB backend.

   

 

   

Name: PSoC4 Debugger

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides debugging support for the PSoC4 family of devices through a GDB backend.

   

 

   

Name: PSoC5 Debugger

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides debugging support for the PSoC5 family through a GDB backend.

   

 

   

Name: Device IO Transport

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides device IO support for Cypress devices though PSoC Programmer APIs.

   

 

   

Name: Bootloader Host

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Provides a host tool to perform bootloading operations.

   

 

   

Name: Background Elaborator

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: PSoC Creator Background Elaborator.

   

 

   

Name: TypeCache Factory

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The TypeCache Factory is used to retrieve instances of TypeCaches.

   

 

   

Name: DWR Plugin

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Registers resource editors with devices.

   

 

   

Name: DMA Wizard

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: Enables quick and correct development of applications that use DMA.

   

 

   

Name: Notice Window

   

 

   

Version: 2.0.0.828

   

 

   

Company: Cypress Semiconductor

   

 

   

Description: The Notice Window displays notices (status messages / errors with managed lifetimes).

   

 

   

   

Installed CyInstaller Products:

0 Likes
18 Replies
Anonymous
Not applicable

create a new folder with the name "simple.cydsn", put everything except simple.Bundle01.cywrk and simple.Bundle01.cywrk.sachin inside that folder. 

   

 

   

Inside PSOC creator :

   

- Click on FIle--->Open--->Project/Workspace

   

select simple.cyprj

   

Your project will open on a new workspace.

   

 

   

Dunno why the path of the bundle has been inside the same directory.

0 Likes
Anonymous
Not applicable

 To open the full workspace (to update components)

   

in adition to creating the new directory and movin the files, open the simple.Bundle01.cywrk file in a text editor and replace the line

   

<name_val_pair name="simple" v=".\simple.cydsn\simple.cyprj" />

   

instead of:

   

<name_val_pair name="simple" v=".\simple.cyprj" />

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

One problem, you did not issue a -

   

 

   

timer_clock_Start(void) ;

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

That should have been typed -

   

 

   

timer_clock_Start( ) ;

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Also keep in mind the output, Tc (the interrupt to the pin) is a very low duty

   

cycle pulse, per datasheet description of Tc timing.

   

 

   

Regards, Dana.

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

Best would be when you post YOUR project here. Use the "Create Workspace Bundle" from Creator 2.2 ans uplöoad the resulting file here using ms Internet Explorer (NOT Chrome!)

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Project is posted here, at top of thread.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 lol guys, the attached project is not his project but rather a project ent to him by Support.

   

The little example project works as intended and no timer_clock_start() is not needed because "Start on Reset" is activated for it in the clock configuration window.

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

This is why I wrote "YOUR" in capital letters. It is too much guessing without a concrete project.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

When a poster takes a project from another source, and then opens it in his

   

HW and environement, is it now HIS project ? LOL

   

 

   

Dana.

0 Likes
ScEn_283436
Level 5
Level 5
5 sign-ins First solution authored 100 replies posted

Dana  - I followed your advice on the directory structure and modifying the cywrk file and got the project to open.

   

It seems like the only knobs I can twist for the Timer are via the Configure dialog and brother I've tried every possibility there. The Timer works as expected in my design when I'm in UDB mode, but not FF. I'm going to try the sample program and play around with it on development board. My gut feeling is, there is something in the cydwrk > clocks or interrupts that's honking me in my design. Something outside of the Timer function itself. A hardware revision, compiler, component pack,. something.

   

I created a 1kHz clock using 'Auto' source with a divider of 100. The Creator assigned ILO.

   

Thanks for your help. I would like to bundle up my project but since it's so far down the road hardware wise, do you think it would do any good?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I will take another look at this myself, you have my curiosity up.

   

 

   

I wish I could take cred for the Zeta advice on getting the sample project

   

open, but I used his advice as well, or I would never have seen the light

   

of day on that project.

   

 

   

Regards, Dana.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Regarding your first question: So you want to have an interrupt be called once every 1ms, right? A timer is usually only for measuring periods, not for creating ones.

   

So your way of adding a clock component to your schematic and using it to trigger the interrupt is actually OK. If you need lower interrupt frequencies, you can use a PWM component instead. Make sure that the interrupt is set to edge-triggered.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Oh, and it is really helpful to have separate problems in separate threads. Your problem with timers has, I suppose, nothing to do with the problem of opening a prohject someone at Cypress sent to you (btw: why didn't you ask the sender for help?). Mixing them up only leads to confusion.

   

Can you create an example project for your timer problem demonstrating the problem, and upload this one? From your description there should not be more than a single timer and an interrupt component in it...

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

A timer is certainly appropriate for creating periods, from datasheet -

   

 

   

When to Use a Timer

   


The default use of the Timer is to generate a periodic event or interrupt signal. However, there
are other potential uses:

   


  Create a clock divider by driving a clock into the clock input and using the terminal count
output as the divided clock output.

   


  Measure the length of time between hardware events by driving a clock into the clock input
and driving the test signal to the enable or capture input.

   


Note A Counter component is better used in situations focused on counting events. A PWM
component is better used in situations requiring multiple compare outputs with more control
features like center alignment, output kill, and dead band outputs.

   


A Timer is typically used to record the number of clock cycles between events. An example of
this is measuring the number of clocks between two rising edges as might be generated by a
tachometer sensor. A more complex use is to measure the period and duty cycle of a PWM
input. For PWM measurement, the Timer component is configured to start on a rising edge,
capture the next falling edge, and then capture and stop on the next rising edge. An interrupt on
the final capture signals the CPU that all of the captured values are ready in the FIFO. 

   

 

   

Regards, Dana.
 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Also a timer uses a little less resources, HW and Firmware, than a PWM

   

for the purposes of period generation -

   

 

   

   

 

   

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

I stand corrected - I just looked at the first page of the timer component data sheet, which states that it is intended for period (or time) measurements.

   

But I'm still wondering why the OP has problems getting a different frequency than 1kHz from the timer...

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Nick, here is a working fixed Timer ISR implementation -

   

 

   

Regards, Dana.

0 Likes