Application of S3C44B0X in Embedded Socket Communication System

Publisher:HarmoniousVibesLatest update time:2013-03-01 Source: dzscKeywords:S3C44B0X  Socket Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

     An embedded system is a system that integrates application programs, operating systems, and computer hardware. It is application-centric, based on computer technology, and its hardware and software can be customized. Therefore, it is a special-purpose computer system that can meet the application system's strict requirements for functionality, reliability, cost, size, and power consumption.

  This paper presents a communication platform design suitable for mid-range and low-end applications. It can support data transmission between Ethernet networks and has RS232, RS485, USB and other interfaces.

  In this paper, a hardware communication platform based on embedded communication microprocessor S3C44B0X is designed around the embedded uClinux environment, thus realizing embedded Socket communication?

  1 Embedded Network Communication System Architecture

  As a special type of computer system, embedded systems are usually composed of embedded processors, embedded peripherals, embedded operating systems and embedded application software. The embedded processor is the core component of the embedded system, which can be divided into embedded microprocessors, embedded microcontrollers, embedded DSPs (Digital Signal Processors) and highly integrated embedded SoCs (System on Chips). Embedded peripherals refer to other auxiliary components such as storage, communication, protection, debugging, and display in embedded hardware systems except for the central control components. Embedded operating systems are generally considered for use in relatively large applications or those that require multi-tasking. They can facilitate the design of embedded application software and greatly improve the functions of embedded systems, but they also occupy precious embedded resources. Embedded application software is different from ordinary application software. It is targeted at specific practical professional fields, based on corresponding embedded hardware platforms, and is computer software that can complete the user's expected tasks.

  There are many popular processor cores for embedded processors. This article mainly introduces the design and implementation of the hardware and software platform for Socket communication using Samsung's S3C44B0X processor based on ARM's 32-bit RISC ARM7TDMI core.

  S3C44B0X is a cost-effective and high-performance microcontroller. It uses the ARM7TDMI core and can operate at 66MHz. ARM7TDMI is a 32-bit embedded RISC processor, but it is also equipped with a 16-bit compressed instruction set Thumb. It supports on-chip debugging, allowing the processor to pause in response to a debug request. The enhanced multiplier in the chip can multiply two 32-bit numbers to directly generate a 64-bit result, and can also provide on-chip breakpoint and debug point support for embedded ICE hardware. In addition, it can also provide a three-stage pipeline and von Neumann structure. In fact, S3C44B0X has expanded a complete series of general peripheral devices based on the ARM7TDMI content. Figure 1 shows the hardware architecture of an embedded network communication system.


  2 Peripheral circuit design

  As an excellent network controller, the system based on S3C44B0X processor must have a matching control chip. Here, the author selected CirrusLogic's CS8900A. CS8900A is a single-chip full-duplex Ethernet solution, which integrates all the analog and digital circuits necessary to complete the Ethernet circuit. Figure 2 shows the CS8900A Ethernet interface circuit in the system. The signal sending and receiving ends in the figure are connected to the transmission media through the network isolation transformer and RJ45 interface. In addition, in order for the system to work properly, an external 20MHz crystal oscillator is required.


  3 Socket communication based on uCliunx

  The software of this system is designed based on the embedded operating system uClinux. uClinux is an operating system that fully complies with the GNU/GPL convention. It is compatible with the UNIX system and its code is completely open. uClinux is an operating system that is appropriately tailored and optimized based on the standard Linux. uClinux is a highly optimized and compact embedded subset of Linux. Although it is small in size, it still retains most of the advantages of Linux, such as: stability, good portability, excellent network functions, complete support for various file systems, and standard and rich APIs. uClinux is an embedded operating system specifically for processors without a memory management unit (MMU), and has done a lot of miniaturization work specifically for embedded systems. It can run directly on Flash or be loaded into memory to run. u-Cliunx has a complete TCP/IP protocol and also supports many other network protocols. For embedded systems, it is a complete network operating system, so it has been widely used. [page]

  In order to realize the development of application systems based on uClinux, it is necessary to establish or have a complete uCliunx development environment. The application development environment based on the uClinux operating system is generally composed of the target system hardware development board and the host PC (3). It is usually necessary to install a cross compiler on the host PC with Linux installed to compile the user application into a flat format executable file currently only supported by uClinux and compile the operating system kernel. The target hardware development board is used to run the operating system and system application software. The target hardware development board and the PC host are generally connected through a serial port, parallel port or Ethernet interface. The software development and simulation environment used for Socket communication in this article is shown in Figure 3.


  Socket is "socket", which indicates the ID of the network communication process. The most commonly used are stream socket and datagram socket. In Linux, they are called "SOCK STREAM" and "SOCKDGRAM" respectively. The tailored uClinux retains most of the socket library functions in Linux. The main library functions to be called for embedded socket communication based on S3C44B0X processor are as follows:

  (1)socketint socket(int domain int type int proto-col)

  This function is used to create a new socket to notify the system to establish a communication port? The domain parameter in the function is used to specify the address type to use; the type parameter is used to specify the socket type; the protocol parameter is usually 0, indicating the use of the default protocol?

  (2)bind intbind(int sockfd,struct sockaddr*myaddr,int addrlen)

  The bind function associates the socket port returned by the socket with the physical location on the network. The sockfd parameter is the socket descriptor returned by the socket function; the myaddr parameter is the local address; and the ad-drlen parameter is the length of the socket address structure. Both the server and the client can call the bind function to bind the socket address, but it is usually the server that calls the bind function to bind its own recognized port number.

  (3)listenint listen(int sockfd,int backlog)

  This function can be used to make the socket port accept connection requests sent from the client. The backlog parameter is the maximum number of clients that can be accepted. The combined call of the three functions of socket, bind, and listen can eventually generate a file descriptor sockfd on the server that can accept client requests.

  (4)acceptint accept(int sockfd,struct sockaddr*address,int*address_len)

  When a client sends a connection request, this function initializes the connection. The parameter address is used to store the client information, which is filled in by accept. When connecting to the client, the client's address and port will be filled in here; addresslen is the number of bytes of the client's address length, which is also filled in by accept.

  (5)connectint connect(int sockfd,struct sockaddr*address,size_t address_len)

  After the client calls socket to establish the transmission port, it will then call the connect function to establish a connection line with the remote server. The parameters of this function are the same as those of bind.

  The Socket communication designed in this paper adopts the server/client mode, that is, the server-side application is used to accept the client's connection request, receive the client's information, process the client's calculation request, send the calculation result and response information to the client, etc. The client application is used to apply for connection with the server, send calculation request to the server, and process the calculation result and other information sent back by the server.

  After creating a socket, the server will then bind the socket to the local address/port number. After success, it will connect to the corresponding socket. When accpet captures a connection service request, a new connection is completed, and data can be sent to the client later.

  The client code is relatively simple. First, it obtains the IP address through the server domain name, then creates a socket, and then calls the connect function to establish a connection with the server. After the connection is successful, it receives the data sent from the server, and finally closes the socket after the communication is completed.

  mso-ascii-font-family: \'Times New Roman\'; mso-hansi-font-family: \'Times New Roman

  \'">To sum up, the steps to establish Socket communication between the network program client and the server are as follows

  Server side: socket →bind →listen→accept

  Client: socket →bind →connect

  The socket used in this design is a stream socket. The following is a client application running on the 32-bit microprocessor S3C44B0X embedded development platform:

  #include

  #include

  #include

  #include

  #include

  #include

  

  #include

  #include

  #include

  #include

  int main(int argc,char *argv[])

  {

  int s;

  char buffer[256];

  struct sockaddr_in addr;

  struct hostent *hp;

  struct in_addr in;

  struct sockaddr_in local_addr;

  if (argc < 2) return;

  if(!(hp=gethostbyname (argv[1]))){

  fprintf(stderr,"Can't resolve host.n");

  exit (1);

  }[page]

  if ((s = socket(AF_

  INET,SOCK_STREAM,0)) <0){

  perror("socket");

  exit (1);

  }

  bzero (&addr,sizeof (addr));

  addr.sin_family = AF_INET;

  addr.sin_port=htons((unsigned short)atoi(argv[2]));

  hp = gethostbyname(argv[1]);

  memcpy(&local_addr.sin_addr.s_addr,hp->h addr,4);

  in.s_addr = local_addr.sin_addr.s_addr;

  printf ("Domain Name %sn" argv

  printf ("IP address:%sn",inet_ntoa (in));

  printf("%s,%sn",hp->h_name,argv[2]);

  addr.sin_addr.s_addr=inet_addr(hp->h_name);

  if connect(s,(struct sockaddr *)&addr,sizeof (addr))<0){

  perror("connect");

  exit (1);

  }

  recv (s,buffer,sizeof (buffer),0);

  printf ("%sn", buffer);

  while(1);

  bzero(buffer,sizeof (buffer));

  read (STDIN_FILENO,buffer,sizeof(buffer));

  if (send (s,buffer,sizeof (buffer),0)<0){

  perror ("send");

  exit (1);

  }

  }

  }

  4 Conclusion

  The Ethernet communication system based on S3C44B0X is designed and developed, and Socket communication is realized by using the powerful network function of uClinux operating system. Since uClinux currently only supports executable files in flat format, this design is to convert the user-developed application program into flat format through the cross compiler on the host PC after the uClinux development environment is established first, and then add it to the target hardware development platform through FTP for operation. The client application in this article has been successfully run on the embedded development platform based on the S3C44B0X processor of ARM7TDMI core, and successfully realized Socket communication with the server application of the host PC. Of course, the target hardware development platform can also be used as the server, and the host PC can be used as the client for two-way file transfer.

