cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

New Contributor II

Hi,

I am using the delay function provided by wiced_gki.h, which provides a microsecond delay function, void wiced_gki_delay_us(uint32_t delay).

I found however that this function often fails and creates a stack overflow when the delay is greater than about 1s, which is less than the maximum delay a uint32_t value could be. If there is a maximum which is below the variable's maximum this should probably be provided in the documentation/comments. If not, is there a reason this may be failing for larger values but works perfectly fine, even for values up to 0.5s?

Thanks,

Ryan

0 Likes
Reply
1 Solution
New Contributor II

I would totally agree, embedded devices (especially with RTOS and such) do not normally have any reason for long delays. However the device actually only has one onboard timer which is already in use, so it is rather limited for using many different timed events. It is okay though, I have found a way around it, it just seems like there is a problem somewhere in the code/stack that is making it fail when it should not.

View solution in original post

0 Likes
Reply
4 Replies
Moderator
Moderator

Which device and the SDK version are you using?

Could you try the API utilslib_delayUs(UINT32 delay)?

0 Likes
Reply
New Contributor II

I am using the SDK version 1.3 with the CYW20819 eval board. I attempted using the other api, however I still came across this problem. Interestingly, I tried just using a for loop with it to force the delay time. When doing this it seems to work, but somewhat inconsistently. I checked what else is going on and it seems that it has a problem while the Bluetooth is scanning. When it has finished scanning, the multiple short delays have no problem, although a single long delay still does not work.

Let me know if you want me to try something else!

Thanks,

Ryan

0 Likes
Reply
Moderator
Moderator

Why do you need the delay function? Could you start a timer for 1s and process your task in the timer callback?

0 Likes
Reply
New Contributor II

I would totally agree, embedded devices (especially with RTOS and such) do not normally have any reason for long delays. However the device actually only has one onboard timer which is already in use, so it is rather limited for using many different timed events. It is okay though, I have found a way around it, it just seems like there is a problem somewhere in the code/stack that is making it fail when it should not.

View solution in original post

0 Likes
Reply