Skip to content

Using SPI_ macros from PinNames in SPIF and SD config files. #7979

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 2 commits into from
Oct 26, 2018

Conversation

yossi2le
Copy link
Contributor

@yossi2le yossi2le commented Sep 4, 2018

Description

Now after PR #7774 merged the following pins add been added to mbed-os:
SPI_MOSI
SPI_MISO
SPI_SCK
SPI_PERSISTENT_MEM_CS

This PR is created in order to start using them in the new components block devices configuration file.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[x] Functionality change
[ ] Breaking change

@0xc0170 0xc0170 requested a review from a team September 4, 2018 12:19
@jeromecoutant
Copy link
Collaborator

Why SPI_PERSISTENT_MEM_CS and not SPI_CS ?

@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 4, 2018

Why SPI_PERSISTENT_MEM_CS and not SPI_CS ?

Because SPI_CS can point not only to storage but to any device/subdevice connected to the SPI bus.
We like that it will be clear to everyone that this Pin name is for the SPI persistent memory.

@@ -60,12 +60,6 @@
"SPI_CLK": "PTD5",
"SPI_CS": "PTD4"
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove all NUCLEO and DISCO target_overrides configuration
as SPI_xxx define should be already defined for them.
Thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ASFAIK, not all NUCLEO and DISCO has those pins defined. Also, some of them were defined by the data from spif and some from sd. So in case, spif is the original definition we left the sd target override as it was.

"SPI_CS": "SPI_PERSISTENT_MEM_CS",
"SPI_MOSI": "SPI_MOSI",
"SPI_MISO": "SPI_MISO",
"SPI_CLK": "SPI_SCK",
"DEVICE_SPI": 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that MBED_CONF_SD_DEVICE_SPI is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean MBED_CONF_SD_SPI

@jeromecoutant
Copy link
Collaborator

Because SPI_CS can point not only to storage but to any device/subdevice connected to the SPI bus.
We like that it will be clear to everyone that this Pin name is for the SPI persistent memory.

So default setting should be
"SPI_CS": "SPI_CS",

And this should be overridden only the the targets that have some connected SPI memory.

