Hi All.
I'm going to create some kind of usb storage device, and I'm planning to use LPC2148 microcontroller in it. I need some advices. Is this controller suitable for such task? Can external flash memory be mapped to the controllers adress space (to work with it like with internal controllers memory in the programm)? Which protocol is better to choose for this task (which one will be faster) to connect external memory chip and controller: I2C or something else?
Thanks for your answers!
Elaborate more about the application. You said just 1) USB connection, 2) external FLASH chip, briefly.
a) USB connection - How the device appears on the PC As a mass storage (like USB stick or drive) - Fit to static data exchange (like stand-alone data logger) - - Stored data is not changed by the device while USB connection - Data is handled as files on the File system of the PC - Host app accesses to it through File system API of the OS - File system handler is also required on the device side
As a direct device (bulk or HID) - Fit to dynamic data exchange (like FLASH writer) - - Stored data may be changed by the device while USB connection - Data is exchanged over File I/O API for USB (or HID API) on the PC - Device firmware is much simpler than above
b) Data storage size of the external FLASH on the device board - Mega-Giga Bytes - SD card over SPI or SD_MMC card interface - 64K-16M Bytes - Parallel FLASH (SST 39, etc) over address/data bus - 64K-16M Bytes - Serial FLASH (ST micro M25P, Winbond, etc) over SPI - 128-128K bytes - I2C EEPROM
Tsuneo
Thanks for your answer, Tsuneo. You are right, I need to say more. The device will work like flash drive, but the data will not be handled as files on the File system of pc. Data will be handled using special application running on PC. If HID connection can give me normal transfer speed (like normal usb flash drive devices) - I will use it. Amount of data will be 1 or 2 GBs. I need to decide which controller to use (does LPC2148 can solve my tasks?), how to connect it to the pc (does HID connection can be such fast as I need?) and what flash memory chip to use in the device (what protocol of connection between controller and memory can give me required speed and handle required amount of dat?).
Thank you.
"what protocol of connection between controller and memory can give me required speed"
Q1: How fast is the required speed, in MByte/sec?
Give us the figure. An approximate number will do. Your description is literary. We are engineers who are far from literature :-) Unfortunately, we can tell nothing until we see the figure.
USB connection "Data will be handled using special application running on PC.... Amount of data will be 1 or 2 GBs."
Seems a good application for High-Speed (HS, 480Mbps) bulk transfer.
LPC2148 supports just Full-Speed (FS, 12Mbps). On FS, the transfer speed is about 1.2 Mbytes/sec at most. Then, the transfer of 1-2 GBytes data results 1000-2000 sec. On HS, practical transfer speed is 10-20 MBytes/sec. The 1-2 GBytes are transferred in 100-200 sec.
HS ARM MCU: NXP LPC288x, Atmel AT91SAM9R64 HS '51 MCU: Cypress EZ-USB FX2LP (CY7C68013A) HS Peripheral: NXP ISP1582, Cypress EZ-USB SX2 (CY7C68001)
I recommend you to combine EZ-USB SX2 with your favorite MCU. It's a simple solution for USB beginner.
On the other hand, I don't recommend LPC288x to you; read this Olimex fight with the chip. forum.sparkfun.com/viewtopic.php
The problem for the device of generic bulk transfer is the device driver selection on the PC. It depends on the OS on the PC.
Q2: What is the target OS on the PC? Windows? Then what is the Windows version(s) to be supported?
Q1: I'm not sure yet will I stop on LPC2148 or on some of the HS MCUs. When I'm saying the required speed I mean what memory chip can operate with controller not slower then controller with PC. Q2: target OS is Windows. versions to be support - 2000 and higher I think (if Windows 2000 is a problem I can think about XP and higher). Can HID device work on 10-20 MBytes per second? Or I will need to create a driver for the device?
I'm a beginner in this. This is something like study work. So I'm thankful to you for your help.
What do you mean by "something like" study work?
This mean that I'm just learning how to create devices on this device. Why are you asking?
Hello Alex,
You asked: I'm going to create some kind of USB storage device, and I'm planning to use LPC2148 microcontroller in it
Download the latest ARM evaluation demo at:
http://www.keil.com\demo
Install the Keil tools for ARM and look at this example on your hard drive at:
\Keil\ARM\Boards\Keil\MCB2140\USBMem\Memory.Uv2
From the Abstract.txt file:
The Memory project is a demo program for the Keil MCB2140 Board using the Philips LPC2148 Microcontroller. It demonstrates an USB Memory based on USB Mass Storage Class.
More details are in the MCB2140 User's Guide, found at:
http://www.keil.com/support/man/docs/mcb2140/mcb2140_ex_usbmem.htm
If you had the full version of the Keil tools, you could modify the example under project-> options for target -> 'target' tab to include off chip memory.
Keil also offers a flash file system call RL-FLash, which would help you organize data stored in external media. See:
http://www.keil.com/support/man/docs/rlarm/rlarm_fs_flashfs.htm
"I'm not sure yet will I stop on LPC2148 or on some of the HS MCUs."
I think you've already have a LPC2148 board. As Kevin suggested, start your USB study on it. You can make a prototype on LPC2148, though your final goal is the handling of 1-2GBytes data. Once you've learned on an USB MCU, this experience is easily applicable to most of USB MCUs.
As USB spec defines the behavior of USB engines on the device in details, the implementation of the USB engine is much the same for most of USB MCUs. Therefore, 80-90% of C source code is reusable even for other chip, just replacing the low-level handler.
There are no difference on the host application, even when you change the USB MCU for the device, as long as the device has the same USB configuration.
LPC2148 is equipped FS (Full-Speed) USB engine. Then, you cannot expect so fast transfer speed.
Practical speed of FS bulk is 800 KBytes or so (Theoretically, 19 transaction/frame at most).
64 (bytes/packet) x 13 (transaction /frame) x 1000 (frame /sec) = about 800 (KBytes/sec)
As of FS HID, about 64 Kbytes/sec at most. It's the limit of interrupt transfer, on which HID is established. 64 (bytes/packet) x 1 (transaction /frame) x 1000 (frame /sec) = about 64 (KBytes/sec)
Alex, Pay attention to the following: If you intend to use your device as a mass storage device, its file system shall be mount on the file system of your PC. That means that only your PC is allowed to determine the contents of the LPC's file system! i.e, your controller cannot spontaneously create files and expect the PC to remain synchronized. Something else you may want to try is a CDC - a virtual com port. It supports full speed connections, and you communicate with the device as if it is a serial device!