Skip to content

Clean-up S2LP driver configuration #12951

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
May 15, 2020
Merged

Clean-up S2LP driver configuration #12951

merged 2 commits into from
May 15, 2020

Conversation

MarceloSalazar
Copy link

@MarceloSalazar MarceloSalazar commented May 11, 2020

Summary of changes

This PR adds the ability to configure the pins of the S2LP driver for any target (inside Mbed OS or custom target) using the standard mbed_lib.json and mbed_app.json config files.

Additionally, the MTB_STM_S2LP and MTB_STM_S2LP_CT targets are removed as are not supported in Mbed OS 6, and thus making the S2LP driver independent of targets.

Impact of changes

Note users can continue to use the 5.15 branch.
For Mbed OS 6, it should be possible to use the default pin config without changes (apart from MTBs).
Custom pin configuration can be done as shown next.

Migration actions required

Developers need to create a mbed_app.json (or other json config) including the pin configuration for their target.

An example of application configuration for the S2LP driver is shown here:
https://github.com/MarceloSalazar/mbed-os-example-mesh-minimal/blob/S2LP_cleanup/configs/mesh_wisun_S2LP.json#L34-L50

        "NUCLEO_F429ZI":  {
            "LED": "LED_RED",
            "BUTTON": "USER_BUTTON",
            "BUTTON_MODE": "PullDown",
            "s2lp.SPI_SDI"           : "PA_7",
            "s2lp.SPI_SDO"           : "PA_6",
            "s2lp.SPI_SCLK"          : "PA_5",
            "s2lp.SPI_CS"            : "PC_0",
            "s2lp.SPI_SDN"           : "PF_13",
            "s2lp.SPI_GPIO0"         : "PA_3",
            "s2lp.SPI_GPIO1"         : "PC_3",
            "s2lp.SPI_GPIO2"         : "PF_3",
            "s2lp.SPI_GPIO3"         : "PF_10",
            "s2lp.I2C_SDA"           : "PB_7",
            "s2lp.I2C_SCL"           : "PB_6",
            "s2lp.provide-default"   : true
        }

The driver can be initialized as follow:

NanostackRfPhys2lp rf_phy(MBED_CONF_S2LP_SPI_SDI
                          ,MBED_CONF_S2LP_SPI_SDO
                          ,MBED_CONF_S2LP_SPI_SCLK
                          ,MBED_CONF_S2LP_SPI_CS
                          ,MBED_CONF_S2LP_SPI_SDN
                          ,MBED_CONF_S2LP_SPI_GPIO0
                          ,MBED_CONF_S2LP_SPI_GPIO1
                          ,MBED_CONF_S2LP_SPI_GPIO2
                          ,MBED_CONF_S2LP_SPI_GPIO3);

Documentation

None


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[X] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[X] Tests / results supplied as part of this PR

Note that mbed-os-example-mesh-minimal and nanostack-border-router applications compile ok when using provided mesh_wisun_S2LP.json config:

mbed compile -t ARM -m NUCLEO_F429ZI --app-config configs/mesh_wisun_S2LP.json -c

Reviewers


@mergify mergify bot added the needs: work label May 11, 2020
@ciarmcom ciarmcom requested review from a team May 11, 2020 13:00
@ciarmcom
Copy link
Member

@MarceloSalazar, thank you for your changes.
@ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-ipcore please review.

@0xc0170 0xc0170 requested review from ABOSTM and andypowers and removed request for ABOSTM May 12, 2020 07:29
@0xc0170
Copy link
Contributor

0xc0170 commented May 12, 2020

CI started

0xc0170
0xc0170 previously approved these changes May 12, 2020
@mergify mergify bot added needs: CI and removed needs: review labels May 12, 2020
@mbed-ci
Copy link

mbed-ci commented May 12, 2020

Test run: FAILED

Summary: 1 of 7 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_wisun-mesh-test

@0xc0170
Copy link
Contributor

0xc0170 commented May 12, 2020

@MarceloSalazar wisun tests failing - using most probably something that this PR changes

@MarceloSalazar
Copy link
Author

@0xc0170 correct - there is a dependency and wisun tests will have to be updated as indicated in the migration section

@mergify
Copy link

mergify bot commented May 12, 2020

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@MarceloSalazar
Copy link
Author

Rebased and fixed issues

@mergify mergify bot dismissed 0xc0170’s stale review May 12, 2020 15:24

Pull request has been modified.

@mbed-ci
Copy link

mbed-ci commented May 13, 2020

Test run: FAILED

Summary: 1 of 7 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_wisun-mesh-test

@MarceloSalazar
Copy link
Author

The error is expected - there is a need to migrate to use the Mbed configuration as indicated in the guide above.

NanostackRfPhys2lp rf_phy(S2LP_SPI_SDI, S2LP_SPI_SDO, S2LP_SPI_SCLK, S2LP_SPI_CS, S2LP_SPI_SDN,

./drivers/rf_wrapper.cpp:27:41: error: 'S2LP_SPI_SDO' was not declared in this scope

Change needed here: https://github.com/ARMmbed/nanostack-border-router/blob/master/drivers/rf_wrapper.cpp#L27

@MarceloSalazar
Copy link
Author

MarceloSalazar commented May 13, 2020

I've added support for legacy pin configuration, so the nanostack-border-router app continues to work as it's. It's possible to override the config using mbed_app.json as shown in the description above.

Please re-test.

@0xc0170
Copy link
Contributor

0xc0170 commented May 14, 2020

CI restarted

@mbed-ci
Copy link

mbed-ci commented May 14, 2020

Test run: SUCCESS

Summary: 7 of 7 test jobs passed
Build number : 6
Build artifacts

@0xc0170 0xc0170 removed the request for review from a team May 14, 2020 11:22
0xc0170
0xc0170 previously approved these changes May 14, 2020
@0xc0170 0xc0170 requested a review from bulislaw May 14, 2020 14:59
@mergify mergify bot added the needs: work label May 14, 2020
@mergify
Copy link

mergify bot commented May 14, 2020

This PR cannot be merged due to conflicts. Please rebase to resolve them.

@mergify mergify bot removed the needs: review label May 14, 2020
@mergify mergify bot dismissed 0xc0170’s stale review May 14, 2020 16:17

Pull request has been modified.

@MarceloSalazar
Copy link
Author

Rebased and fixed.

@0xc0170
Copy link
Contributor

0xc0170 commented May 14, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented May 14, 2020

Test run: SUCCESS

Summary: 7 of 7 test jobs passed
Build number : 7
Build artifacts

Copy link
Collaborator

@andypowers andypowers left a comment

Choose a reason for hiding this comment

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

Approved

@0xc0170 0xc0170 merged commit b107148 into ARMmbed:master May 15, 2020
@mergify mergify bot removed the ready for merge label May 15, 2020
@MarceloSalazar MarceloSalazar deleted the S2LP_cleanup branch May 15, 2020 07:28
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.

5 participants