Skip to main content
croket_2512
Associate
January 6, 2015
Question

[QUESTION] About machine cycle of STM32 and STM8

  • January 6, 2015
  • 4 replies
  • 1122 views
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!
    This topic has been closed for replies.

    4 replies

    Uwe Bonnes
    Chief
    January 6, 2015
    Posted on January 06, 2015 at 10:59

    For the STM32 it is one clock per cycle.

    Danish1
    Lead III
    January 6, 2015
    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
    January 8, 2015
    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
    Senior III
    January 8, 2015
    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.