No TC interrupt with Timer [v2.80]

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.
user_4371246
Level 1
Level 1
First like received

I'm new with Cypress CPUs (PSoC). In the past I worked with NXP, Microchip and Atmel. (now also Microchip)

At the first sight everthing sounds very easy and workable. I like the thinking of documentation cos I need it for

class B or class C medical software. And I must rate the reliability of the environment.

After 3 days I'm very disapointed. But ok, let's see.

I'm again confused about the easy looking and configurable blocks that not deliver what they promised at the first sight.

Now the block Timer[v2.80]

I set it as desired and choosed Interrupt on TC. I set a Interrupt to the interrupt output.

This timer is conigured to provide every 1ms an INT.

After setting a breakpoint in the INT and rung a debugg sessionI get two times a halt at the breakpoint, then never again.

So what is the problem? Is it a bug?

For demonstrating I created a new project, just for show the problem.

#include "project.h"

uint32 systickcounter = 0;

CY_ISR(SysTick_INT)

{

    systickcounter++;

}

int main(void)

{

SysTick_INT_StartEx(SysTick_INT);

SysTick_Start();

CyGlobalIntEnable; /* Enable global interrupts. */

for(;;)

    {

        /* Place your application code here. */

    }

}

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I've also used NXP (Freescale) MCUs a lot, and I still like them.

But PSoC has its own beauty (and pit holes and traps)...

Anyway, You can access datasheet of a particular component

(1) when you select a component from the Component Catalog

In the right-bottom pane, typical component is shown, and there at the left-upper corner

link to "Datasheet" is located.

000-WorkBench.JPG

(2) or if you have inserted the component in the schematic, double clicking the component opens the configuration dialog

In the left-bottom button is "Datasheet"

001-Config.JPG

Now when you open the Datasheet

In the left, there is an index.

Although I recommend you to read through (or skim through) all,

but for the time being, let's find the suspect.

So I'd click the index "Application Programming Interface"

002-Datasheet.JPG

Now list of available application program interface, aka API is shown.

Again, it won't harm if you read at least the Functions table and Descriptions.

Now let's click the Timer_ReadStatusRegister()

003-API.JPG

Finally we caught the suspect, Timer_ReadStatusRegister(void)

004-ReadStatusRegister.JPG

And its "Side Effects, it is written.

005-SideEffects.JPG

Yes, I agree, that it is not clear nor friendly, but this is the way they implemented the component.

There are other components with "ClearInterrupt()" or "ClearPending()", but unfortunately this one does not.

moto

View solution in original post

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

You need to call the ReadStatusRegister() API for the timer. This will clear the interrupt so that another one may happen.

Additionally you sholg declare

volatile uint32 systickcounter = 0;

Bob

Thanx for the answer. Now it works.

But now I have another problem. Maybe you can tell me where it is documentated. I cannot find it.

Maybe I'm to stupid. But my boss is very upset cos I spent 4h to find this problem.

He blames me why I don't looked in the documents and wasted his money. But I cannot find it.

And I need the documenataion for my class B documenation.

I searched again and again in the timer documenation... but nothing...

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I've also used NXP (Freescale) MCUs a lot, and I still like them.

But PSoC has its own beauty (and pit holes and traps)...

Anyway, You can access datasheet of a particular component

(1) when you select a component from the Component Catalog

In the right-bottom pane, typical component is shown, and there at the left-upper corner

link to "Datasheet" is located.

000-WorkBench.JPG

(2) or if you have inserted the component in the schematic, double clicking the component opens the configuration dialog

In the left-bottom button is "Datasheet"

001-Config.JPG

Now when you open the Datasheet

In the left, there is an index.

Although I recommend you to read through (or skim through) all,

but for the time being, let's find the suspect.

So I'd click the index "Application Programming Interface"

002-Datasheet.JPG

Now list of available application program interface, aka API is shown.

Again, it won't harm if you read at least the Functions table and Descriptions.

Now let's click the Timer_ReadStatusRegister()

003-API.JPG

Finally we caught the suspect, Timer_ReadStatusRegister(void)

004-ReadStatusRegister.JPG

And its "Side Effects, it is written.

005-SideEffects.JPG

Yes, I agree, that it is not clear nor friendly, but this is the way they implemented the component.

There are other components with "ClearInterrupt()" or "ClearPending()", but unfortunately this one does not.

moto

0 Likes

Hi Moto,

thank you for your comprehensive answer. I know these ways to get the info.

Actually the way to get info is very good.

But in this case it is not clear. The interrupt flag is automaticly cleared but the TC bit not.

Even not if I check the "Interrupt on TC".

This is not well considered.

But anyway. I gave up the hopness to have find a new system what I can programm without these hours

of wasted time 🙂 Finally everywhere the same. The brand doesn't matter.

At least the forum here is very helpful and you get fast an answer.

So thanx a lot again JoMe !!!

lock attach
Attachments are accessible only for community members.

Spending 4 hours to learn a new concept in Programmable Systems is a little bit too few. The timer component is not quite easy to understand and it took me some more hours to fully understand it. Even now I have to look into the documenttion to be on the safe side.

I am working with PSoCs for more than 12 years now and I can assure you that these devices have lots of features most of the other devices miss. You could show this to your boss and show him that the datasheet for the timer only has 35 pages.

Happy coding

Bob

I meant 4h for this one issue 😉

Thanx bob.

0 Likes