Timer Interrupt works in DeBug but not "program"...new file attached

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.
DeCo_1926091
Level 4
Level 4
First like received

Using EZ-BLE module (CYBLE-214009-00) , PSoC 4 with the pioneer board I have two pushbutton switches which I want my program to respond to when either has been pressed and held for 3-4 seconds.  The response (for test purposes) should be that SW1 will toggle an output driving an LED and SW2 will do the same to another LED.  If I program this code to the PSoC 4 without code for BLE operation installed, it works fine both when doing Debug and non-debug (program) operation.  If I install code to allow BLE bonding when an iPhone or iPad is very close to the EZ-BLE module the switches still work properly when in Debug mode but not when "programmed" (non-debug mode).

   

Operation should be:  when a PB is pressed and held a timer is started (set for a timeout of 3 seconds).  If the button is held for more than the timeout period the timer initiates an interrupt at terminal count.  The interrupt's ISR, based on a flag which indicates which button has been pressed, then toggles the pin driving the appropriate LED.  Pressing and releasing the button before the timeout period is over simply stops the timer and nothing else happens.

   

In the situation when it's not operating properly, the first press of a button whether held or not does nothing to the LEDs and the ISR is not called.  However, all subsequent presses cause immediate toggling of the LEDs without the required hold time.  This despite the fact that nothing relating to BLE functions, such as bonding, has been done, except whatever the code itself does, no action on my part has been taken.

   

I'd sure be grateful for any advice anyone could give me on this.  The (new) bundle is attached.

   

Thanks,

   

Dennis

0 Likes
1 Solution

You fixed it!  I had not realized that the BLE proximity bonding code had a section in it that turned on low power mode when not connected or advertising. Commenting that section out make everything else work fine.  Thanks for your help.

   

Dennis

View solution in original post

5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Your project archive misses data. Please use

   

Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes

Thanks, Bob.  I've changed the file attached to my original post.

   

Dennis

0 Likes
Anonymous
Not applicable

I'm still only seeing the "Workspace" file in the .zip archive, it's missing the rest of the project files as far as I can tell.

   

It sounds like (from your description above) that the timer is not being turned off when the pushbutton is let go; Make sure you are turning off the timer, and clearing out any associated variables/counts you have.

   

Also, if you are doing power-saving (sleeping/deep sleeping/hibernating), then incorrectly putting the unit into low-power modes or not turning on interrupts for peripherals/ISRs will cause it to never wake up again upon button push. Double check that you are doing the push button interrupts/wakeup events properly to handle low power modes.

0 Likes

You fixed it!  I had not realized that the BLE proximity bonding code had a section in it that turned on low power mode when not connected or advertising. Commenting that section out make everything else work fine.  Thanks for your help.

   

Dennis

Thank you so much. You saved me a lot of time. It fixed my problem.

I suggest in any case to pay attention also to the possible presence of the uart debug which may cuase problems:

See this link to better understand:

PSOC4 BLE stop working when assign a WDT interrupt or a GPIO Interrupt

0 Likes