Cascoda / cascoda-sdk

The Cascoda Software Development Kit for utilizing the CA-8211 and CA-8210
BSD 3-Clause "New" or "Revised" License
16 stars 5 forks source link

vTaskDelay() shorter as expected #4

Closed taraskornuta closed 3 years ago

taraskornuta commented 3 years ago

Hi I try to use vTaskDelay() inside the thread loop and I note that the delay is shorter than I expected. All FreeRTOS configs are default (as was defined in Cascoda-SDK). The MCU clock is 48000000

I connect the logic analyzer and fetch the data from gpio. And the period between pin toggling was around 250ms vTaskDelay(pdMS_TO_TICKS(1000)); I try to adjust configTICK_RATE_HZ but it didn't give a positive result.

The second thing is in cascoda_wait.c have a function WAIT_ms() which is also used in RTOS examples. This function blocks RTOS context switching. I believe this function should take into account using OS or bare-metal I replace BSP_WaitTicks() with vTaskDelay() and my project start to work smother. At liest, the logs start to prints when I expect them. Thank's

CiaranWoodward commented 3 years ago

Hi @taraskornuta, I managed to reproduce the issue and have a fix in #5 . Please could you let me know if that fixes the issue for you?

For WAIT_ms, yes, we do intend to make this (and other parts of the SDK) more rtos-aware so it can be more performant, but the work isn't scheduled right now. It will definitely aim to get rid of the busy-waiting when in an RTOS environment. I'll let you know when we get it out.

taraskornuta commented 3 years ago

Hi @CiaranWoodward I checked the fixes, it work's fine Thank's