micro-ROS / NuttX

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

How to use on board Ethernet in NuttX #13

Closed jfm92 closed 6 years ago

jfm92 commented 6 years ago

This guide if focus in boards that have on board ethernet. This guide won't go so deeply, because use the network capabilities in NuttX is near the same than in Linux, so internet is plenty of info about how to set-up a TCP/IP server, UDP client or whatever. In this guide, we will see how to change from a telnet server to a TCP/IP echo server. This is example is usefull to change from a standart example to your custom app. If you use an external module to have ethernet conectivity, maybe you will use an SPI or an UART module, so it's different the way that we use it.

Configuration:

The configuration to set-up the networking utilities is quite tricky, so we're going to use a predefined config profile. If you're using the olimex board, you can use this profile: olimex-stm32-e407\telnetd

Important Note: Use networking functionality is incompatible with use built-in apps, so despite of you can use the nsh console, you can run any APP. So, to run an APP with networking capabilities we will run at the start up as the entry APP.

In the menuconfig go to -> RTOS Features -> Tasks and Scheduling -> Application entry point . Change from telnetd_main to tcpecho_main (but you can change to whatever you want, for example your custom app main file).

Then go to Application Configuration -> Examples -> Check Simple TCP echo server. In the submenu, it's necessary to add the next data: Target IP: 0xc0a80185 (192.168.1.133) Default Router IP address: 0xc0a80101

And finally unchecked telnet daemon example

This is for this specifically example, but you can check other custom APP

Code

In the folder APP/Examples there are examples of:

In the examples you can see how to implement different kinds of protocols and functionalities, also as I said before, is near the same as in Linux of how to implement any protocol.