"target_overrides": {
    "xxx": {
         "SPI_CS":   "SPI_PERSISTENT_MEM_CS"

@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 4, 2018

So default setting should be
"SPI_CS": "SPI_CS",

And this should be overridden only the the targets that have some connected SPI memory.

"target_overrides": {
  "xxx": {
        "SPI_CS":   "SPI_PERSISTENT_MEM_CS"

No, we prefer that the configuration for the storage will be always SPI_PERSISTENT_MEM_CS. if someone like in the PinNames.h he can do
SPI_PERSISTENT_MEM_CS = SPI_CS
In our opinion it this ease the configuration

@LMESTM
Copy link
Contributor

LMESTM commented Sep 4, 2018

Hello @yossi2le @0xc0170

There have been changes in #7774 that do not look good to me at first glance - but maybe I'm wrong ..
Also we haven't been asked for review before merge so haven't asked question so far.

So my point is: adding SPI_PERSISTENT_MEM_CS in pinnames.h on D10 of for example the L475 IOT discovery board does not make sense to me:
https://github.com/ARMmbed/mbed-os/pull/7774/files#diff-6fcf86553443430596ac5ee4d817ae14R242

D10 pin is just a GPIO and this definition of SPI_PERSISTENT_MEM_CSapplies I guess in case the CI test shield is plugged in, but D10. There is one persistent memory on this target and this is the embdded QSPI.

So we think that the SPI_PERSISTENT_MEM_CS definition definitely does not belong to here.

One more question: how have you selected the list of targets that were updated in #7774 ?
It updates a subset of the STM targets, not all of them ... so I'd like to understand.

thanks in advance

@dannybenor
Copy link

@LMESTM @yossi2le I think we went one step too fast. We will revert the changes in the files pinnames.h and start a process of introducing the changes in synch with partners.
We will have 2 boards for example (k64f for SD, K82F for SPIF)

@LMESTM
Copy link
Contributor

LMESTM commented Sep 5, 2018

@yossi2le @dannybenor Sounds good. Just need to find out the right place where SPI_PERSISTENT_MEM_CS definition belongs to.

@yossi2le
Copy link
Contributor Author

yossi2le commented Sep 5, 2018

@yossi2le @dannybenor Sounds good. Just need to find out the right place where >SPI_PERSISTENT_MEM_CS definition belongs to.

PR #7995 should revert this changes.

@jeromecoutant
Copy link
Collaborator

Any update ?
Thx

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 24, 2018

@yossi2le The revert was integrated, this PR is now ready as it is ? If yes, someone from @ARMmbed/mbed-os-storage should review

@jeromecoutant
Copy link
Collaborator

Why don't you use as default configuration Arduino pin ?
like in https://github.com/ARMmbed/ci-test-shield/blob/master/mbed_app.json

@yossi2le
Copy link
Contributor Author

Why don't you use as default configuration Arduino pin ?
like in https://github.com/ARMmbed/ci-test-shield/blob/master/mbed_app.json

Because we aiming that SPI_ macros in PinsNames.h will be the defaults, while we keep the option to allow changes by configuration.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 15, 2018

@yossi2le Can we proceed ? Rebase to resolve latest updates, and @ARMmbed/mbed-os-storage team to review

@yossi2le
Copy link
Contributor Author

Rebase done.

@cmonr
Copy link
Contributor

cmonr commented Oct 23, 2018

Still waiting for @ARMmbed/mbed-os-storage to review.

@ARMmbed/mbed-os-maintainers When y'all get a chance, the unittests also need to be rerun. Results are not due to PR, but due to glitch from last week.

Copy link
Contributor

@offirko offirko left a comment

Choose a reason for hiding this comment

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

Looks fine to me

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 23, 2018

@jeromecoutant @LMESTM All questions answered here, good to progress?

@jeromecoutant
Copy link
Collaborator

@jeromecoutant @LMESTM All questions answered here, good to progress?

No... I don't like the default use of SPI_PERSISTENT_MEM_CS...
I will have to make a PR for all NUCLEO and DISCO boards with :

"target_overrides": {
"xxx": {
"SPI_CS": "SPI_CS"

@yossi2le
Copy link
Contributor Author

@jeromecoutant.
First of all, I don't understand why you need to update all the NUCLEO and DISCO boards because those which exists already will not be removed. for example.

"NUCLEO_L031K6": {
"SPI_MOSI": "SPI_MOSI",
"SPI_MISO": "SPI_MISO",
  "SPI_CLK":  "SPI_SCK",
  "SPI_CS":   "SPI_CS"
}

Besides if we don't have this you still need to configure every board because the global configuration now is set to NC by mistake.

Second, we think that SPI_CS cannot be set always to point on storage. if you have more component connected to the SPI bus they all need a different cheap select. Therefore, we like to have one specific pin name for the storage.

@kjbracey
Copy link
Contributor

Just to stir the pot - yes, SPI_CS is obviously device-specific, but then so are the others, really. You can have multiple SPI buses, so there's an implied "bus for the storage" for SPI_MOSI, SPI_MISO and SPI_CLK too...

I don't think it's the end of the world if the legacy "SPI_xxx" meaning "SPI pins for storage" in PinNames.h is retained. It doesn't preclude more specific names for other devices and drivers.

But having some prefixed, some not seems odd.

@yossi2le
Copy link
Contributor Author

I have replaced the SPI_PERSISTENT_MEM_CS macro with SPI_CS and rebased.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 25, 2018

Thank you all for quick resolution here!

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 25, 2018

Build : SUCCESS

Build number : 3462
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7979/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 25, 2018

@cmonr
Copy link
Contributor

cmonr commented Oct 25, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Oct 25, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 26, 2018

@0xc0170 0xc0170 merged commit 93a17c1 into ARMmbed:master Oct 26, 2018
@adbridge
Copy link
Contributor

adbridge commented Nov 2, 2018

This is sitting on top of #7955 scheduled for 5.11

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