FM4 MCUs support both USB Device and Host Applications. As easy to use USB Wizard Tool is available in:
Using this tool you can configure the required USB application (device or host), USB class, Pins to be used etc.
The tool also provides features to develop projects targeted either for the board (DVK) or the device.
Here we will see how it can be configured as a USB Mass Storage Device along with USB CDC. We use the S6E2CC -ETH Kit for Demo.
First, in the wizard - you need to select the board, configure it as a USB device as shown below:
Now, you can scroll over the next pages and specify the Class as Mass Storage as shown below:
For testing purpose, you can use the default VID and PID:
Once you click "Next" a complete project will be created for the USB Application. This project will have all the necessary files including the necessary USB drivers and so on.
The project structure will look like:
This project can be opened with various IDEs like IAR, uVision, iSystem, Atollic. I have tested this project with IAR.
You can open the project in IAR and modify the source files based on your requirement.
Note that the disk can be write protected by using:
#define DISK_USAGE FLASH_RO_DISK
Currently, in the attached project which is generated using this wizard, there is write protection. If you do not want Write protection then use:
#define DISK_USAGE RAM_RW_DISK
You can program this project onto the Kit and then connect a USB cable to the USB port. For the first time, you may need to bind the drivers manually (drivers are available in the "drivers" folder). After successful binding, you can see the mass storage device getting enumerated and can access the contents inside.
The FM4 device also enumerates as Virtual COM port. You can connect to this COM port using Teraterm, or any other COM interface applications and perform USBUART communication with FM4.
FM4 USB Mass Storage ProjectC/C++
No preview (download only).
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!