HOW TO GET "SysTick" Value

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SuCh_2227511
Level 3
Level 3
First like received First like given

Hello,

   

I am working on BLE MIDI project using 042-BLE-A kit and needed to implement 13 bit time stamp whenever BLE packet sent per the protocol but it is working well though by just increasing like timeStamp++. But wanted to get actual time stamp using systick timer value every 100us by calling below function. I don't need interrupt.

   

static uint16 getTimeStamp(void)
{
    return timeStamp = ~(CySysTickGetValue());
}

   

 

   

To do that I added below line in main.c to start SysTick Timer.

   

CySysTickEnable();

   

CySysTickSetReload(2400); //by CY_BOOT_Component v5.5 p98; Sysytem clock(Hz) x desired interrupt interval(us)
       
CySysTickClear();

   

 

   

But after changing my firmware, BLE connection is not recognized.

   

So I deleted the last three lines then BLE connection works and found the CySysTickEnable() was blocking the BLE connection at least.

   

Can anyone explain why it happens and how to get SysTick value flawlessly......? Or Should I use a Timer component...?

0 Likes
1 Solution
Anonymous
Not applicable

As far as I could tell, the WDT uses the low frequency clock, so if you are already going to have a LFCLK running for either the BLE module, or another peripheral (e.g. another WDT), then there should be no power difference. I'm not sure what the power effects for the DMA are, but you can always test the difference between having it on and off for current draw; The WDT should run while the unit is in deep-sleep or sleep; If you are using it to interrupt, then it will wakeup the unit from sleep or deep sleep mode.

   

I haven't used the systick either, as it seemed like it was merely a cypress-defined implementation of a general timer, which I didn't need for my application. Similar to a RTC, but based on the system clock.

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

Check out this thread where people use the sys timer, might be useful:

   

http://www.cypress.com/forum/psoc-community-components/systimers-component?page=1

0 Likes
SuCh_2227511
Level 3
Level 3
First like received First like given

Thanks for reply. I had read most of documents and code examples about systick but I couldn't make it work due to my lack of understanding.

   

SoI implemented the function using watchdog timer with DMA, it was super easier and simpler for me. But I am not sure what is the side effect when using WDT already when I design low power mode. And thought?

0 Likes
Anonymous
Not applicable

As far as I could tell, the WDT uses the low frequency clock, so if you are already going to have a LFCLK running for either the BLE module, or another peripheral (e.g. another WDT), then there should be no power difference. I'm not sure what the power effects for the DMA are, but you can always test the difference between having it on and off for current draw; The WDT should run while the unit is in deep-sleep or sleep; If you are using it to interrupt, then it will wakeup the unit from sleep or deep sleep mode.

   

I haven't used the systick either, as it seemed like it was merely a cypress-defined implementation of a general timer, which I didn't need for my application. Similar to a RTC, but based on the system clock.

0 Likes