摘 要: 隨著嵌入式Web的飛速發展,以Internet為中間環節使不同嵌入式設備進行通信的需求日益強烈,特別是在工業監控領域。采用項目組自行研發的內嵌有MAC模塊的定制版32位處理器作為硬件平臺,以此為基礎設計了基于描述符的DMA傳輸機制的網絡驅動。同時,為了實現穩定數據通信及Web瀏覽器功能,對嵌入式TCP/IP協議棧LwIP進行了無操作系統移植,并對協議棧內部的數據管理方式及底層接口進行詳細分析。測試結果表明,LwIP協議棧適用于工業遠程監控,能夠在實現穩定通信的同時兼顧速度與小內存消耗。
關鍵詞: LwIP 協議棧; 網絡驅動; 嵌入式系統; 片上可編程系統
中圖分類號: TN915.04?34; TM417 文獻標識碼: A 文章編號: 1004?373X(2016)19?0011?05
Abstract: With the rapid development of the embedded Web, the communication demand among different embedded devices through the Internet becomes increasingly intense, especially in the industrial monitoring field. The customized 32?bit processor embedding MAC module was taken as the hardware platform, which was developed by the project group itself. And on this basis, the network drive of descriptor?based DMA transfer mechanism was designed. In order to realize the functions of stable data communication and Web browser, the protocol stack LwIP of the embedded TCP/IP was performed with transplantation without operating system. The data management method and bottom?layer port inside the protocol stack are analyzed in detail. The test results show that the LwIP is suitable for the the industrial remote monitoring, and can realize stable communication while ensuring the high speed and low memory consumption.
Keywords: LwIP; network drive; embedded system; programmble system on chip
0 引 言
嵌入式設備正在深度改變人們的日常生活與社會生產,小到生活中的各式智能家電,大到國防軍用航空航天設備。嵌入式Internet正在覆蓋更多的終端設備,而在眾多Internet通信協議中TCP/IP協議是目前運用次數最多,應用范圍最廣的一種標準協議[1]。基于上述特點,本文旨在為某研究所定制一款具有自主知識產權的定制版32位處理器,要求具備網絡訪問功能,能實現實時通信。此款處理器主要用于遠程工業控制,有低功耗、實時通信的特點[2]。
1 硬件驗證板卡設計
系統采用32位處理器,工作在100 MHz主頻,擁有256 KB的指令和數據內存以及32 KB的系統內存。它還包括:片上PLL,16通道、12位、5 MSPS ADC,10M/100M RMII接口的MAC,定時器,看門狗,64個GPIO,UART,SPI,I2C,LPC等多種功能豐富的外設,本芯片采用SMIC 0.13 μm工藝,144TQFP封裝。
為了驗證SoC芯片的性能和各個功能模塊,設計了一個硬件驗證板卡,如圖1所示。……