Skip to content
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

Allow LoRaWAN STM32WL driver debug led to be inverted #14910

Merged
merged 10 commits into from
Jul 29, 2021

Conversation

hallard
Copy link
Contributor

@hallard hallard commented Jul 10, 2021

Summary of changes

Allow LoRaWAN STM32WL debug led to be inverted

Impact of changes

Migration actions required

Documentation

new mbed application STM32WL driver parameter allowing debug led to be reverted (depending on hardware wiring mode)

"target_overrides": {
        "*": {
            "stm32wl-lora-driver.debug_invert": 1
        }

Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] 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)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@jeromecoutant @MarceloSalazar


@ciarmcom
Copy link
Member

@hallard, thank you for your changes.
@jeromecoutant @MarceloSalazar @ARMmbed/mbed-os-connectivity @ARMmbed/mbed-os-maintainers please review.

@hallard
Copy link
Contributor Author

hallard commented Jul 11, 2021

If someone could explain what is preventing the build I can fix it, but the error message is hard to understand from my side.

@LMESTM
Copy link
Contributor

LMESTM commented Jul 12, 2021

@hallard
from what I see here: https://app.travis-ci.com/github/ARMmbed/mbed-os/jobs/523513062
it seems like a formatting issue (trailing white space?), on line 329 of connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.h:

-// Can be overwriten in the file mbed_app.json with 

@hallard
Copy link
Contributor Author

hallard commented Jul 12, 2021

@LMESTM that did it, trailing space at the end of the line.
Thanks

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

why LED would be inverted?

#undef DEBUG_LED_ON
#undef DEBUG_LED_OFF
#define DEBUG_LED_ON 0
#define DEBUG_LED_OFF 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we simplify this? without any undef.

Just assign values based on if its inverted or not.

#if defined(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT) && (MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT == 1)
// inverted enabled
#define DEBUG_LED_ON  0
#define DEBUG_LED_OFF 1
#else
#define DEBUG_LED_ON  1
#define DEBUG_LED_OFF 0
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sure makes sense Will do that

Copy link
Collaborator

Choose a reason for hiding this comment

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

For me, no need to update this file....
Just use MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT in STM32WL_LoRaRadio.cpp ?

@@ -47,6 +47,10 @@
},
"debug_tx": {
"help": "GPIO pin for TX debug"
},
"debug_invert": {
Copy link
Contributor

Choose a reason for hiding this comment

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

debug_led_invert might be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely the deal is that I wanted to be consistent with already related existing options. It took me some time to understand that ˋdebug_tx` was for led and not a serial. So if I change it it would makes sense to change 2 other (and introduce breaking change). Whatever solution is fine for me

Copy link
Collaborator

@jeromecoutant jeromecoutant Jul 13, 2021

Choose a reason for hiding this comment

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

debug_led_invert might be better

Hi

Not sure, as primary goal of the debug GPIO is to easily use logic analyser for example.
Usage of LEDs is only an "extension"

Copy link
Contributor Author

@hallard hallard Jul 13, 2021

Choose a reason for hiding this comment

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

debug_led_invert might be better

Hi

Not sure, as primary goal of the debug GPIO is to easily use logic analyser for example.
Usage of LEDs is only an "extension"

makes sense

@hallard
Copy link
Contributor Author

hallard commented Jul 13, 2021

why LED would be inverted?

Because of hardware side sometimes they are connected in the reversed way

Copy link
Collaborator

@jeromecoutant jeromecoutant left a comment

Choose a reason for hiding this comment

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

Proposition is:

  • in connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json, to name the new config "default_debug_value" and set 0 as default
  • in connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp, use MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_DEBUG_VALUE when it was 0 ?

@hallard
Copy link
Contributor Author

hallard commented Jul 13, 2021

Proposition is:

  • in connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json, to name the new config "default_debug_value" and set 0 as default

ok

  • in connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp, use MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_DEBUG_VALUE when it was 0 ?

so you mean in this file driving the GPIO that was something like that before

_rf_dbg_rx = 0; // Off 
_rf_dbg_rx = 1; // On

becomes

_rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_DEBUG_VALUE 
_rf_dbg_rx = !MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_DEBUG_VALUE

or something else, not sure to see what you mean.

@jeromecoutant
Copy link
Collaborator

Yes, that was my idea. Is it working ?
Maybe we could find more appropriate name ?

@hallard
Copy link
Contributor Author

hallard commented Jul 13, 2021

Yes, that was my idea. Is it working ?
Maybe we could find more appropriate name ?

I need to test it

why not MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_LED_OFF, like that default 0 value means Led if Off with value of 0 and if set to 1 it's reversed means 1 to set it off so

_rf_dbg_rx = 0; // Off 
_rf_dbg_rx = 1; // On

becomes

// Off
_rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_LED_OFF
// On (really Not Off)
_rf_dbg_rx = !MBED_CONF_STM32WL_LORA_DRIVER_DEFAULT_LED_OFF

@mergify mergify bot dismissed 0xc0170’s stale review July 13, 2021 15:06

Pull request has been modified.

Copy link
Contributor Author

@hallard hallard left a comment

Choose a reason for hiding this comment

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

requested changes done, tested, works as expected with LoRa E5 Breakout

connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json Outdated Show resolved Hide resolved
@@ -388,4 +388,4 @@ class STM32WL_LoRaRadio : public LoRaRadio {



#endif /* MBED_LORA_RADIO_DRV_STM32WL_LORARADIO_H_ */
#endif /* MBED_LORA_RADIO_DRV_STM32WL_LORARADIO_H_ */
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry bad cut/paste on my side, done

@hallard hallard requested review from jeromecoutant and 0xc0170 and removed request for a team July 20, 2021 07:07
@mergify mergify bot added needs: CI and removed needs: work labels Jul 27, 2021
@0xc0170
Copy link
Contributor

0xc0170 commented Jul 27, 2021

Ci started

Squash would be good, I can squash this into one when merging

@hallard
Copy link
Contributor Author

hallard commented Jul 27, 2021

Ci started

Squash would be good, I can squash this into one when merging

Sure it's no problem for squash, even better :-)

@0xc0170 0xc0170 added release-type: patch Indentifies a PR as containing just a patch and removed release-type: feature labels Jul 27, 2021
@mbed-ci
Copy link

mbed-ci commented Jul 27, 2021

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-ARM ✔️
jenkins-ci/mbed-os-ci_cmake-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit d13aaf4 into ARMmbed:master Jul 29, 2021
@mergify mergify bot removed the ready for merge label Jul 29, 2021
@hallard hallard deleted the STM32LW_Led branch July 29, 2021 12:40
@mbedmain mbedmain added release-version: 6.14.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Aug 18, 2021
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.

None yet

7 participants