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

Cannot create ospi instance for stm32h7b0 #3097

Closed
HaoboGu opened this issue Jun 19, 2024 · 4 comments · Fixed by #3102
Closed

Cannot create ospi instance for stm32h7b0 #3097

HaoboGu opened this issue Jun 19, 2024 · 4 comments · Fixed by #3102

Comments

@HaoboGu
Copy link
Contributor

HaoboGu commented Jun 19, 2024

I'm trying to use stm32h7b0's octospi peripheral as the following:

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    let ospi_config = ospi::Config::default();

    let ospi = Ospi::new_quadspi(
        p.OCTOSPI1,
        p.PA3,
        p.PC9,
        p.PD12,
        p.PE2,
        p.PD13,
        p.PB6,
        p.MDMA,
        ospi_config,
    );
}

But the compiler reports all the pins are not impl for OCTOSPI1. I checked the stm32-data-generated, it seems that the pins are defined in OCTOSPIM peripheral, but not OCTOSPI1 and OCTOSPI2:

https://github.com/embassy-rs/stm32-data-generated/blob/e30c7694016fa9a326f153fff84dedb0c02b8676/data/chips/STM32H7B0VB.json#L4147-L4235

However, Ospi::new_quadspi doesn't accept p.OCTOSPIM as the peri. Is there any method to fix it?

---- Attached: parts of the compiler error

error[E0277]: the trait bound `PA3: embassy_stm32::ospi::SckPin<embassy_stm32::peripherals::OCTOSPI1>` is not satisfied
   --> src/main.rs:114:20
    |
114 |       let mut ospi = Ospi::new_quadspi(
    |  ____________________^
115 | |         p.OCTOSPI1,
116 | |         p.PA3,
117 | |         p.PC9,
...   |
123 | |         ospi_config,
124 | |     );
    | |_____^ the trait `embassy_stm32::ospi::SckPin<embassy_stm32::peripherals::OCTOSPI1>` is not implemented for `PA3`
    |
note: required by a bound in `Ospi::<'d, T, embassy_stm32::mode::Async>::new_quadspi`
   --> C:\Users\haobo\.cargo\git\checkouts\embassy-9312dcb0ed774b29\b0172bb\embassy-stm32\src\ospi\mod.rs:785:39
    |
783 |     pub fn new_quadspi(
    |            ----------- required by a bound in this associated function
784 |         peri: impl Peripheral<P = T> + 'd,
785 |         sck: impl Peripheral<P = impl SckPin<T>> + 'd,
    |                                       ^^^^^^^^^ required by this bound in `Ospi::<'d, T, Async>::new_quadspi`

error[E0277]: the trait bound `PC9: embassy_stm32::ospi::D0Pin<embassy_stm32::peripherals::OCTOSPI1>` is not satisfied
   --> src/main.rs:114:20
    |
114 |       let mut ospi = Ospi::new_quadspi(
    |  ____________________^
115 | |         p.OCTOSPI1,
116 | |         p.PA3,
117 | |         p.PC9,
...   |
123 | |         ospi_config,
124 | |     );
    | |_____^ the trait `embassy_stm32::ospi::D0Pin<embassy_stm32::peripherals::OCTOSPI1>` is not implemented for `PC9`
    |
note: required by a bound in `Ospi::<'d, T, embassy_stm32::mode::Async>::new_quadspi`
   --> C:\Users\haobo\.cargo\git\checkouts\embassy-9312dcb0ed774b29\b0172bb\embassy-stm32\src\ospi\mod.rs:786:38
    |
783 |     pub fn new_quadspi(
    |            ----------- required by a bound in this associated function
...
786 |         d0: impl Peripheral<P = impl D0Pin<T>> + 'd,
    |                                      ^^^^^^^^ required by this bound in `Ospi::<'d, T, Async>::new_quadspi`

error[E0277]: the trait bound `PD12: embassy_stm32::ospi::D1Pin<embassy_stm32::peripherals::OCTOSPI1>` is not satisfied
   --> src/main.rs:114:20
    |
114 |       let mut ospi = Ospi::new_quadspi(
    |  ____________________^
115 | |         p.OCTOSPI1,
116 | |         p.PA3,
117 | |         p.PC9,
...   |
123 | |         ospi_config,
124 | |     );
    | |_____^ the trait `embassy_stm32::ospi::D1Pin<embassy_stm32::peripherals::OCTOSPI1>` is not implemented for `PD12`
    |
note: required by a bound in `Ospi::<'d, T, embassy_stm32::mode::Async>::new_quadspi`
   --> C:\Users\haobo\.cargo\git\checkouts\embassy-9312dcb0ed774b29\b0172bb\embassy-stm32\src\ospi\mod.rs:787:38
@Dirbaio
Copy link
Member

Dirbaio commented Jun 19, 2024

OCTOSPIM is a new peripheral that sits on top of OSPI1 and OSPI2 and does some kind of pin muxing. So, fixing this requires adding support in embassy-stm32 for configuring the OCTOSPIM I think.

@HaoboGu
Copy link
Contributor Author

HaoboGu commented Jun 19, 2024

OCTOSPIM is a new peripheral that sits on top of OSPI1 and OSPI2 and does some kind of pin muxing. So, fixing this requires adding support in embassy-stm32 for configuring the OCTOSPIM I think.

Is there any reference about doing this type of configuring? I'd like to fix it if possible

@Dirbaio
Copy link
Member

Dirbaio commented Jun 19, 2024

check the Reference Manual for your chip, it explains how OCTOSPIM works.

@HaoboGu
Copy link
Contributor Author

HaoboGu commented Jun 19, 2024

check the Reference Manual for your chip, it explains how OCTOSPIM works.

Should I implement a separate peripheral ospim, or just update current ospi?

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

Successfully merging a pull request may close this issue.

2 participants