Customer application protocol for data transfer between embedded processor and microcontroller systems

ABSTRACT


INTRODUCTION
Now a day, electronic devices that require to communicate with each others are mostly connected to networks with real time system.This is done by using TCP/IP protocol.Lightweight IP (lwIP) is open source TCP/IP networking stack that is used originally and developed by Adam Dankels [1], It seizes small memory size (random access memory (RAM) and read only memory (ROM)) to conform with embedded system prerequisites [1][2][3][4][5].The lightweight IP (lwIP), available under the Berkeley software distribution (BSD) license, enables the designed processor system to configure and control the layers in TCP/IP protocol.
A microcontroller architecture to measure various quantities for distinguishing water quality by a simultaneously distributing data over the internet was developed by [6].Uploading new files and programs to the embedded web server using file transfer protocol (FTP) was presented by Stipanicev and Jadranka [7].An embedded direct current (DC) motor position control system with user datagram protocol (UDP) was designed by Ahmed et al. [8].Schema of download operation to the evaluation board using the trivial file transfer protocol (TFTP) server on the advanced reduced instruction set computing (RISC) machine (ARM) based architecture microcontroller LPC2210 was presented by Qiu et al., [9].Free RTOS operating system based on hypertext transfer protocol (HTTP) was envisaged by Moritz et al. [10].In application programming interface (API) standardized application based on HTTP protocol was developed by Xu [11].Machine to machine (M2M) communication based on HTTP protocol was discussed by Sharan and Asati [12].
Based on the results obtained from the above mentioned previous works, it is clear that, there is a need to develop a simple and efficient customer application protocol, customer application protocol (CAP) to facilitate transferring data between a processor and microcontroller system, Arduino mega2560 [13,14], this target can be performed by constructing a processor system with Ethernet IP core to settle data link with a microcontroller device using embedded design techniques and the developed CAP protocol.The application is developed using C language at the processor side in the software development kit (SDK) platform [2,15] and using C++ language at the integrated development environment (IDE) at the microcontroller side [16].The remaining of the paper implies section 2 that presents the CAP, data representation.Section 3 deals with system hardware construction, Result and conclusions are presented in section 4 and section 5 respectively.

CUSTOMER APPLICATION PROTOCOL (CAP)
The data is represented in different fashions according to host operation system.It's sent as unsigned integer bytes, and then at receiver side, it is reconstructed to its original form.Customer application protocol (CAP) is used to control the data flow and reconstruction.The CAP protocol, developed here, implies adding a header control to the data sent that consists of data type byte, session byte, package number, total package number and two bytes for package length as shown in Figure 1.
Figure 1.Developed customer application header protocol for data transfer between a microcontroller and an embedded processor system

Data representation
For exchanging data between the two systems, two points need to be considered.The first point is that the microblaze uses big-endian bit-reversed data format [17] while the microcontroller system uses little-endian format to represent the data, also the data transmission in CAP protocol was performed in little-endian mode.Figure 2 shows the big-endian data format representation and Figure 3 shows the location of the data bytes on memory in each mode.CAP protocol takes care of this point by using global variable (extern variable) as a buffer stored in the heap memory.As the heap memory grows [18][19][20] in a reverse direction to the stack memory growth [21], the problem of different data format is solved.The second point is the data type.CAP protocol header has data type code byte that helps to fetch data from extern buffer as the original data type, both systems have data type code table that can be used as reference.Data type code depends on data type and data size such as int8, and unint16.

Flow control
The flow control bytes (session byte, package number byte, total package number byte, size package bytes), error message, and acknowledge message enable data flow under monitoring and control of customer application protocol.The session byte prevents interference between new and old data transmitted by the same host.Package number and package length are used in data fragmentation [22][23][24], the bytes in the original package are numbered from 0 to 65,536.The calculation for the packages offset is determined in (1).The maximum data transfer through CAP protocol is 2 24 -1 byte because package offset is 24 bits.In case the size of the used package is larger than 16 bits, the scaling factor (S) is added to (2).Consequently, the maximum data transfer depends on scaling factor value.The total package byte is used to determine the end of transmission and free cookies for new transmit.

Package offset = number package * package size
(1) Package offset = number package * package size * The client has to ensure that every package sent when arrives is error-free, in this case an acknowledgment message as shown in Figure 4 is sent to the clients.The connection will be lost if the client doesn't receive the Customer application protocol for data transfer between embedded processor and… (Mazin R Khalil) 803 acknowledgement message.If any error type of those shown in Table 1 accur an error message as shown in Figure 5 will be sent.

Cookies
Large amount of data is divided in to more than one package as continuous group packages, especially in API ROW mode, the added cookies are used to hold the information about the last connected host as shown in Figure 6.It contains last IP client, copy of the last package CAP protocol header and numbers of package received.The cookies allow the CAP protocol to combine the transmitted packages data.

Software application development
The flow chart of the customer application protocol developed in server software development kit (SDK) environment is depicted in Figure 7.The flowchart contains the codes in c language with note for each step.It explains implementation of CAP protocol in server side.Figure 8

SYSTEM HARDWARE DEVELOPMENT
The designed embedded processor system is shown in Figure 9.The block diagram of the designed embedded processor system with Ethernetlite IP core that act as a media access controller (MAC) operating with interrupt active mode [25,26].The designed system uses AXI4 interconnect module that act as system bus [27], memory controller MCB-DDR2 [28] to control a 128 M byte dual data rate memory (DDR-SDRAM) READ/WRITE operations, an interrupt controller (INTC) [29] to deal with the Ethernetlite IP core and timer interrupt signals, AXI4 timer [30] and other necessary peripherals.

RESULTS AND ANALYSIS
The Data Exchange Link is tested by sending an audio record (4 kByte size) from Matlab (PC) to microcontroller with 5 packages, and is then transmitted from microcontroller to microprocessor designed system with 16 packages.All transmissions are done under customer protocol.Figure 10 shows the audio signal created in Matlab media.Figure 11 shows a samples of audio signal created in Matlab, samples of the audio signal transferred to microcontroller media and samples of the audio signal transferred to microprocessor media.In comparison with previous works, the CAP is considered flexible and powerful for data transfer.It is also accurate and characterised by its low complexity with lower package control number.Figure 12 displays the data received by the microprocessor system on chipscope windows.Each window display one K byte of data.

CONCLUSIONS
A sophisticated data transfer system was designed to exchange data between microcontroller and embedded microprocessor systems using ethernet IP core and a developed customer application protocol.The proposed system is characterized by following: lwIP facilitates applying a TCP/IP protocol for the designed system.The developed customer application protocol offer a proficient control on transfer system.The data transfered in customer application protocol was maximized to 16 MB with ability to be expanded.The system is with high precision data transfer such that percentage error in the received data is (0.01-0.2%).

Figure 7 .Figure 8 .
Figure 7.The flowchart for the customer application protocol of the server

Figure 9 .
Figure 9. Block diagram of the hardware part of the designed processor system

Table 1 .
Error type