I have potentially detected a Cy_SysTick_GetCountFlag() Issue.
Problem: Cy_SysTick_GetCountFlag() inconsistently reports a SysTick counter reached 0 count.
Attached is a MTB project highlighting the issue.
- Targeted for the CY8CPROTO-063-BLE although any PSoC6 board will suffice.
- Uses retarget-io to the standard debug terminal @ 115.2Kbps.
- Sets up a SysTick with:
- CLK_LF as the source (CLK_LF routed to WCO)
- Reload = (1<<16)-1 = 65535. This is to have the wrap-around for the SysTick every 2 secs.
- Callback is Set.
- Cy_SysTick_GetCountFlag() called in for(;;) loop
The code is very simple.
If the systick_wrap variable is incremented in the Callback ISR, "SysTick counter wrapped!" is printed to the terminal.
If the getcount_flag variable is incremented in the Callback ISR, "GetCount_Flag received!" is printed to the terminal.
The optimum result is that every 2 secs the terminal should have:
SysTick counter wrapped!
Every 2 secs, either "SysTick counter wrapped!" OR "GetCount_Flag received!" is printed.
If I comment out lines 133-136 in main.c (disabling the Cy_SysTick_GetCountFlag() call and leaving the Callback enabled)
I get "SysTick counter wrapped!" EVERY 2 secs!
If I comment out line 112 in main.c (disabling the Callback but enabling the Cy_SysTick_GetCountFlag() call)
I get "GetCount_Flag received!" erratically.
I realize some SysTick API calls clear the Count flag as a side-effect. Once in the for(;;) loop, Only the Callback and the Cy_SysTick_GetCountFlag() is called.
Message was edited by: Len This issue has been reproduced in PSoC Creator as well. Project Attached.