micro-ROS / NuttX

Official micro-ROS RTOS
http://micro-ros.github.io/
Other
88 stars 34 forks source link

How to use an UDP Server/Client over 6LowPan in NuttX #23

Closed jfm92 closed 6 years ago

jfm92 commented 6 years ago

For this example we will work with: Olimex-STM32-E407 board MRF24J40 802.15.4

In this specific case, we are using PmodRF2, which use the previous chip. But any module with the MRF24J40 chip, will be compatible.

Make the next connection between the module and the board:

Signal Board Pin Module(PmodRF2) Pin
VCC +3.3V 6
GND GND 5
SCLK D13 4
MISO D12 3
MOSI D11 2
CS D10 1
INT D8 7

(The name of the pins are printed on the board, and are the Arduino friendly pins)

Now we will use the Olimex-stm32-e407/mrf24j40-6lowpan profile in the board. This profile have by default the precise configuration to setup a 6lowpan network and a UDP Server/Client. When you flashed the firmware in the board, you'll have both options.

With this configuration you could use another kind of server over 6LowPan, it's just to check another App.

Once the boards that you're going to use are flashed in the terminal you must the next commands: Server Board(S), Client Board(c) s: i8sak wpan0 startpan cd:ab s: i8sak set chan 11 s: i8sak set panid cd:ab s: i8sak set saddr 42:01 s: i8sak acceptassoc c: i8sak wpan0 c: i8sak set chan 11 c: i8sak set panid cd:ab c: i8sak set saddr 42:02 c: i8sak set ep_saddr 42:01 c: i8sak assoc

If everything it's right you will see something like this: Client imagen Server imagen

c: ifup wpan0 s: ifup wpan0 In both case we should have this message: imagen

s: mount -t procfs /proc s: ifconfig This command will show the IP of the server and all the data of the connection: imagen s: udpserver & c: udpclient fe80::ff:fe00:140 & Or the IP that returns your sever.

Client imagen Server imagen

In this example, the client, will send a message to the server and then will close the connection. In the side of the server, it will show the data receive, the size of it and the connection data(direction and port).

With this basic example you can easily make more complex stuff.