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

Problem with embassy_stm32::ospi::Ospi::new_* #2926

Open
pkoevesdi opened this issue May 10, 2024 · 6 comments
Open

Problem with embassy_stm32::ospi::Ospi::new_* #2926

pkoevesdi opened this issue May 10, 2024 · 6 comments

Comments

@pkoevesdi
Copy link
Contributor

I have problems creating a new OSPI driver for a quadspi external chip. I get
the trait 'embassy_stm32::ospi::*<embassy_stm32::peripherals::OCTOSPI1>' is not implemented for '*' for all 6 Pins. Am I doing something wrong here or is it a bug?
I try it with the current git version of embassy.

If I look at https://github.com/embassy-rs/embassy/blob/main/examples/stm32f7/src/bin/qspi.rs, I think I have cooked it down and abstracted from the mcu- and flash-specific parts.
Also, I see the function

pub fn new_bk1(

equivalent to
pub fn new_quadspi(

so I assume, I can use the qspi example as a pattern for ospi too?

That's the minimal code which I'd expect to build:

#![no_std]
#![no_main]

use embassy_executor::Spawner;
use embassy_stm32::dma::NoDma;
use embassy_stm32::ospi::{Config, Ospi};
use panic_probe as _;

#[embassy_executor::main]
async fn main(_spawner: Spawner) {

    let p = embassy_stm32::init(Default::default());
    let mut config = Config::default();

   let qspi = Ospi::new_quadspi(
        p.OCTOSPI1, p.PA3, p.PC9, p.PC10, p.PE2, p.PA6, p.PC11, NoDma, config,
    );

}
@pkoevesdi
Copy link
Contributor Author

@Mirror0
Copy link
Contributor

Mirror0 commented May 10, 2024

I brefly check the stm32-data-generated file you provided and compare it to QSPI declarations with STM32F7 board that I used.

I see some differences:

  • Names in pin_trait_impl section of build.rs are different in provided H7 file for OSPI pins then compared to corresponding QSPI pins for F7 board.
    (("octospi", "IO0"), quote!(crate::ospi::D0Pin)),

    Example:
    F7 board has BK1_I03 pin as PA1 under qspi section and there is BK1_I03 under qspi in build.rs, but H7 board has P1_CLK pin as PA3 under octospim but in ospi there's only CLK.
  • Additionally in H7 file pins that you pointed are under octospim registry kind in opposition to F7 file where QSPI pins are under qspi register kind which corresponds with naming in build.rs. This also may be a problem as above the pin_trait_impl section there is this comment (kind, signal) => trait, I guess the kind is from registers section and signal is from pins section

This can be the cause for not implemented error, but I'm not knowledgeable about embassy build process and embedded programming to answer this with certainty.

@pkoevesdi
Copy link
Contributor Author

Thanks for the hints, I'll follow them. But actually, this looks like something that @Dirbaio has to look at, doesn't it?

@Mirror0
Copy link
Contributor

Mirror0 commented May 10, 2024

I think it would be best if he takes a look at this, as he is more experienced in this field :)

@pkoevesdi
Copy link
Contributor Author

pkoevesdi commented May 10, 2024

So, it seems to be about the OCTOSPI manager that sits between the physical pins i.e.:

OCTOSPIM_P1_ CLK
OCTOSPIM_P1_IO0
OCTOSPIM_P1_IO1
OCTOSPIM_P1_IO2
OCTOSPIM_P1_IO3
OCTOSPIM_P1_NCS

and the internal OCTOSPI1 virtual port.
In reset state, the both are mapped 1:1 (and I'd totally appreciate if it would work even only in this state).

From the reference manual, p. 964:
grafik

@pkoevesdi
Copy link
Contributor Author

pkoevesdi commented May 11, 2024

Here I accidently found a micropython guy addressing the same issue, seemingly:
micropython/micropython#12517
May that helps for embassy too?

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

2 participants