This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52840 CLI UDP mqtt-sn commands

Hello!

My name is Tiago Morais.
I've started to work with nrf52840 and now I'm having some problems with its CLI.

I'm trying to use the nrf52840 dk with openthread and mqtt-sn
the examples work fine, but actually I don't want to keep the mqtt-sn client inside the nrf52840, I'd like to put it in a microcontroler.

So, i'm using the CLI interface via uart between them to send the UDP messages.
(udp send ....)
The problem is that when I'm sending the 'REGISTER' (register topic) message which msgType is equal to 0x0A, it is equal to '\n' in ascii, that said, the CLI breaks the message and sends only the part before the msgType, which is not enough :D

Is there a way to configure the nrf52840 CLI to interpret the linebreak ONLY with a \r\n instead of only \n (I've tested sending only \r, as well and it responds the same way, by starting a new line) ??
I saw that the CLI example code in those examples are .a file, so I cannot change it :(

I'm sending together a word file with some pictures of the CLI
I used a sniffer in the raspberry to (tshark) to see the udp message from the example and replicated it via uart with my stm32

I really could use someone's help :)

Thank you very much!

Parents
  • Hello ,

    First of all, thank you for using nRF5 SDK for Thread and Zigbee!

    I'm not sure if i understand the nature of the problem, so i will just list couple of thoughts after reading your post.

    1. The "udp send" command is documented in the README_UDP.md file. You need to put space instead of new line before you put a new argument. Pressing enter - producing '\r' or '\n' or '\r\n' - this basically how all command line tools works (enter means - "I finished my command, please execute it").

    2. You can configure your serial communicator (e.g. Putty) to use any of the mentioned above new line breaks.

    3. You said:

    I don't want to keep the mqtt-sn client inside the nrf52840, I'd like to put it in a microcontroler.

    Do you mean that you want to have CLI based MQTT-SN commands? If yes, then i suggest you to take a look on this API to register custom commands. You can't just use "udp send" command to emulate MQTT-SN behaviour. You would need to map MQTT-SN API to CLI commands.

    4. Anyway, if i didn't understand the problem correctly, you can always make some modification to the CLI application and update OpenThread libraries inside SDK.

    Regards,
    Łukasz

Reply
  • Hello ,

    First of all, thank you for using nRF5 SDK for Thread and Zigbee!

    I'm not sure if i understand the nature of the problem, so i will just list couple of thoughts after reading your post.

    1. The "udp send" command is documented in the README_UDP.md file. You need to put space instead of new line before you put a new argument. Pressing enter - producing '\r' or '\n' or '\r\n' - this basically how all command line tools works (enter means - "I finished my command, please execute it").

    2. You can configure your serial communicator (e.g. Putty) to use any of the mentioned above new line breaks.

    3. You said:

    I don't want to keep the mqtt-sn client inside the nrf52840, I'd like to put it in a microcontroler.

    Do you mean that you want to have CLI based MQTT-SN commands? If yes, then i suggest you to take a look on this API to register custom commands. You can't just use "udp send" command to emulate MQTT-SN behaviour. You would need to map MQTT-SN API to CLI commands.

    4. Anyway, if i didn't understand the problem correctly, you can always make some modification to the CLI application and update OpenThread libraries inside SDK.

    Regards,
    Łukasz

Children
  • Hi 

    Sorry for the late reply and thanks for your answer!

    the problem I was having was that i wanted to send hex values like {03 01 01} via CLI.
    that worked fine, but when i meant to send something like {03 0A 01} 
    The CLI interpreted that '0A' as I had finished the command sending only '03' instead of sending the full {03 0A 01}

    1. The "udp send" command is documented in the README_UDP.md file. You need to put space instead of new line before you put a new argument. Pressing enter - producing '\r' or '\n' or '\r\n' - this basically how all command line tools works (enter means - "I finished my command, please execute it").

    I was able to find the correct file to adapt the CLI code HERE,

    3.

    Do you mean that you want to have CLI based MQTT-SN commands? If yes, then i suggest you to take a look on this API to register custom commands. You can't just use "udp send" command to emulate MQTT-SN behaviour. You would need to map MQTT-SN API to CLI commands.

    Yeah, I was planning to do something like that, but now I'd like to go further and try to that by implementing the spinel protocol

    Thanks again!

Related