cancel
Showing results for 
Search instead for 
Did you mean: 

[QUESTION] About machine cycle of STM32 and STM8

croket_2512
Associate II
Posted on January 06, 2015 at 10:30

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!
4 REPLIES 4
Uwe Bonnes
Principal III
Posted on January 06, 2015 at 10:59

For the STM32 it is one clock per cycle.

Danish1
Lead II
Posted on January 06, 2015 at 14:51

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!

croket_2512
Associate II
Posted on January 08, 2015 at 02:13

Thanks a lot! And can you tell me how many machine cycles does it take to make an instruction?

AvaTar
Lead
Posted on January 08, 2015 at 09:02

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.