cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

AnCo_2736831
Contributor

Hi All,

I am using a PSOC 4 BLE pioneer kit. I have made a program that runs two blinking LED controlled using the CySmart App on an Android Device. However, whenever they are running they disconnect from the CySmart App itself after exactly 30 seconds all the time. I searched up this problem and found out that I need to separate the Characteristic UUID from the Descriptor UUID. I tried this, but the error still came.

I have already posted this question and got an answer that I need to use PWM to do this, and it worked. However, this time I want to do the project without PWM and with the CyDelay.

Also, I tried testing out this problem with a single LED, that does not blink, nor uses CyDelay. There was no 30 second timeout for this. But when I added CyDelay, there was a 30 second timeout. I have also tried doing this on more than one devices (one Android and another iOS) and on both of them the problem was still there.

Additionally, in the BLE component (in Top Design), I went to the Tab saying 'Gap Settings', and tried changing/disabling the Connection Supervision timeout, but still the problem was present.

Does anyone know how to fix this problem, so that I could use CyDelay and have no 30 second disconnect with the Android Device?

0 Likes
1 Solution
Anonymous
Not applicable

Like user_1377889​ said, the CyDelay doesn't allow code to run while it is "delaying".

Using a timer to interrupt and toggle the LED, using the PWM (like you had before), or setting up a WDT to interrupt and toggle the LED on the WDT interrupt.

You could try to use CyDelay for small ms counts of say 1-5 ms, and then keep count of how many delays have passed before toggling the LED, but I would highly advise against that, as the cydelay would be delayed itself by other code running and BLE processing, leading to very wildly varying timing. (But hey, if you can't get things working, getting it working a little bit is better than nothing)

View solution in original post

0 Likes
2 Replies
Bob_Marlowe
Expert II

CyDelay() uses up all the CPU time during the delay. So the chip is not responsive and will not answer to BLE requests during that time. This will cause the disconnection.

Ways out are:

Start a timer wich, when expired (interrupt), toggles the LED

Use a PWM  to make the LED blink

Bob

0 Likes
Anonymous
Not applicable

Like user_1377889​ said, the CyDelay doesn't allow code to run while it is "delaying".

Using a timer to interrupt and toggle the LED, using the PWM (like you had before), or setting up a WDT to interrupt and toggle the LED on the WDT interrupt.

You could try to use CyDelay for small ms counts of say 1-5 ms, and then keep count of how many delays have passed before toggling the LED, but I would highly advise against that, as the cydelay would be delayed itself by other code running and BLE processing, leading to very wildly varying timing. (But hey, if you can't get things working, getting it working a little bit is better than nothing)

View solution in original post

0 Likes