-
Notifications
You must be signed in to change notification settings - Fork 3k
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
QSPI : Define default pins at drivers level #11444
Conversation
@jeromecoutant, thank you for your changes. |
@@ -17,6 +17,16 @@ | |||
#ifndef MBED_FLASH_CONFIGS_H | |||
#define MBED_FLASH_CONFIGS_H | |||
|
|||
#define MX25R6435F 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this would need to be always enabled?
@@ -12,6 +12,24 @@ | |||
"spi_count_max": { | |||
"help": "The maximum number of SPI peripherals used at the same time. Determines RAM allocated for SPI peripheral management. If null, limit determined by hardware.", | |||
"value": null | |||
}, | |||
"qspi_io0": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have QSPI_FLASH1_IO0
and now introducing QSPI_FLASH1_IO0
?
Why are not these in PinNames and defined for all boards having QSPI? There are QSPI pins or not? They should provide default pins, that could be overriden in tests/apps via config. Is this what is it adding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goal is to use an external QSPI,
and add pins value in mbed_app.json file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand now. This is a new approach here in this drivers config. This brings QSPI definitions even for a board that does not have it. Shouldn' t this be by default null, not even created if not used , and a target would override it and set?
@maciejbocianski what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Goal of this approach is to be full compatible with current implementation.
There is no impact with current targets with and without QSPI pins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only impact having QSPI defined always even if QSPI is not available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 new define added and not used in the mbed_config.h file
#define QPIN_2 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO2) | ||
#define QPIN_3 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO3) | ||
#define QSCK static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_SCK) | ||
#define QCSN static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_CSN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was designed that tests-mbed_hal-qspi
uses default qspi interface available on dev boards.
This should look rather like below to maintain hal test working:
#ifdef MBED_CONF_DRIVERS_QSPI_IO0
#define QPIN_0 static_cast<PinName>(MBED_CONF_DRIVERS_QSPI_IO0)
#else
#define QPIN_0 static_cast<PinName>(QSPI_FLASH1_IO0)
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the difference as MBED_CONF_DRIVERS_QSPI_IO0 is QSPI_FLASH1_IO0...
bb825ec
to
5d86560
Compare
I split the proposition in few commits with more comments in order to be more explicit. |
@ARMmbed/mbed-os-hal Please review if drivers config should be extended to provide QSPI pins. @maciejbocianski What is the current way to provide these pins, besides defining them in PinNames.h (using on board flash) but what about external flash with our tests? |
@bulislaw @evedon could you please review on behalf of the hal team? (@donatieng fyi) |
Hi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jerome, I think I'm missing something. The tests has been updated to use the new config MBED_CONF_DRIVERS_QSPI_XXX
, but it's not set by default to anything and the code wasn't change to link the existing (built in QSPI chips) accessible via QSPI_FLASH1_XXX
to the new config.
The way users would use the code (not test) doesn't change and it's described here: https://github.com/ARMmbed/mbed-os/blob/master/components/storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h#L50 no matter if they use builtin or external chip.
For tests things should still work by default with built in QSPI, but it should be possible to reconfigure to use external, I agree here. What i'm missing is how this change works with default built in memories. So where MBED_CONF_DRIVERS_QSPI_IO0
defaults to QSPI_FLASH1_IO0
.
@@ -12,6 +12,24 @@ | |||
"spi_count_max": { | |||
"help": "The maximum number of SPI peripherals used at the same time. Determines RAM allocated for SPI peripheral management. If null, limit determined by hardware.", | |||
"value": null | |||
}, | |||
"qspi_io0": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help text is missing.
@bulislaw |
5d86560
to
75f3afb
Compare
Help added in the json file Rebase also done |
"QSPI_IO3": "QSPI_FLASH1_IO3", | ||
"QSPI_SCK": "QSPI_FLASH1_SCK", | ||
"QSPI_CSN": "QSPI_FLASH1_CSN", | ||
"QSPI_IO0": "MBED_CONF_DRIVERS_QSPI_IO0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeromecoutant what I'm saying is these new configs like MBED_CONF_DRIVERS_QSPI_IO0
are not defined by default as far as i can tell, while the old ones like QSPI_FLASH1_IO0
were defined as part of pinmap. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MBED_CONF_DRIVERS_QSPI_IO0 is set by default to QSPI_FLASH1_IO0,
so no impact for QSPIF
Difference, now, is that when user adds some external QSPI memory, he only has to update his mbed_app.json file. Then he could execute QSPIF AND QSPI tests.
Thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks it work
mbed_config.h:
// Automatically generated configuration file.
// DO NOT EDIT, content will be overwritten.
#ifndef __MBED_CONFIG_DATA__
#define __MBED_CONFIG_DATA__
// Configuration parameters
...
#define MBED_CONF_DRIVERS_QSPI_CSN QSPI_FLASH1_CSN // set by library:drivers
#define MBED_CONF_DRIVERS_QSPI_IO0 QSPI_FLASH1_IO0 // set by library:drivers
#define MBED_CONF_DRIVERS_QSPI_IO1 QSPI_FLASH1_IO1 // set by library:drivers
#define MBED_CONF_DRIVERS_QSPI_IO2 QSPI_FLASH1_IO2 // set by library:drivers
#define MBED_CONF_DRIVERS_QSPI_IO3 QSPI_FLASH1_IO3 // set by library:drivers
#define MBED_CONF_DRIVERS_QSPI_SCK QSPI_FLASH1_SCK // set by library:drivers
...
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
astyle error - please fix, |
Now, these pins can be used everywhere (MBED_CONF_DRIVERS_QSPI_xxx) and be redefined in local mbed_app.json (no more need to patch PinNames.h file)
This makes new board with the same QSPI memory addition.
7e99230
to
23e6840
Compare
CI started Please @maciejbocianski review |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
As soon as @maciejbocianski approves, this can go in. |
@0xc0170 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
IS this captured in our docs, for instance in QSPI driver docs? If not , it should ! |
@jeromecoutant you save my evening. |
Description
I had to make some tests with an existing MBED target and an external QSPI,
and it was not so easy, many patches were needed in several part.
This proposition is then to be able to make it easier.
QSPI and QSPIF tests are now possible only with mbed_app.json update:
Example:
Addition of new board with some already defined QSPI memory is now very easy!
There is no change for existing targets with embedded QSPI.
Pull request type
Reviewers
Release Notes