I am quite new to CortexM3, so I am not sure what is the best approach to achieve microseconds delay. What I did on ARM7 and some 8-bit processors, is "waste time loops" in assembler which do some NOPs and tweak it with oscilloscope for certain osc freq. But with enabling PLL on CortexM3 I am wondering if I could achieve same with timers ? If I set PLL to get 120Mhz, will my timer work at that freq or at base freq of 20Mhz as osc ?
Thanks.
It's up to you to figure out what timers you can use.
But notice that a single timer can solve many problems if you use it free-running instead of using the auto-reset feature.
Then you can use it to create 1ms or 1s interrupts or whatever you need and at the same time do software delays with maybe 0.05 us resolution. If the ISR is ready to check which match register that produced the interrupt, then you can have that same timer create up to four periodic interrupts - each with different frequency.
In the end, it's just a question of if you are willing to reprogram match registers in the ISR.
The SysTick counter is 24-bit and counts backward as I recall. Check if your part implements the optional DWT_CYCCNT register, it's 32-bit wide, and clocks at processor speed. At 120 MHz that would wrap just shy of 36 seconds.
infocenter.arm.com/.../index.jsp
embeddedb.blogspot.com/.../how-to-count-cycles-on-arm-cortex-m.html