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)
If I do this on the RP2350 the code nearly always returns immediately. In other words, despite systick_hw->cvr being volatile it is not being seen as set before the while loop tests the value.
To fix this I have used
and it is now reliable
On the RP2040 and on every STM32 I've tried the following works:
Code:
#define shortpause(a){systick_hw->cvr=0;while(systick_hw->cvr>a){};}
If I do this on the RP2350 the code nearly always returns immediately. In other words, despite systick_hw->cvr being volatile it is not being seen as set before the while loop tests the value.
To fix this I have used
Code:
#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 matherp — Sat Aug 31, 2024 5:42 pm