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

Device is not setting the user data rate and tx power, on reset. #94

Open
ankit-bansal-oxit opened this issue Sep 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system lorawan LoraWAN-related issue or pull-request.

Comments

@ankit-bansal-oxit
Copy link

Describe the set-up

The board is NUCLEO-WL55JC1
STM32 CubeIDE v1.15.1
STM32 CubeMx v6.10

Describe the bug (skip if none)

I setted the default data rate (say DR4)and Tx power using he cubeMx in LoraWan_end_node example(although its occuring even in the other LoRaWan examples). On device reboot, on first attempt, device tries to connect with the default data rate DR4. On second attempt it switch to DR0, since its in the join parameters. But, even after the device has been joined, its not using the user setted data rate ie DR4, it continues in the DR0.

How to reproduce the bug (skip if none)

  1. Open the LoRaWan_End_Node_Example.
  2. configure data rate except DR0.
    image
  3. Configure tx power except TX_POWER_0.
  4. Generate the code and see the effects.

Additional context.

In the generated code, the user parameters has been setted in the file lora_app, using the variable LmHandlerParams.
image

When the device do not receive the answer from the gateway, the MLME_JOIN event occurs, in the file LmHandler.c,
image

There are 2 functions called , LmHandlerGetTxDatarate and LmHandlerGetTxPower has been called, to set the data rate and the Tx power for the join parameters.
In the function LmHandlerGetTxDatarate, at line 1000, we are setting the data rate to variable name LmHandlerParams.
LmHandlerParams is copied from the user device LmHandler values, which has to be used.
image.
This alter the user defined values, causing the issue. On commenting the line 1000, resolves the issue.

Is there is any specific reason, that we are setting the LmHandlerParams, over riding the user values? As these function are not in the original LoRaMac Node repo.

This might be the case for the Tx Power also, although I did not tested it.

@ALABSTM ALABSTM added bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository lorawan LoraWAN-related issue or pull-request. labels Sep 23, 2024
@RJMSTM
Copy link
Contributor

RJMSTM commented Sep 30, 2024

Hello @ankit-bansal-oxit,

First, thank you for your contribution. Is your problem with the code generation using STM32Cube MX or with our firmware? Because I can't find the function LmHandlerGetTxDatarate. Where did you encounter your issue? Could you please specify your problem? In which files does this function appear, and is it a problem with the generation using MX?

Thanks,

@RJMSTM RJMSTM moved this from To do to Analyzed in stm32cube-mcu-fw-dashboard Sep 30, 2024
@RJMSTM RJMSTM added the needs clarification Needs clarification or input from user label Sep 30, 2024
@ankit-bansal-oxit
Copy link
Author

ankit-bansal-oxit commented Sep 30, 2024

@RJMSTM Thanks for the reply!

My problem is from the firmware side.

The function present in the file LmHandler.c at line 985. Here it isfor the reference
https://github.com/STMicroelectronics/STM32CubeWL/blob/99e6b06c87338a6d78a7454e8b455b119cc29ac8/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c#L985C24-L985C46

https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Middlewares/Third_Party/LoRaWAN/LmHandler/LmHandler.c

When you compare the MLME_JOIN, event, from the ST proviced LmHandler.c and LmHandler.c from loramac node, this funciton LmHandlerGetTxDatarate is absent in the original stack.

LmHandlerGetTxDatarate( &JoinParams.Datarate );

https://github.com/Lora-net/LoRaMac-node/blob/dcbcfb329b4a343ab007bc19ac43a8dc952b3354/src/apps/LoRaMac/common/LmHandler/LmHandler.c#L828

@RJMSTM
Copy link
Contributor

RJMSTM commented Oct 10, 2024

ST Internal Reference: 193444

@RJMSTM RJMSTM added internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system and removed needs clarification Needs clarification or input from user labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cube mx Issue related to the Cube MX tool rather than the firmware published within this repository internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system lorawan LoraWAN-related issue or pull-request.
Projects
Development

No branches or pull requests

3 participants