HTTP/TFTP Server Plus USB Mass Storage Host From Freescale

  Download PDF version of the Article
HTTP/TFTP Server Plus USB Mass Storage Host

This article describes implementation of a HTTP/TFTP server based on the ColdFire MCF5225x processor with a USB file system where web pages or other files are stored. It details how to integrate a USB stack with a NicheTask and accessing the USB file system through a HTTP/TFTP server.

Who is MCF5225x?
The MCF5225x family consists of highly integrated devices with on-chip USB, Ethernet, CAN and encryption functions, featuring the complete Freescale MQX RTOS software at no additional cost. This solution is ideal for factory automation, building control, and medical applications.

The MCF52259 is a highly-integrated 32-bit microcontroller based on the V2 ColdFire micro-architecture. Featuring 64 Kbytes of internal SRAM, 512 Kbytes of flash memory, a fast Ethernet controller, a USB on-the-go controller, an external bus interface, four 32-bit timers, a 4-channel DMA controller, two IIC modules, three UARTs, and a queued SPI. The MCF52259 family has been designed for general-purpose industrial control applications.

InterNiche
This ColdFire TCP/IP stack is a public source stack provided for use with the ColdFire line of processors. It can be divided into two parts: a mini-TCP layer library and a mini-IP layer library. It also includes a virtual file system (VFS) that supports the american standard code for information interchange (ASCII) and binary data, integrated with a round-robin tasking system named NicheTask.

CMX USB-Lite
The CMX USB-Lite is provided by Freescale and CMX for ColdFire and S08 USB microcontrollers. It supports a USB device, host, and on-the-go (OTG) functionality to meet various design requirements. Included are high-level class drivers for keyboards, mouse devices, and generic human interface devices (HID). Communication device classes (CDC) to universal asynchronous receivers and transmitters (UART) provide communication between UART and USB (mass storage demos for the host mode). The stacks can be accessed at Freescale USB.

HTTP Server Implementation
Project Architecture
This project is created with CodeWarrior 7.0. The architecture is listed bellow:

Implementation
This project is implemented based on the MCF52259EVB.

Integration of InterNiche and CMX USB Stack
In this project InterNiche is used to manage network protocols and the CMX stack is used to manage file operations based on the USB file system. The key point of this project is to combine the two stacks to work concurrently.

Creating usb-mass-host-task.c for NicheTask
The InterNiche also provides a RTOS named NicheTask which is a cooperative multi-tasking scheduler. In this architecture each task has its own call-stack. Voluntarily manages control back to the master scheduler. The integrating method is to invoke APIs from CMX stack as tasks through the NicheTask. This is achieved by a source file named usb-mass-host-task.c where a state machine is created for a USB mass host.

Invoking APIs from the usb-mass-host-task.c in NicheTask
In usb-mass-host-task.c a function named create_cmxusb_task() is created to support NicheTask. It is invoked in the task object tk_keyboard that supports the standard I/O in NicheTask and added to the task control block (TCB) table after reset.

TK_ENTRY(tk_keyboard)
{
for (;;)
{
TK_SLEEP(1); /* make keyboard yield some time */
kbdio(); /* let Iniche menu routines poll for char */
keyboard_wakes++; /* count wakeups */
#ifdef MCF52259
if((usbmst_attach == 1)&&(usbtsk_created == 0))
{
create_cmxusb_task();
usbtsk_created = 1;
}
else if((usbmst_attach == 0)&&(usbtsk_created == 1))
{
tk_kill(to_cmxmasshosttask);
usbtsk_created = 0;
}
#endif
if (net_system_exit)
break;
}
TK_RETURN_OK();
}

Running HTTP Web Server on the MCF52259EVB
Before running the HTTP web server, the evaluation board (EVB) must be connected to a PC through a UART0 port. The baudrate of the HyperTerminal must be set to 115200-8N1.

Connecting to the Web Page on the USB Flash
Because the IP address is obtained, the HTTP web server can be visited through Internet Explorer by typing http://10.192.221.30 in the address bar.

TFTP Server Implementation

Software Architecture
This architecture is similar to the HTTP web server. The architecture includes source files supporting TFTP protocol instead of HTTP server support.

This project is also implemented based on the MCF52259EVB. The TFTP server has been already provided by InterNiche. That particular example accesses files stored in the internal flash through VFS and therefore there is a critical file size limitation. In this project, files are stored in a USB device that allows for a larger file size. The key point is to make the TFTP server access the USB files through the CMX file system instead of VFS.

The HTTP/TFTP server projects are implemented based on the FEC and USB module MCF52259 that provide not only high performance but also flexible connectivity. Applications based on the MCF52259 are not limited in the HTTP/TFTP server. If a USB camera is connected to the MCU instead of a flash a web monitor is achieved with minimal changes to the HTTP/TFTP server. It can monitor what is happening through the web page. The MCF52259 is ideal for applications in the industrial controlling field. Further developement regarding Network applications can be achieved functionality based on this application note.

Read more: HTTP/TFTP Server Plus USB Mass Storage Host

M52259DEMOKIT: Low-Cost Demonstration Board Kit for MCF5225x

