Skip to content

Qspi flash pin names standardization #7639

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

Conversation

maciejbocianski
Copy link
Contributor

Description

Normalize QSPI flash pin names to new format:

  • QSPI_FLASH1_XXX for targets with flash onboard
  • QSPI1_XXX for targets with no flash onboard (to be discussed)

Some targets support Dual-Flash, hence added port indexing (1, 2) to distinct which port is actually utilized

TODO:

Pull request type

[ ] Fix
[ ] Refactor
[ ] New target
[X] Feature
[ ] Breaking change

0xc0170 and others added 30 commits July 17, 2018 09:19
Adding new QSPI HAL header file. This should help to use memory-maped devices
as memories, graphical displays.

The API consist of few functions, most important are read/write/write_command functions.

The command format is:

```
----------------------------------------------
| Instruction | Address | Alt | Dummy | Data |
----------------------------------------------
```

We define only synch API at the moment.
Fixing by adding NONE values for both
This provides a way to return how many bytes have been written/read (as status codes
are returned via func ret value)
SPI mode means Clock polarity and phase mode (0 - 3)
This commit adds QSPI HAL implementation for nrf52840 MCU targets
if address is skipped, used size NONE
Not used anymore, not defined. ctor default initializes the object
Should be: instr, alt, address or inst, addr or just addr
If phase is being skipped, set disabled to true, otherwise false.
@maciejbocianski
Copy link
Contributor Author

maciejbocianski commented Jul 30, 2018

FYI @adustm @offirko @donatieng @0xc0170

@0xc0170 0xc0170 requested review from adustm, offirko and a team July 30, 2018 09:50
@maciejbocianski
Copy link
Contributor Author

@donatieng @jamesbeyond @0xc0170
What do you think about having only one naming scheme for QSPI pins (QSPI_FLASH1_XXX), whatever the availability of the on board flash

@offirko
Copy link
Contributor

offirko commented Jul 30, 2018

Hi Maciej - I've added you to a PR submitted yesterday for QSPI SFDP BlockDevice .
I've resolved in that PR the PIN layout per target with json config.
I'm not sure which is better .h or the json, please take a look .
Anyhow, I believe if we use this .h configuration the json will no longer be needed.

@0xc0170
Copy link
Contributor

0xc0170 commented Jul 30, 2018

target configuration , in this case it would be PinNames - being part of the target itself like LEDx, etc

Anyhow, I believe if we use this .h configuration the json will no longer be needed.

👍

@adustm
Copy link
Member

adustm commented Jul 30, 2018

Hello,
I agree to use PinNames.h to get generic pin names that can be used in tests, for platforms that have a flash memory connected to qspi pins.

QSPI1_XXX for targets with no flash onboard (to be discussed)
I would not use a generic pin name for boards that don't have a flash memory on it.
For such platforms, the user will be able to use official pin names, that are defined in PeripheralPins.c directly.
Refer to


NUCLEO_L476RG platform does not have a QSPI flash memory on it. If user wants to connect a QSPI memory on it, he will be able to use PA_6 / PB_11 etc...

won't he ?
Maybe your request it not clear to me.
Kind regards

@donatieng
Copy link
Contributor

donatieng commented Jul 30, 2018

Hi @maciejbocianski, for platforms with onboard flash, could we also have a QSPI_FLASH_COUNT definition to be able to test for correct macro defines for boards with more than 1 QSPI chip?

Standard pin names (QSPI1_IO0, etc) should be given to all targets (including the ones with onboard flash).

What do you think about having only one naming scheme for QSPI pins (QSPI_FLASH1_XXX), whatever the availability of the on board flash.

I think we need to be very clear on whether pins names refer to a peripheral on the MCU or to pins connected to an on-board memory chip.

@adustm

NUCLEO_L476RG platform does not have a QSPI flash memory on it. If user wants to connect a QSPI memory on it, he will be able to use PA_6 / PB_11 etc...

I think having standard naming where possible would help in many standard cases and avoid confusion.

QSPIFlash flash(QSPI1_SCK, QSPI1_IO0, ...) feels more readable than QSPIFlash flash(PE_6, PB_3, ...).

@maciejbocianski
Copy link
Contributor Author

maciejbocianski commented Jul 31, 2018

@donatieng
Not sure if QSPI_FLASH_COUNT is worth adding since the max config is two memory chips (so QSPI2_IO0 will be the max)
I haven't seen similar approach in any other interface in mbed

So finally we will have

For all QSPI capable target:

    QSPI1_IO0 = PD_11,
    QSPI1_IO1 = PD_12,
    QSPI1_IO2 = PE_2,
    QSPI1_IO3 = PD_13,
    QSPI1_SCK = PB_2,
    QSPI1_CSN = PB_6,
    // for dual QSPI inteface
    QSPI2_IO0 = XX,
    QSPI2_IO1 = XX,
    ...

all target with onboard memory will additionally define:

    QSPI_FLASH1_IO0 = QSPI1_IO0,
    QSPI_FLASH1_IO1 = QSPI1_IO1,
    QSPI_FLASH1_IO2 = QSPI1_IO2,
    QSPI_FLASH1_IO3 = QSPI1_IO3,
    QSPI_FLASH1_SCK = QSPI1_SCK,
    QSPI_FLASH1_CSN = QSPI1_CSN,
    // for dual QSPI flash onboard
    QSPI_FLASH2_IO0 = QSPI2_IO0,
    QSPI_FLASH2_IO1 = QSPI2_IO1,
    ...

@bulislaw
Copy link
Member

bulislaw commented Aug 2, 2018

I agree, we should aim to provide users with default pin names for all interfaces. On top of that having pins defined for on board memory and sdcards etc should be a good idea. As for "count" i'm not sure how useful it is, how would that be used?

@donatieng
Copy link
Contributor

@maciejbocianski @bulislaw my rationale behind QSPI_FLASH_COUNT is that it gives us the ability to test that pin names are properly defined

@maciejbocianski
Copy link
Contributor Author

use case:

#if DEVICE_QSPI
	// use/test QSPI_FLASH1_XXX
	#if QSPI_FLASH_COUNT == 2
		// use/test use QSPI_FLASH2_XXX
	#endif
#endif

@cmonr
Copy link
Contributor

cmonr commented Aug 14, 2018

@maciejbocianski @donatieng @bulislaw Is there any more work ongoing with this?

@maciejbocianski
Copy link
Contributor Author

Since qspi feature branch will be merged to master soon (#7783).
This PR will be closed and work will be moved to new one

@adbridge
Copy link
Contributor

@maciejbocianski please close this if it is no longer needed. Thanks.

@maciejbocianski
Copy link
Contributor Author

Further work moved to #7817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants