Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4840

SDK • Re: RP2350: systick gotcha - FYI

$
0
0
Correct hence the code

Code:

#define shortpause(a){systick_hw->cvr=0;(void)systick_hw->cvr;while(systick_hw->cvr>a){};}
Though perhaps my explanation was lacking/missing :-)
I would do something like this:

Code:

    systick_hw->csr = 0b101;    // set to use processor clock + enable    systick_hw->rvr = a;        // set RVR with number of cycles (adjusted accordingly)    systick_hw->cvr = 0;        // clears CVR, then loads from RVR at next clock    systick_hw->rvr = 0;        // automatically stops the counter at the next wrap, when reaches 0     while(systick_hw->cvr);     // waits until CVR becomes 0
Tried in debugger, but need some more tests.
Do you know another reliable and simple processor cycle counter ? DWT_CYCCNT ?
The debugger doesn't stop the counter immediately, now on RP2350 it adds 11 more processor clocks to this counter at every break (probably by running the break itself).

Statistics: Posted by gmx — Wed Sep 04, 2024 10:09 pm



Viewing all articles
Browse latest Browse all 4840

Trending Articles