I am still trying to figure out if it worked like this without setting the RVR, by real counting (it shouldn't), or just by mere luck (like running random code as a delay). WS2812 timings are roughly around 400 ns or 30-40 processor clock cycles. Also, the Arm's SysTick implementation is the same on M0+ and M33.
I use systick on the rp2040 to time short periods e.g. WS2812 timings
On the RP2040 and on every STM32 I've tried the following works:so if I want a pause of say 100 clock cycles I call shortpause(0xFFFFFF - 100 + calling fudge factor)Code:
#define shortpause(a){systick_hw->cvr=0;while(systick_hw->cvr>a){};}
...
To fix this I have usedand it is now reliableCode:
#define shortpause(a){systick_hw->cvr=0;asm("NOP");asm("NOP");asm("NOP");asm("NOP");asm("NOP");while(systick_hw->cvr>a){};}
Statistics: Posted by gmx — Wed Sep 04, 2024 9:47 pm