Skip to content
This repository was archived by the owner on Feb 13, 2019. It is now read-only.
This repository was archived by the owner on Feb 13, 2019. It is now read-only.

Clock source selection #38

Open
Open
@LunNova

Description

@LunNova

The CFGR builder API doesn't let you select a clock source.

Possible sources:

  • HSI (high speed internal) oscillator
  • HSI as source for PLL
  • HSE (high speed external) oscillator
  • HSE bypass
  • HSE as source for PLL

Currently it only uses the first two options.

Should set cr.hseon and wait for cr.hserdy before setting up PLL. Also HSEBYP if using a clock source and not a crystal.
cfgr.pllsrc().external() swaps to HSE as pll source. Probably want pllxtpre().no_div().

Maybe like this?

    let clocks: Clocks = rcc.cfgr
        .sysclk(72.mhz())
        .hclk(72.mhz())
        .pclk2(72.mhz())
        .pclk1(36.mhz())
// This by default?
//       .source().internal()
// pass frequency of external crystal
        .source().external(8.mhz())
// pass frequency of external clock
//      .source().external_bypass(8.mhz())
        .freeze(&mut flash.acr);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions