mqtt-sn via openthread CLI

45 views
Skip to first unread message

tiago morais

unread,
Jan 4, 2019, 6:51:01 PM1/4/19
to openthread-users
Hi everyone!

I'm really new to the openthread world, so I'm having some troubles with the openthread command line
currently I am working in a mqtt-sn and openthread project using a nrf52840 dongle and DK. 

What I'm trying to do right now is to send udp message via openthread CLI to simply search for the gateway, because i don't want the mqttsn client to stay at the nrf dongle, but in a stm uC so I'm trying to 
interface both with CLI.

the UDP sent in hex should look like this:
03 01 01

and the border router should respond something like this:
03 02 XX  << where XX is the GW ID.

those are the basic commands to join the thread and send a udp message:

panid 0xabcd

channel 15

ifconfig up

thread start

udp open

udp bind :: 0xabcd

udp send fd03::1 0xabcd 311  


but when i send this mesage with the CLI the borderrouter interprets those 311 as ascii characters 33 31 31
and since i cannot format the message.... i'm stuck

ah! almost forgot to mention... looks like the library files for the cli code are encrypted (they are .a files), so I can't do much there...

finally my question is:
 - How am i supposed to send hex values with this CLI?
 - Is there another way to interface with openthread besides CLI? (using nrf52840 dongle if possible ;D)

Thanks for all the help you can send :D

Jonathan Hui

unread,
Jan 4, 2019, 7:07:58 PM1/4/19
to tiago morais, openthread-users
The UDP CLI example currently delivers ASCII to make it simple to play with something like netcat.

You can find the existing implementation in src/cli/cli_udp_example.cpp, where you can see that the chars are directly appended to the UDP payload. You can modify the implementation with something like Hex2Bin() to convert ASCII hex to binary before appending to the UDP payload.

OpenThread NCP implements a binary serial protocol called Spinel. However, we do not currently have a host-side implementation that demonstrates how to use Spinel in an embedded RTOS environment.

Hope that helps.

--
Jonathan Hui

--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To post to this group, send email to openthre...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/1d0723b3-1d08-4e37-b4c1-4aacec7dc5a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tiago morais

unread,
Jan 5, 2019, 5:14:26 AM1/5/19
to openthread-users
Hi again!

Thank you Jonathan!, that was what i was starting to guess about this CLI! at first i thought that was the terminal i was using that was sending only ascii, then i changed it but still didn't work

But with your answer i can try other aproach, since now i have access to the CLI code :D! 

Thanks for your help!
Reply all
Reply to author
Forward
0 new messages