Mass storage, or what are good alternatives?
Mass storage, or what are good alternatives?
Hello guys,
I'm developing a device that should present itself just like a mass storage device. Unfortunately, mass storage devices require bulk endpoints which aren't allowed for low-speed implementations.
So I have two questions:
1. How are the chances for getting a low-speed mass storage device (more or less reliably) working?
2. Are there alternatives to mass storage devices which behave similar and don't need special drivers and/or software? I'm trying to make the device as easy-to-use as possible, so a special software including libUSB isn't a good alternative...
Thanks in advance,
Philipp
BTW: Should I post here in English or German (My native language)?
I'm developing a device that should present itself just like a mass storage device. Unfortunately, mass storage devices require bulk endpoints which aren't allowed for low-speed implementations.
So I have two questions:
1. How are the chances for getting a low-speed mass storage device (more or less reliably) working?
2. Are there alternatives to mass storage devices which behave similar and don't need special drivers and/or software? I'm trying to make the device as easy-to-use as possible, so a special software including libUSB isn't a good alternative...
Thanks in advance,
Philipp
BTW: Should I post here in English or German (My native language)?
You can post in English or German, but you can expect more answers to English posts since more users speak English. It's also more polite to others who don't speak German.
I have no experience how reliable a mass storage low speed device would be. The latest version of the driver can implement enough endpoints for this type of device. Most operating systems allow bulk endpoints for low speed devices (except one of the two Linux USB drivers). The main problem is AVR CPU load. Having bulk endpoints puts a very high load on the CPU.
A special software is often the best solution. This does not mean that you need to install it on Windows. HID based devices don't require .inf files, they work "out of the box".
I don't know what you want to implement, but it might be possible to implement a keyboard, mouse or other HID.
I have no experience how reliable a mass storage low speed device would be. The latest version of the driver can implement enough endpoints for this type of device. Most operating systems allow bulk endpoints for low speed devices (except one of the two Linux USB drivers). The main problem is AVR CPU load. Having bulk endpoints puts a very high load on the CPU.
A special software is often the best solution. This does not mean that you need to install it on Windows. HID based devices don't require .inf files, they work "out of the box".
I don't know what you want to implement, but it might be possible to implement a keyboard, mouse or other HID.
christian wrote:I have no experience how reliable a mass storage low speed device would be. The latest version of the driver can implement enough endpoints for this type of device. Most operating systems allow bulk endpoints for low speed devices (except one of the two Linux USB drivers). The main problem is AVR CPU load. Having bulk endpoints puts a very high load on the CPU.
Ok, so it /should/ work on Windows. The CPU load could be a problem indeed, however, the CPU doesn't need to do anything else than read from the SD-Card and put the data to the Host (Well, almost nothing else, it has to present some files which aren't really present on the SD-Card, but that can be done when there is time I suppose...).
christian wrote:A special software is often the best solution. This does not mean that you need to install it on Windows. HID based devices don't require .inf files, they work "out of the box".
Yes, a HID-Device would be an alternative, but the (almost) only purpose of the USB-Connection is to transfer text files to (or from) the device. An MSD should be the ideal type for this I think...
christian wrote:I don't know what you want to implement, but it might be possible to implement a keyboard, mouse or other HID.
Not really. The device will be a trainer for morse code, so I need to put text on the SD-Card of the device...
I've posted on www.mikrocontroller.net too (german), if someone wants to have a look there: http://www.mikrocontroller.net/topic/87416
Thanks,
Philipp
Regarding CPU load: The load is always above 90%, not only if data is transferred. That's because USB is a host-driven bus and the host polls the device for data when there is nothing else to transfer.
But I think that it SHOULD work. It's the task of the low level driver to enforce "no bulk endpoints on low speed devices" and Windows does not enforce this. The higher level drivers usually don't care. Since Windows has no general concepts (every driver is developed by a different group of people with different ideas), it's still possible that the MSD driver checks the bus speed.
You may want to look at our Automator project. We also need to send data to the device (or receive data from the device) in Automator. We did this as HID with a host-side application. The host-side application is based on a cross-platform framework (fltk) and can thus be ported to Windows, Mac and Unix. It's even possilbe to cross-compile for Windows and Mac on Linux.
If you succeed with mass storage, this would be a great example, though. As far as I can see on www.mikrocontroller.net, the driver does not like your descriptor(s). Did you check the event log for error messages? Maybe it's possible to enable more verbose loggings.
But I think that it SHOULD work. It's the task of the low level driver to enforce "no bulk endpoints on low speed devices" and Windows does not enforce this. The higher level drivers usually don't care. Since Windows has no general concepts (every driver is developed by a different group of people with different ideas), it's still possible that the MSD driver checks the bus speed.
You may want to look at our Automator project. We also need to send data to the device (or receive data from the device) in Automator. We did this as HID with a host-side application. The host-side application is based on a cross-platform framework (fltk) and can thus be ported to Windows, Mac and Unix. It's even possilbe to cross-compile for Windows and Mac on Linux.
If you succeed with mass storage, this would be a great example, though. As far as I can see on www.mikrocontroller.net, the driver does not like your descriptor(s). Did you check the event log for error messages? Maybe it's possible to enable more verbose loggings.
Don't ask me why, but it suddenly works... Windows rulez I suppose...
Ok, that's no problem because USB is only enabled to transfer data. In normal operation, the driver is disabled.
Well, maybe. But either this check is somewhat buggy or it isn't really implemented, since it seems to work now, there can't be a serious problem...
Yes, I've already checked that program. That would be the alternative if I can't get the whole thing working...
I'm implementing the USB-Bootloader for this project right now. I'll send you the whole project once it's finished.
I've not checked the event log, no. Would have been a good idea... However, what really confused me is that there weren't any logged packets at all. I've tried USB-Monitor from hhdsoftware, USBSnoop and another Sniffer, but there haven't been any messages, altough the device appeared in the device manager as "USB device" or with my specified name string (But without a driver).
Right now, I can only say thank you very much for this cool USB-Driver! I'll drop a note if there are any news (good or bad). But now, it's time to sleep...
christian wrote:Regarding CPU load: The load is always above 90%, not only if data is transferred. That's because USB is a host-driven bus and the host polls the device for data when there is nothing else to transfer.
Ok, that's no problem because USB is only enabled to transfer data. In normal operation, the driver is disabled.
But I think that it SHOULD work. It's the task of the low level driver to enforce "no bulk endpoints on low speed devices" and Windows does not enforce this. The higher level drivers usually don't care. Since Windows has no general concepts (every driver is developed by a different group of people with different ideas), it's still possible that the MSD driver checks the bus speed.
Well, maybe. But either this check is somewhat buggy or it isn't really implemented, since it seems to work now, there can't be a serious problem...
You may want to look at our Automator project. We also need to send data to the device (or receive data from the device) in Automator. We did this as HID with a host-side application. The host-side application is based on a cross-platform framework (fltk) and can thus be ported to Windows, Mac and Unix. It's even possilbe to cross-compile for Windows and Mac on Linux.
Yes, I've already checked that program. That would be the alternative if I can't get the whole thing working...
If you succeed with mass storage, this would be a great example, though. As far as I can see on www.mikrocontroller.net, the driver does not like your descriptor(s). Did you check the event log for error messages? Maybe it's possible to enable more verbose loggings.
I'm implementing the USB-Bootloader for this project right now. I'll send you the whole project once it's finished.
I've not checked the event log, no. Would have been a good idea... However, what really confused me is that there weren't any logged packets at all. I've tried USB-Monitor from hhdsoftware, USBSnoop and another Sniffer, but there haven't been any messages, altough the device appeared in the device manager as "USB device" or with my specified name string (But without a driver).
Right now, I can only say thank you very much for this cool USB-Driver! I'll drop a note if there are any news (good or bad). But now, it's time to sleep...
For endpoints 0, 1 and 3 (this is the default endpoint number, actual numbers may be assigned differently), there are global variables
volatile uchar usbTxLen;
volatile uchar usbTxLen1;
volatile uchar usbTxLen3;
(only usbTxLen1 and usbTxLen3 are declared extern in the header, if you need to stall endpoint 0, declare usbTxLen yourself).
To stall an endpoint, set its txLen to USBPID_STALL. To remove the stall condition, set it to USBPID_NAK.
We may add an abstraction layer to this mechanism later, but this method should continue to work.
volatile uchar usbTxLen;
volatile uchar usbTxLen1;
volatile uchar usbTxLen3;
(only usbTxLen1 and usbTxLen3 are declared extern in the header, if you need to stall endpoint 0, declare usbTxLen yourself).
To stall an endpoint, set its txLen to USBPID_STALL. To remove the stall condition, set it to USBPID_NAK.
We may add an abstraction layer to this mechanism later, but this method should continue to work.
Well, I'm still on it. The basic functionality seems to work quite well, the device presents itself to the host as a mass storage device. But the command flow causes some trouble, vendor-specific commands are used and although I report an error, the computer still tries the same command. But I think, I'll find ways to get it working when I've time...
-
- Posts: 1
- Joined: Wed Apr 16, 2008 8:12 pm
- Location: Switzerland
- Contact:
Sure. Here you are: http://activevb.de/members/philippburch ... dr_avr.zip
But please note: The code is quite ugly and one single construction site (Just look at the warnings generated by the compiler...), I'm not even sure what "features" are supported and working in this version. My intention was to create a USB bootloader for the bigger AVRs, but mass-storage devices only support direct reads and writes to the filesystem, so I would need to emulate a FAT... Not really suitable for a bootloader.
But please note: The code is quite ugly and one single construction site (Just look at the warnings generated by the compiler...), I'm not even sure what "features" are supported and working in this version. My intention was to create a USB bootloader for the bigger AVRs, but mass-storage devices only support direct reads and writes to the filesystem, so I would need to emulate a FAT... Not really suitable for a bootloader.