Nevermind, I've located the version which worked for me - it's https://github.com/dsigma/ChibiOS
I've added a demo for EMBEST_DMSTF4BB board - see https://github.com/rusefi/ChibiOS/tree/ ... SS-STORAGE
Tested on Windows 7 & 10, both read & write work. Next step for me is still to migrate to SPI.
USB Mass Storage Device
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: USB Mass Storage Device
Russian, sorry for the late reply. I use HS PHY USB3300 and the latest version of Chibios.
Re: USB Mass Storage Device
russian wrote:Next step for me is still to migrate to SPI.
Got it working via SPI. The code is a bit ugly and transfer is about 500K a second, but it works!
https://github.com/rusefi/ChibiOS/tree/ ... TORAGE-SPI
Re: USB Mass Storage Device
I did not realize this functionality would require about 20K of RAM. I guess the largest contributor is the array of two rw_usb_sd_buffer_t which are 8K each (#define BLOCK_SIZE_INCREMENT 512
#define BLOCK_WRITE_ITTERATION_COUNT 16)
I've tried lowering these constants and this seems to break the functionality. Is it possible to lower thiis 16-20K ram consumption?
I guess it's really time to move to stm32f429discovery with it's 8Mb of ram
#define BLOCK_WRITE_ITTERATION_COUNT 16)
I've tried lowering these constants and this seems to break the functionality. Is it possible to lower thiis 16-20K ram consumption?
I guess it's really time to move to stm32f429discovery with it's 8Mb of ram
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: USB Mass Storage Device
I guess that Chibios desperately needs a standard USB mass storage driver to be added to official repository. At the same time, it is a little bit embarrassing situation to have an official USB Host driver (it is a rare demand for the embedded device). But what driver is the best?
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: USB Mass Storage Device
Does the mass storage even qualify as driver? it is mainly part of the application layer, same for HID. CDC is pretty much the exception because the serial port emulation is very "stand-alone".
I am open to proposals about a driver, we need a reference usbcfg.c/h and stand-alone module usb_msd.c/h with well defined interfaces.
Giovanni
I am open to proposals about a driver, we need a reference usbcfg.c/h and stand-alone module usb_msd.c/h with well defined interfaces.
Giovanni
Re: USB Mass Storage Device
Hi Russian,
I have also been trying to get this working, however with very little success so far.
I looked through your code, but I can't quite tell which version of usb_msd.c/.h you are using.
The ones in your git are from chibios 2.6.8 which are a few years old and quite different from the ones on dsigma/chibios3.0.
So which os/various files are you are you actually using?
And you mention you are using HS with 500k bps, have you also tried it at FS?
And if so, what sort of performance does it get?
Thanks,
Al
I have also been trying to get this working, however with very little success so far.
I looked through your code, but I can't quite tell which version of usb_msd.c/.h you are using.
The ones in your git are from chibios 2.6.8 which are a few years old and quite different from the ones on dsigma/chibios3.0.
So which os/various files are you are you actually using?
And you mention you are using HS with 500k bps, have you also tried it at FS?
And if so, what sort of performance does it get?
Thanks,
Al
Re: USB Mass Storage Device
Hi,
I am no longer working on this right now, but thought the heritage of the various Device MSCs initiatives and some other observations might help someone else.
There seem to be 2 main code sources that all the MSC prototypes that I uncovered stemmed from:
1) mabl (= Giovanni?) - released Mar 2011 - about 460 lines in usb_msc.c/.h,
- couldn't find corresponding demo or configurations, but seems like might have worked
- https://github.com/mabl/ChibiOS/tree/2b ... os/various
2) trsaunders - released Sept 2012 - about 900 lines in usb_msc.c/.h
- there are demos and config files for F407 (olimexE407) and seems like significant portions were working but still described as prototype
- https://github.com/trsaunders/Chibios-U ... ss_storage
From mabl there were 2 derivatives:
- dsigma/Chibios - May 2013, seems like minor changes only
- https://github.com/dsigma/ChibiOS/tree/ ... os/various
- rusefi - July 2016 - minor enhancements to dsigma, and seems to be working using SPI
- https://github.com/rusefi/ChibiOS/blob/ ... /usb_msc.c
From trsaunders there 2 derivatives:
- tegesoft - Oct 2013, about 1010 lines, deusExMachina says got this working.
- https://github.com/tegesoft/Chibios-USB-Devices
- dsigma/Chbios3.0, May 2016, about 1800 lines, seems to have undergone significant enhancements, but still seems to be work in progress
- https://github.com/dsigma/ChibiOS-3.0/t ... ORAGE_VCOM
So in terms of getting to a working MSC seems like a few options are possible:
1) building from mabl and adding in tegesoft and/or dsigma/Chibio3.0 changes (and ST's)
2) building from tegesoft (adding in dsigma and ST's)
3) start over using ST's code as base (which is working) and get it to work on Chibios HAL and/or RT
In terms of getting a working USB Device Class combination of MSC with Chibios CDC/VCOM, which would be extremely useful for Chibios, I could not find wrapper functionality that adequately considered many of the various aspects required for the 2 classes combined.
And finally, an extremely important aspects that will need further detailed efforts: FS MSC throughput. A good target: >2MB/s (i.e. >33% FS bus utilization).
Regards,
Al
I am no longer working on this right now, but thought the heritage of the various Device MSCs initiatives and some other observations might help someone else.
There seem to be 2 main code sources that all the MSC prototypes that I uncovered stemmed from:
1) mabl (= Giovanni?) - released Mar 2011 - about 460 lines in usb_msc.c/.h,
- couldn't find corresponding demo or configurations, but seems like might have worked
- https://github.com/mabl/ChibiOS/tree/2b ... os/various
2) trsaunders - released Sept 2012 - about 900 lines in usb_msc.c/.h
- there are demos and config files for F407 (olimexE407) and seems like significant portions were working but still described as prototype
- https://github.com/trsaunders/Chibios-U ... ss_storage
From mabl there were 2 derivatives:
- dsigma/Chibios - May 2013, seems like minor changes only
- https://github.com/dsigma/ChibiOS/tree/ ... os/various
- rusefi - July 2016 - minor enhancements to dsigma, and seems to be working using SPI
- https://github.com/rusefi/ChibiOS/blob/ ... /usb_msc.c
From trsaunders there 2 derivatives:
- tegesoft - Oct 2013, about 1010 lines, deusExMachina says got this working.
- https://github.com/tegesoft/Chibios-USB-Devices
- dsigma/Chbios3.0, May 2016, about 1800 lines, seems to have undergone significant enhancements, but still seems to be work in progress
- https://github.com/dsigma/ChibiOS-3.0/t ... ORAGE_VCOM
So in terms of getting to a working MSC seems like a few options are possible:
1) building from mabl and adding in tegesoft and/or dsigma/Chibio3.0 changes (and ST's)
2) building from tegesoft (adding in dsigma and ST's)
3) start over using ST's code as base (which is working) and get it to work on Chibios HAL and/or RT
In terms of getting a working USB Device Class combination of MSC with Chibios CDC/VCOM, which would be extremely useful for Chibios, I could not find wrapper functionality that adequately considered many of the various aspects required for the 2 classes combined.
And finally, an extremely important aspects that will need further detailed efforts: FS MSC throughput. A good target: >2MB/s (i.e. >33% FS bus utilization).
Regards,
Al
- DeusExMachina
- Posts: 223
- Joined: Tue Apr 03, 2012 5:08 am
- Has thanked: 3 times
- Been thanked: 3 times
Re: USB Mass Storage Device
The maximum speed of HS USB file transfers which I have got so far is just 800KB/s.
Another issue was revealed today - MSD device does not work in iOS El-Capitan.
I really should find some time to put out my code on github...
Another issue was revealed today - MSD device does not work in iOS El-Capitan.
I really should find some time to put out my code on github...
-
jayalfredprufrock
- Posts: 36
- Joined: Tue Jan 13, 2015 6:33 am
- Has thanked: 8 times
Re: USB Mass Storage Device
DeusExMachina wrote:The maximum speed of HS USB file transfers which I have got so far is just 800KB/s.
Another issue was revealed today - MSD device does not work in iOS El-Capitan.
I really should find some time to put out my code on github...
I'd definitely be grateful to see your latest code for MSC functionality. I'd need it to work reliably on both windows and OSX so if it already works well on windows and older macs, I'd be willing to put some time into getting it to work on El Capitan.
Al B wrote:In terms of getting a working USB Device Class combination of MSC with Chibios CDC/VCOM, which would be extremely useful for Chibios, I could not find wrapper functionality that adequately considered many of the various aspects required for the 2 classes combined.
Al, thanks for compiling all that information and sharing. I did the same research a year or so ago and couldn't remember where I landed. I agree that a dual-class MSC + CDC would be the holy grail and incredibly useful! Still, I'd just be happy with a well-tested working MSC example for ChibiOS 3.