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

Application port #8

Closed
xoseperez opened this issue Jan 31, 2018 · 3 comments
Closed

Application port #8

xoseperez opened this issue Jan 31, 2018 · 3 comments

Comments

@xoseperez
Copy link
Contributor

Sometimes you have different devices reporting to the same application different data. The TTN backend allows you to tell one from the other in the decoder based on the application port the message has been sent to.

The current implementation of the MKRWAN does not allow to set the application port. In the STM32 firmware, it is weirdly handled in the lora_send method as a prefix in the message buffer. But MKRWAN uses the UTX and CTX entry points that bypass that check. This results in a random application port depending on what is on the memory location the appport variable points to.

I have added the option to specify the application port by using SEND entry point in the sendMessage method along with CFM to set the confirmation flag. Sadly, the method bound to SEND in the STM32 firmware (at_Send) does not "follow" the stream as the CTX or UTX do (at_SendV2 or at_SendV2Confirmed) so I have to pass the message as a string and this fails when the buffer has a byte 0.

I have pushed my tentative code here: xoseperez@cb94498 but I think this should be fixed in the STM32 firmware.

@xoseperez
Copy link
Contributor Author

xoseperez commented Jan 31, 2018

I have pushed another commit that fixes the previous issue with payloads that contain a \0 avoiding the sendAT method.

I'm sending you a PR since I think this functionality is worth it and it is completely backwards compatible. This might change in the future if the mkrwan1300-fw for STM32 changes.

@facchinm
Copy link
Contributor

Hi @xoseperez,
the UTX and CTX commands were chosen to provide a single library for both our firmware and Murata official one. By taking a look at the Murata specification (the document is still under NDA, sorry) there is a specific command to set the port, outside the SEND function. The command is AT+PORT, I'll implement it in the FW and then in the library by using your PR as a starting point. Thanks a lot!

@facchinm
Copy link
Contributor

facchinm commented Feb 5, 2018

I just uploaded a new firmware with Murata-like functionalities, the setPort API was fine so I merged part of your commits too. Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants