Skip to content

Update QSPI porting guide #676

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

Merged
merged 3 commits into from
Aug 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions docs/reference/contributing/target/QuadSPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Implementing QSPI enables Mbed OS to communicate with external memories much fas

The most common use case is an external memory to use as additional data storage.

<span class="warnings">**Warning:** We are changing the QSPI HAL API in an upcoming release of Mbed OS. This page documents code that exists on a feature branch of Mbed OS. You can find details on how it may affect you in the [Implementing the QSPI API](#implementing-quadspi) section.</span>

### Assumptions

#### Defined behavior
Expand All @@ -29,6 +27,29 @@ To make sure your platform is ready for the upcoming changes, you need to implem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: Can we delete or change the warning in line 7?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code was merged it looks like, should be good to remove that warning,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnotherButler warning was removed

The target needs to define the `qspi_s` structure - target specific QSPI object.

The target needs to define the QSPI interface pin names:

- `QSPI_FLASHn_XXX` for pins connected to onboard flash memory.
- `QSPIn_XXX` for pins routed out to external connector.

`n` is the interface index, typically `1` if single QSPI interface available.

```
QSPIn_IO0
QSPIn_IO1
QSPIn_IO2
QSPIn_IO3
QSPIn_SCK
QSPIn_CSN

QSPI_FLASHn_IO0
QSPI_FLASHn_IO1
QSPI_FLASHn_IO2
QSPI_FLASHn_IO3
QSPI_FLASHn_SCK
QSPI_FLASHn_CSN
```

Functions to implement:

```
Expand All @@ -41,7 +62,7 @@ qspi_status_t qspi_read(qspi_t *obj, const qspi_command_t *command, void *data,

```

Use `qspi_write` and `qspi_read` for data transfers. For communicating with a device, use `qspi_command_transfer`.
Use `qspi_write` and `qspi_read` for data transfers. To communicate with a device, use `qspi_command_transfer`.

To enable the QSPI HAL, define `QSPI` in the targets.json file inside `device_has`:

Expand All @@ -53,4 +74,12 @@ To enable the QSPI HAL, define `QSPI` in the targets.json file inside `device_ha

### Testing

To be implemented
The Mbed OS HAL provides a set of conformance tests for the QSPI interface.

<span class="notes">**Note:** QSPI HAL tests require QSPI Flash pins to be defined.</span>

You can use these tests to validate the correctness of your implementation. To run the QSPI HAL tests, use the following command:

```
mbed test -t <toolchain> -m <target> -n tests-mbed_hal-qspi
```