Hello, I'm facing this error and I don't know what to do.
I'm tryng to set the frequency of my code is a simple one, just until I find what is wrong. I'm trying to set HSI to 8Mhz (I know it's 16Mhz).
I have been using these as a guide but it's not working:
Please help me I don't know what else to do.
Here is my code:
#![no_std]
#![no_main]
use defmt::*;
use embassy_executor::Spawner;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::Timer;
use embassy_stm32::{Config};
use {defmt_rtt as _, panic_probe as _};
use embassy_stm32::rcc::Hsi;
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
// Inicializar com configuração de clock HSI
let p = embassy_stm32::init(Config {
hsi: true,
sys: Sysclk::HSI,
ahb_pre: AHBPrescaler::DIV2,
..Default::default()
});
// Configuração do pino do LED
let mut led = Output::new(p.PB7, Level::High, Speed::Low);
loop {
info!("high");
led.set_high();
Timer::after_millis(300).await;
info!("low");
led.set_low();
Timer::after_millis(300).await;
}
}
please describe what actually went wrong and what the error is: is it a compile error, or the LED blinks at different frequency than expected, or it didn't blink at all?
error[E0432]: unresolved import `embassy_stm32::rcc::Hsi`
--> src/main.rs:10:5
|
10 | use embassy_stm32::rcc::Hsi;
| ^^^^^^^^^^^^^^^^^^^^^^^ no `Hsi` in `rcc`
error[E0433]: failed to resolve: use of undeclared type `AHBPrescaler`
--> src/main.rs:19:18
|
19 | ahb_pre: AHBPrescaler::DIV2,
| ^^^^^^^^^^^^ use of undeclared type `AHBPrescaler`
|
help: consider importing this enum
|
4 + use embassy_stm32::rcc::AHBPrescaler;
|
error[E0639]: cannot create non-exhaustive struct using struct expression
--> src/main.rs:16:33
|
16 | let p = embassy_stm32::init(Config {
| _________________________________^
17 | | hsi: true,
18 | | sys: Sysclk::HSI,
19 | | ahb_pre: AHBPrescaler::DIV2,
20 | | ..Default::default()
21 | | });
| |_____^
error[E0560]: struct `embassy_stm32::Config` has no field named `hsi`
--> src/main.rs:17:9
|
17 | hsi: true,
| ^^^ `embassy_stm32::Config` does not have this field
|
= note: available fields are: `rcc`, `enable_debug_during_sleep`, `bdma_interrupt_priority`
error[E0560]: struct `embassy_stm32::Config` has no field named `sys`
--> src/main.rs:18:9
|
18 | sys: Sysclk::HSI,
| ^^^ `embassy_stm32::Config` does not have this field
|
= note: available fields are: `rcc`, `enable_debug_during_sleep`, `bdma_interrupt_priority`
error[E0433]: failed to resolve: use of undeclared type `Sysclk`
--> src/main.rs:18:14
|
18 | sys: Sysclk::HSI,
| ^^^^^^ use of undeclared type `Sysclk`
error[E0560]: struct `embassy_stm32::Config` has no field named `ahb_pre`
--> src/main.rs:19:9
|
19 | ahb_pre: AHBPrescaler::DIV2,
| ^^^^^^^ `embassy_stm32::Config` does not have this field
|
= note: available fields are: `rcc`, `enable_debug_during_sleep`, `bdma_interrupt_priority`
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0432, E0433, E0560, E0639.
For more information about an error, try `rustc --explain E0432`.
Error Failed to run cargo build: exit code = Some(101).