Helloworld program for the S25FL216K flash memory in combination with USBFileSystem
Dependencies: S25FL216K_USBFileSystem mbed
This HelloWorld program is for the serial flash memory mounted on the Wi-Go board. If yours isn't mounted on it, then you probably will need some other pin definitions.
To use this program plugin both the openSDA USB port and the KL25Z USB port. Use your favourite terminal program to listen to the com-port generated on the openSDA USB port. The KL25Z USB port will emulate a USB MSD device.
Load this program, reset the board. If everything goes correctly a pop-up will appear that the drive needs to be formatted (tested on Windows 8, but I assume it is similar on other OS'). This is because the flash memory is completely empty, no filesystem is available. Just use standard settings (512 byte sector size), and format the drive. When this is done reset the board again.
This time it should load without popup, and after a small pause the flash drive should appear on your computer. On it is a single file, open the file, write something, save the file. Whatever you wrote should appear in your terminal program.
Aditionally the other way around also works, write something in your terminal program, hit enter, and a file is created with whatever you wrote in it. IMPORTANT: In TeraTerm you need to have transmit settings on CR+LF! (Found in Setup > Terminal).
Revision 3:321618d7c9a5, committed 2013-11-19
- Comitter:
- Sissors
- Date:
- Tue Nov 19 21:09:35 2013 +0000
- Parent:
- 1:e8698224bb08
- Commit message:
- Bugfix
Changed in this revision
diff -r e8698224bb08 -r 321618d7c9a5 S25FL216K_USBFileSystem.lib --- a/S25FL216K_USBFileSystem.lib Fri Aug 02 19:01:53 2013 +0000 +++ b/S25FL216K_USBFileSystem.lib Tue Nov 19 21:09:35 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/Sissors/code/S25FL216K_USBFileSystem/#355e49586f92 +http://mbed.org/users/Sissors/code/S25FL216K_USBFileSystem/#ec125501d68f
diff -r e8698224bb08 -r 321618d7c9a5 main.cpp --- a/main.cpp Fri Aug 02 19:01:53 2013 +0000 +++ b/main.cpp Tue Nov 19 21:09:35 2013 +0000 @@ -18,7 +18,7 @@ int main() { flash.attachUSB(&usbCallback); - + wait(0.1); printf("Hello World!\r\n"); @@ -26,7 +26,10 @@ if(fp == NULL) { printf("Could not open file, assuming unformatted disk!\r\n"); - printf("Click in the nice popup window to format disk with default settings!\r\n"); + printf("Formatting disk!\r\n"); + flash.format(); + printf("Disk formatted!\r\n"); + printf("Reset your device!\r\n"); while(1); } else { wait(0.2);
diff -r e8698224bb08 -r 321618d7c9a5 mbed-src.lib --- a/mbed-src.lib Fri Aug 02 19:01:53 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/Sissors/code/mbed-src2/#aee376ec5d1a
diff -r e8698224bb08 -r 321618d7c9a5 mbed.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.lib Tue Nov 19 21:09:35 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/#673126e12c73