Interrupt handling while supporting bluetooth | Cypress Semiconductor
Interrupt handling while supporting bluetooth
I'm a noob at the PSoC4BLE, but quite a bit of experience with other micros. I'm trying to run some code at about a 20hz rate to smoothly control an external device and I'm having a hard time finding info about what kind of timing and interrupts can be supported while running the Bluetooth stack. I started experimenting with the BLE_RGB_Power_LED code sample as a baseline.
I tried toggling an output pin each pass through main and found that it toggles several times quickly (750us, 200us, 3.5ms) then always sits for approx 200ms. before repeating. This is while the PSoC is not connected to anything via bluetooth. Is this related to the GAP advertising interval? If so, it kind of implies this is handled in a timing loop rather than via interrupt in the Bluetooth code. After connecting via CySmart, the 200ms period changes to about 65ms. which is maybe the Peripheral connection interval.
I added generic interrupt code to the project based on the Cypress PSoC 4 Interrupts doc AN90799 which uses a timer interupt (Project1_Timer). However this interrupt doesn't appear to be activated and I'm guessing it conflicts with something the bluetooth stack is doing.
So I'm hoping for some ideas as to what to what approach to take. The main loop timing interval is too erratic and slow to use, but I don't know what approach to use for an interrupt solution while bluetooth code is running. Any help would be much appreciated.