Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clock Configuration for USB #3293

Open
jas1339 opened this issue Aug 28, 2024 · 0 comments
Open

Clock Configuration for USB #3293

jas1339 opened this issue Aug 28, 2024 · 0 comments

Comments

@jas1339
Copy link

jas1339 commented Aug 28, 2024

I was trying to follow the usb_serial.rs example for STM32H7 and my computer wasn't detecting the usb. I made sure to set vbus_detection to false. I think the issue is with the rcc config and wasn't sure how to setup the rcc config while having an HSE of 48Mhz.

        config.rcc.hse = Some(Hse{ freq: Hertz::mhz(48), mode: HseMode::Oscillator });
        config.rcc.ls.lse = Some(LseConfig{ frequency: Hertz::khz(32), mode: LseMode::Oscillator(LseDrive::High) }); 
      
        config.rcc.pll1 = Some(Pll {
            source: PllSource::HSE,
            prediv: PllPreDiv::DIV4,
            mul: PllMul::MUL49,
            divp: Some(PllDiv::DIV2),
            divq: Some(PllDiv::DIV8), // SPI1 cksel defaults to pll1_q
            divr: None,
        });
        config.rcc.pll2 = Some(Pll {
            source: PllSource::HSE,
            prediv: PllPreDiv::DIV8,
            mul: PllMul::MUL50,
            divp: Some(PllDiv::DIV4), // 100mhz
            divq: None,
            divr: None,
        });
        config.rcc.sys = Sysclk::PLL1_P; // 400 Mhz
        config.rcc.ahb_pre = AHBPrescaler::DIV2; // 200 Mhz
        config.rcc.apb1_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb2_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb3_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.apb4_pre = APBPrescaler::DIV2; // 100 Mhz
        config.rcc.voltage_scale = VoltageScale::Scale1;
        config.rcc.mux.adcsel = mux::Adcsel::PLL2_P; 
        config.rcc.mux.usbsel = mux::Usbsel::PLL1_Q;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant