PSoc 4 BLe 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.
Anonymous
Not applicable

Hi, I'm using a '042-BLE' kit here and it's working fine. But I can't get a timer interrupt to work. Here is the main code:

   

 * ========================================
*/
#include <project.h>

   

 
uint16 ms_count = 0;
 
CY_ISR(MY_ISR)
    {
    ms_count++;
     
    if(ms_count == 1000)
        {               // 1 second
        LED_2_Write(!LED_2_Read()); // Toggle LED
        ms_count = 0; // reset ms counter
        }
    }
 
int main()
{
    Timer_Start(); // Configure and enable timer
    Timer_ISR_StartEx(MY_ISR); // Point to MY_ISR to carry out the interrupt sub-routine
    CyGlobalIntEnable; // Enable global interrupts
     
    for(;;)
    {
        // Infinite loop for timer/interrupt to keep executing
    }
}

   


The pin output is square running at 900us, not 1 second I had hoped for. Changing the clock frequency makes no difference.

   

This is going to be such a silly problem, I'm already embarrassed, but I've at this for some time and I can't see what is wrong.

   

Project is  attached.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Willam Here is an example of the timer program it is running some where close to once a sec however I have not scoped it. It is also using a CY8C4247LQI-BLE-483  . It has a great example of the interrupt and clearing of it. 

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 clear the interrupt cause of the timer component. Depending on the timer base (UDB or TCPWM) there are different APIs.

   

There is a Timer_ClearInterrupt() or a Timer_ReadStatus(), check datasheet of your component.

   

 

   

Bob

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

Hi,

I am interfacing an ble to one led , i want to set blink the led for 1sec,it's blinking.but after 1 minute led stops working and pwm also starts working...

Even if i make my code to blink led for 1 minute ,the led blinking for 1 sec only.

please help me to resolve the issue

find the attachment

Thanks in advance.

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Willam Here is an example of the timer program it is running some where close to once a sec however I have not scoped it. It is also using a CY8C4247LQI-BLE-483  . It has a great example of the interrupt and clearing of it. 

0 Likes
Anonymous
Not applicable

hi 

ip cloclk timeperiod x prescaler x period =required delay

is this one is applicable in  psoc4 ble

0 Likes
Anonymous
Not applicable

If I understand your question correctly, yes. You just change the device to PSoC 4 BLE for the project

0 Likes
Anonymous
Not applicable

Many thanks guys, I added Timer_ClearInterrupt but still didn't work, but the example worked perfectly. Looked at my code a bit longer and threw it away and used the example. Excellent!

0 Likes