WIZnet WIZwiki-W7500 is recently selected as an official mbed-enabled. mbed is open development platform run by ARM. If a board is mbed-enabled, you can program the MCU in the board by using on-line compile tool which is provided by mbed. If so, you can have the advantage of searching of various examples on-line and easy access of them.
This posting will show how you can start with mbed web compiler and create a program the ‘SD file list on web browser’ using mbed web compiler.
ARM mbed Web Compiler
Since ARM mbed is open community site for ARM(Cortex-M) makers, it not only supports web development environment but also shares codes each other. ARM mbed supports engineers to build a new project faster and easier.
You can use the web compiler for free after registering ARM mbed website.
Find web compiler button on upper right corner of picture below and press this after logging in. Then it will link you to web compiler.
This is mbed web compiler. When you import a program or library on example or application you want, imported program or library will be loaded on web compiler.
Search with the program or library on mbed developer site, then click on the proper program. After clicking the program, click on either [Import this program] or [Import this Library] to load on your own web compiler.
HTTP SD Card File Server on WIZwiki-W7500 Platfor
1. Import Program on ARM mbed developer site
Let’s create a program showing SD File list on web browser using ARMmbed web compiler and WIZwiki-W7500 platform.
As explained above, various examples exist on mbed. Although you all know how to create codes without any help, using open source will help you to create a personal program much easier.
Now, we will search the program by using the key words “HTTP” and “SD”. Below program is searched. We will just import it.
After the Program is successfully imported, the program workspace of compiler pops up same as following.
Click on [mbedLPC1768] icon on the upper right of ARM mbed web compiler, then press [Add Platform] on Platform list and select WIZwik-W7500 Platform.
Delete (right click then click on delect) mbed-rtos since it is dormant library now. Or you can switch (add after deleting) lwip based EthernetInterface Library into WIZnet Interface Library.
Import WIZnetInterface Library on https://developer.mbed.org/teams/WIZnet/. Import it as ExampleHTTP_SD_Server_K64F program.
Platform and Library should be successfully converted. Next step is a compiling.
Error below occurs when [Compile] button is clicked.
This error occurred because mbed library was not updated. Therefore, double click “mbed” library on [Program Workspace] page then update mbed library by clicking “Update” on [Library Details] page.
When compile is repeated, 5 errors occur combined of 4 SDFileSystem and 1 of eth.init errors,
Fix contents below on ‘main c’.
- SDFileSystem Instanciation
When SDFileServer class created on’ main.c’, modify referring WIZwiki_W7500의 SD card Interface Circuit diagram.
//SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // K64F
SDFileSystem sd(PB_3, PB_2, PB_1, PB_0, "sd"); // WIZwiki-W7500
- Ethernet Initialization
When DHCP is in use, operate ethinit(MAC) instead of ethinit() and operate eth.init((uint8_t*)MAC,IP,MASK,GATEWAY) when Static IP is in use.
#define MAC "\x--\x--\x--\x--\x--\x--" // Should be Replaced -- with your MAC
#define IP "192.168.77.100" // Should belong with your lan.
#define MASK "255.255.255.0"
#define GATEWAY "192.168.77.1"
//eth.init((uint8_t*)MAC); // Use DHCP for WIZnetInterface
As WIZwiki-W7500 supports CMSIS-DAP, the code flash of W7500 is acknowledged as USB storage. After successfully finishing the compile at the web compiler, download the binary image into local directory. Then write the program into WIZwiki-W7500 just by copy the binary and paste into USB storage.
3. Test & Demo
Let’s test if SD card list is actually displayed on the web.
This project can be imported from below URL or WIZwiki-W7500 example programs. On/Off toggle code controlling LED1 and LED 2 applying Ticker to check the activity status also added below.
- To Import the example
- Wiki on ARMmbed
Connect to WIZwiki-W7500 through Web-Browse
You can see the file list on the web as below.