Skip to content

QSPI driver double call qspi_init() #12678

@dustin-crossman

Description

@dustin-crossman

Description of defect

In QSPI::_initialize mbed::QSPI will call the target specific qspi_init() once. Later, if QSPI::_acquire() gets called (which it does in QSPI::read(), QSPI::write(), etc) qspi_init() will be called again. A better description of the issue is here: #11230 (Also note that there is still no documentation regarding this).

There seems to be 2 ways to resolve this:

  1. Completely remove _acquire() and the drivers concept of ownership completely.
  2. Maintain the drivers concept of ownership and explicitly document the implications and requirements in the QSPI porting guide.

In the meantime I believe there is a way to partially mitigate the issue:
In QSPI::_intialize (and _initialize_direct) the _initialized field is being set to true but the _owner field is not. Since _owner is false upon the first read/write call, _acquire() and therefore _initialize() will be called again even if no other QSPI object acquired ownership in the meantime. I think this is a bug regardless of the approach taken to fix this issue and is an easy fix.

I'm happy to put in a PR for the mitigation but I'd also like to see this resolved properly one way or the other.

Target(s) affected by this defect ?

All

Toolchain(s) (name and version) displaying this defect ?

All

What version of Mbed-os are you using (tag or sha) ?

539cf3f

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

N/A

How is this defect reproduced ?

Any use of QSPI driver will reproduce this defect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions