LwIP on AVR32

Since the basic function for HAL is able to run without serious problem. I have to put HAL on hold and start to do net layer for AVR32. However, I will come back to HAL when bugs ‘fly’ out or when the time I want to increase the performance of HAL.

The net layer for the AVR32 is based on LwIP (Light Weight Internet Protocol). The LwIP is a open-source networking library and API. It can support the basic networking protocol such as IP, ICMP, DHCP, DNS, UDP and TCP. It is widely used in embedded system since the resource usage is much lesser than normal TCP/IP protocol that used by PC. Besides that, it is able to run in multithread (RTOS) or single thread system.

The Atmel Software Framework provides several examples that using LwIP for network application. In these example, The LwIP has been ported into FreeRTOS. The ASF has done the low level jobs so programmers can go to design the application layer directly.

The LwIP provides three different types of API for programmers to write the web application, the APIs are:

  • Raw / native API – LwIP only API. This API uses a callback mechanism, which will increase the complexity of readability when the program become bigger.
  • Netconn API – LwIP only API. This API simplify the API with ‘sequential’ style.
  • Socket API – ‘Sequential’ API, targeted at compatibility to posix- / BSD-sockets

My job is to pack all the netconn API into three types of function and hides all LwIP function. The three types of function are follow the basic TCP/IP connection, which are:

  • Connection establishment – Create a task to handle the user defined application (eg. web server).
  • Data transfer – Capture input and send data, hide the LwIP detail from web application.
  • Connection termination – Close the connection and suspend the task.

The goal of the net layer is to simplify the design of web application. The programmer provides the basic information (port numbers and IP address) and lets the net layer handles all the trivial jobs for him. It will save their time and let them focus on the manipulation of information.

You may also like...

Leave a Reply