Keywords:S3C44B0X  Socket Reference address:Application of S3C44B0X in Embedded Socket Communication System

Previous article:Design and implementation of Bluetooth audio gateway based on S3C4480X control
Next article:Design of reversing audio and video system based on embedded Linux

Recommended ReadingLatest update time:2024-11-17 04:22

Design of medical monitoring system based on GPRS network
This paper introduces a home remote medical monitoring system composed of ARM processor S3C44B0X and M590E GPRS module. The author introduces the performance characteristics of S3C44B0X and M590, the design of the main peripheral interface circuits, as well as the software design architecture and the composition princ
[Microcontroller]
Design of medical monitoring system based on GPRS network
Technical solution for embedded system expansion USB interface based on S3C44B0XARM7 processor
  Commonly used high-speed communication interfaces between hosts and embedded peripherals include LPT parallel port, USB, 1394 and 10/100M Ethernet interfaces. RS232 is not suitable for high-speed data transmission. The 1394 interface requires a special adapter interface, which is too expensive and is generally rarel
[Microcontroller]
Technical solution for embedded system expansion USB interface based on S3C44B0XARM7 processor
Design of Ethernet controller based on embedded system
  introduction   At present, with the rapid development of computer technology and communication technology, while we are interconnected through computers, embedded devices in many fields such as industrial control, data acquisition, CNC machine tools and smart instruments also have the need to access the network. . W
[Microcontroller]
Design of Ethernet controller based on embedded system
Transplantation of μCOS-Ⅱ on ARM series microcontroller S3C44B0x
Introduction     At present, embedded systems have been increasingly widely used in various fields such as industrial control, home appliances, mobile communications, and PDAs. As users have higher and higher performance requirements for embedded products, program design has become more and more complex, which require
[Microcontroller]
Transplantation of μCOS-Ⅱ on ARM series microcontroller S3C44B0x
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号