The cost-effective M52259DEMOKIT demonstration kit for Freescale's MCF5225x microcontroller includes the M52259DEMOMCU and M52259DEMOCOM boards. The M52259DEMOMCU has two stack headers to allow additional features to be added quickly and easily. In addition to the MCF52259 MCU, the board features an integrated, Open-Source, USBBDM, and a USB port with mini-AB connector supporting both Host and Device mode operation. CodeWarrior Development Studio is also included to ease application development and debug. The M52259DEMOCOM is an expansion board connected directly to the M52259DEMOMCU board. It provides 10/100 Ethernet, RS-232, and Hi-Speed CAN functionality. Board stack connectors mounted also support additional expansion.

Register using this form and you'll have a discount of 30%. (only for the first 20 registered)
NOTE: this is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

Read more: M52259DEMOKIT: Low-Cost Demonstration Board Kit for MCF5225x

M52259EVB: Evaluation Board for MCF5225x

The M52259 Evaluation Board (EVB) is based on Freescale ColdeFire V2 family microprocessor MCF52259. This board is shipped with the MCF52259 soldered down to allow for the evaluation of all of the functionality of this part. This board was designed as a validation and evaluation platform for MCF52259 silicon which supports USB, Ethernet, CAN and Mini-bus function. Built-in USB-BDM circuitry is available for debugging and programming. Supports JTAG for system-level testing. It also implemented a CPLD on board to show some extension features.

Register using this form and you'll have a discount of 30%. (only for the first 20 registered)
NOTE: this is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

Read more: M52259EVB: Evaluation Board for MCF5225x

ColdFire MCF5225x & Freescale MQX Software Solutions Introduction

Hi My name I Max Lovedale. And I am with the Cold Fire application team here at Freescale software solutions. I am very excited to share with you a new solution addressing the complex demands that you face when designing systems for USB and the Ethernet. Research shows that our customer’s products are becoming more connected and intelligent. And there is a growing shift in our customer’s resources towards software development. In addition schedules and budgets are becoming tighter and tighter. Freescale is addressing these trends with complete hardware and software solutions that will ultimately accelerate your success.

Today I am here to introduce a popular new product line, the MCF5225X. It’s a ColdFire V2 microcontroller which is targeted for factory automation, building control, and medical applications. It’s a high performance 32bit microcontroller with a rich feature set that hits a great price performance target. And on top of this great new product, Freescale is accelerating your success by offering the MQX real time operating system complimentary with the MCF5225X.

The Freescale MQX RTOS is full featured proven and scalable with a modular architecture that allows you to select only the services you need for your application. And you can optimize your design based on your features, memory utilization size and speed requirements. It comes with protocol stacks for Ethernet and USB. And a board support package to unlock all the features of the 5225X. In this video I am going to show you the hardware platforms in the MQX software training lab. And together these will speed your time in the market when developing your end application.

So starting with the hardware, the M52259 demo kit is very inexpensive, simple to use and compact and is powered directly from a USB cable for the integrated debugger. And the board has the ColdFire Microcontroller along with connectors for USB, Ethernet, serial and CAN and it also has switches and LEDs. In addition it has an expansion header for access to the numerous other signals. For advanced development, we have the M52259EBB. It’s a full featured evaluation board and has the same features of the demo board but with a few extra. It has configurable jumper options, a larger pin expansion header and more serial connectors. And it also adds memory and expandability by taking advantage of the new mini flex bus expansion bus which is connected to an MRAM Memory CPLD programmable logic device, and a compact flash connector. Both ford kits come with all the cables you need and a DVD that contains the software documents, labs and a quick start guide to help get you started on your design process quickly. On the DVD you will find the code word development studio. Code word is an integrated development environment that provides a complete framework for your software applications. To demonstrate the features and benefits of MQX and the 5225X, we have created several lab tutorials which guide you through the general use of the Freescale MQX operating system. The lab example emulates a simple HVAC controller. It shows how multiple tasks can communicate with each other and access the many communication interfaces on the 5225X. In the labs you will learn how to use the code word taskware debugging features. You will also be guided through the use of the USB protocol stack. The MFS file system, using show command line, the TCP/IP protocol stack with Telmet, FTP, and an HTTP web server. The Freescale MCF5225X family of microcontrollers with MQX software offers industry leading connectivity, best in class design flexibility and market leading software and support. And remember the MQX software is included with the purchase price of the 5225X. It’s a great value to you. I really believe that Freescale is raising the bar with the introduction of this new hardware and software solution. I look forward to all the innovative products which I know you will create. Thank you.

Read the Italian version: Server HTTP/TFTP più Host USB da Freescale

CONTACT REQUEST
If you want to know more about this Freescale product, please submit your request to Arrow Italy using this form.
NOTE: this form is valid ONLY for Companies or Customers based in Italy and working in the Italian area.

Who's online

There are currently 1 user and 7 guests online.

Online users

  • hollymcv9

Who's new

  • stiseeskefs
  • MornlyJaw
  • odootfit
  • xattlxbwwnjw
  • jb37th
  • Teepsyzef
  • adadiatepsivy
  • feekMaifita
  • gomAppopayJig
  • EquadaRap

Recent comments