Revised DigiButler Project for ColdFire Kirin3
Before Freescale released the Kirin3, it has offered an Ethernet enabled microcontroller MCF5223X, Kirin2e. There are two major differences between Kirin2e and Kirin3. The Kirin3 adds USB-OTG module, but it removes Ethernet PHY. So the existing projects running on Kirin2e can be ported to Kirin3 with different driver. Freescale employs Ethernet PHY from Micrel (KSZ804NL) for its demo kit and National Semiconductors (DP83838) for its evaluation board individually. Web applications sometimes require file system to keep the web pages or logged data. The FAT file system can be supported on Kirin3 USB OTG or Kirin2e with QSPI simulated SD card slot. Alternatively, you can use older ColdFire microcontrollers with an external single chip Ethernet IC (MAC+PHY) and SPI bus to setup a comparable connected platform. The solution is your call, only cost and device availability matter.
Freescale and Elektor offered an open source project with MCF52231, called DigiButler and available on both web sites. Let us check out its features:
- 32-bit ColdFire MCF52231 microcontroller (60MHz, 128KB Flash, 32KB RAM, Kirin2e)
- Open source project
- C source code
- Free CodeWarrior software development platform, now upgraded from CW6.2 to CW7.11
- Doubles as a low-cost ColdFire development system due to its TBLCF USB debugger
- Connectivity: Ethernet (RJ45), RS232, BDM, analogue, I2C, timers
- 1 relay (on board) suitable for mains loads up to 2A
- Accessible through Internet or WAP
- Password and username protection with HTTP basic authentication
- TCP/IP and RTOS stack with HTTP, DHCP, UDP, ICMP, ARP support
- Easy IP setup with DHCP client and manually assignment
- Ideal for web-driven remote sensoring and control
- Off-the-shelf Kit available from Elektor
As I mentioned, it really doesn't matter which microcontroller is used. Porting the project to MCF52259 demo kit allows me to evaluate the project and add more features on my own board. Now, I ported the project to MCF52259 demo kit successfully. I used to try my best to support both microcontrollers for this project. Finally I gave it up, since Kirin2e and Kirin3 has different link command files of different memory configuration. Here come the differences between two boards.
Hardware
DigiButler kit from Elektor prepares a large prototype area on PCB for custom parts, it also offers ADC, GPIO, I2C, user buttons, LEDs, relays for the user application.
MCF52259 demo kit is very compact, there is no room for custom circuit, it only offers two user buttons, four user LEDs, USB OTG, UART, Ethernet and a through-hole bus for extension. The developer can connect this extension bus to the user circuit. Because MCF52259 demo kit is designed for demonstration purpose, which requires the power supply from the debugger's USB port and only works with CodeWarrior. Although my revision for DigiButler should work in a practical network, I have no extra budget to make a real PCB for Kirin3. I am wondering if there is any individual or organization can donate or sponsor for PCB program.
BDM Debugger
An open source debugger called TBLCF USB BDM is used in DigiButler project. TBLCF stands for Turbo BDM Light ColdFire, developed by Dainel Malik with MC68HC908JB16 and 74VHC14 buffer. It is a low cost debugger under 10USD.
MCF52259 demo kit has an on-board debugger, called OSTAP / ColdFire v2-v4 JM60 OSBDM. It has different names in driver installation and CW debugger setup window. It is another open source BDM debugger, based upon Freescale 8bit Flexis JM60 USB microcontroller. The debugger should be setup properly if you are using different BDM module like PEmicro debugger for MCF52259 evaluation board.
I am trying to merge the CMX USB bootloader into my revision. So the regular users (consumers who prefer plug and play) can download the firmware without debugger. Since the existing BDM debuggers are all USB powered. It doesn't matter which debugger is used.
Network Setup
In the current broadband services, we get dynamic IP from the service provider. In most domestic local network environment, consumers connects their PCs to a SOHO router or DSL modem, which assigns IP addresses for connected devices. This approach shares the network connection within the same LAN, and prevents unauthorized access from external computers. In order to make DigiButler work online and allows visits from external work. We should solve IP assignment for DigiButler and port redirection / port forwarding in the router. Of course, if DigiButler has the capability to dial up by PPPoE, it also works. However, PPPoE is not yet implemented in current design. I will put the feature on the project wish list.
Both DigiButler and ColdFire TCP/IP Lite support static IP and DHCP client, so it has no problem on IP setup. The default IP is hardwired in the code, as 192.168.0.98. You can change the IP address in the terminal (Minicom or HyperTerminal). But I am going to embed this feature in the web page, as most routers and connected devices do.
In the router (DHCP server) side, it is better to assign an IP to DigiButler according to its MAC address. It is quite important, because the port redirection and port forwarding requires a determinate IP address. The DHCP algorithms are various in different routers, so you never knows what happens, even you find your DHCP server always assign the same IP for your PC. The MAC address defined in both projects are different, DigiButler Kirin2e uses 00:CF:52:08:CF:01. ColdFire TCP/IP Lite supports 00:CF:52:53:54:CC for DHCP client mode and 00:CF:52:53:54:55 for DHCP server mode. However, the DHCP server never works with my PC, so I have to find out the reason and fix it in my revision.
After setup IP assignment, we can setup port forwarding or port redirection. Provided we assign the IP address 192.168.0.98 to MAC address 00:CF:52:53:54:CC, then we can set port 80 of the router to 192.168.0.98. Then any incoming HTTP get query to our WAN IP can fetch information from the LAN IP 198.168.0.98, port 80, i.e. our DigiButler board or Kirin3 demo kit.
The WAN IP assigned by the ISP also not permanent. It is hard to use to remember the IP address. It is a good practice to find a Dynamic DNS service provider to offer a sub-domain name for your router. Check the user manual for your router for detail and recommended DyDNS service provider and apply for a free account. I picked 3322.org because it is popular in China. Its HTTP get URL method is also simple enough for an embedded web server.
Firmware
The firmware for DigiButler is a modified version of ColdFire Lite HTTP server software available from Freescale, which was built with NicheLite TCP/IP stack and described in AN3455 and AN3470. DigiButler adds essential HTTP basic authentication and extra mobile WAP pages to push the project more attractive. An Elektor reader presents an online demo to allow people to evaluate it. The whole project code size is very compact, which only uses 81KB ROM, so it leaves 45KB for web page storage. If you set the optimization to Level 1, the code size can be reduced to 58KB ROM. You can also use 256/512KB version to add more pages and features. The original DigiButler also allows dynamic reloading the web pages into the internal flash memory by a special remote uploading program connects port 80. This feature offers great flexibilities, although I don't think remote web page reloading is a secure and safe approach.
The latest NicheLite TCP/IP stack is v3.0 for MCF52259, with much more example projects. The enclosed web server project also incorporates USB stack lite from CMX. As a result, it can store much more web pages in external USB stick. Since these projects have many differences, I decided to add DigiButler added features to updated ColdFire TCP/IP Lite v3.0, rather adding USB OTG features back to DigiButler project.
And the first release is finished and working on the Kirin3 demo kit already. Basically I added HTTP authentication for NicheLite TCP/IP stack, since I think it is an essential feature for final product. Then most of other features can be implemented by web pages. The revised code is released on the Featured Open Source Projects, based upon Google sites service. I will move my revision to Google code I get enough positive responses. Google code offers a professional project hosting service, including subversion and Wiki pages. So everybody can join the project and push it to more complete reference design. I write down a list, so you guy can help me decide which one goes first.
Development Plan
Obviously, after implementing the basic HTTP protocol, we are moving into the application level of embedded web application. Structured Meta data exchanging is the essential requirement for a connected device. So I will emphasis on XML data generator and parser on DigiButler project.
XML data generator (Server)
- Offering data in XML format, such as RSS feed of status update for on chip resources or off-board devices, so the structured data can be displayed in many forms in different client terminals (web, mobile, RSS reader). Since RSS/ATOM is a unidirectional communication, we will leave a control interface (service points) on DigiButler.
- Light-weight Meta data format in JSON, so the client side (browser or other web server) can easily get the data and presented in human readable format.
XML data parser (Client)
- Reading external structured data in XML or JSON format, to control local resources or display on attached local display. A connected LED commercial display is a typical application.
- Logging systems, which can send logging data to assigned online databases.
- An embedded control system to send alert messages to specified addresses of the stakeholders by SMS text or update status in your favorite social webs. Most of services are offered as XML or JSON format.
XML data exchanging (Client and Server)
- UPnP device. UPnP heavily relies on XML standard for service discovery and data exchange. We can not expect every end user can work as an engineer, who knows compiler and programming. So we must find a smarter way to let the devices interface seamlessly. Otherwise this project will be forgotten very soon. It is important to define a way to allow DigiButler to discovery the services of connected peripherals and prepare web page on the fly.
Presenting Skills (JavaScript, XML and SVG/SIML)
- Data analysis, presentation and rending is very helpful in embedded control system, an animated dash board is still preferred by the end users, rather than the figures. Since the modern browser all supports JavaScript, XML and SVG/SIML, it is easier to design a fully interactive control interface on your web browser.
Web Mash up Application
- Offering a mash up web to connect end users and administrator, for example, put a web IM or chat room so people can contact administrator anytime.
- Widget based front-end running on Yahoo Widget, or other Flash based widget.
Secure Communication
- Leverage CAU for HTTP Authentication Digest and secure HTTP communication.
References
- TBLCF open source debugging cable
- OSBDM JM60, Open source BDM debugger
- Elektor DigiButler Project Collection Paper 1
- Elektor DigiButler Project Collection Paper 2
- ColdFire TCP/IP Lite M52259 release (AN3470/AN3779)
- DigiButler for Kirin3 release
- SVG animation with JavaScript
- UPnP Forum
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.
- allankliu's blog
- 387 reads





Post new comment