2015-01-06 01:30 AM
Hello,
I want to ask you a question. How many crystal cycles make up a machine cycle are in STM32 and STM8? For example, in 8051, 12 crystal cycles make up 1 machine cycle. Thank you!2015-01-06 01:59 AM
For the STM32 it is one clock per cycle.
2015-01-06 05:51 AM
There's an added complication in that most STM32 have a Phase-Locked-Loop between the crystal and the processor clock (the ARM processor does one machine cycle per processor clock).
This Phase-Locked-Loop can multiply the crystal frequency by a programmable ratio to generate the processor clock. So (for example) you can use an 8 MHz crystal and then multiply this up to generate a 72 MHz processor clock. And then you'll have 9 machine cycles executed per crystal cycle!2015-01-07 05:13 PM
Thanks a lot! And can you tell me how many machine cycles does it take to make an instruction?
2015-01-08 12:02 AM
IMHO still the 'traditional' 4 cycles: Fetch, Decode, Execute, Store.
With pipelining (concurrent execution of multiple instructions, in different stages) it appears to be one cycle per instruction. Pipelining had been introduced in updates of older cores (like the Z80 and 8051), and I think the STM8 too (which, BTW, looks very similiar to the Z80, only the IX/IY regs missing ...). Only Microchip never made it for their PIC12/16/18 cores.