I have reduced quantity of repetitions in for statement down to 256, and increased buffer size when calling f_write to 4096, so it is still 1M of size. In default test, with 2048 times of 512 blocks, I got 230Kb/s only.
00157.273 Load a driver for each IF. 00157.285 Try load driver MSD 00157.311 BULK IN endpoint found: bEndpointAddress=81 00157.362 BULK OUT endpoint found: bEndpointAddress=02 00157.404 Reading Max LUN: 00158.433 max_lun = 1 00158.453 MSD[BIN ]: Open EP 00158.488 MSD[BOUT]: Open EP 00158.518 INQUIRY... 00159.724 PDT=00 00159.739 TEST UNIT READY... 00159.906 TEST UNIT READY: Command Failed 01371.478 REQUEST SENSE: Sense key=6, ASC=28, ASCQ=00 01371.522 TEST UNIT READY... 01372.076 Ready. 01372.082 READ CAPACITY(10)... 01375.161 Block size=512bytes, blocks=15130624 (~7388 MB) 01375.208 MSD Connected.
00159.739 TEST UNIT READY... 00159.906 TEST UNIT READY: Command Failed 01371.478 REQUEST SENSE: Sense key=6, ASC=28, ASCQ=00 01371.522 TEST UNIT READY... 01372.076 Ready.
is completely normal; TEST UNIT READY fails until the USB stick is ready (check the sense key code table).
I think the speeds are also normal. You can check the maximum speed using a PC, connecting the USB stick through a *full speed* USB hub.
mobyfab, I did not forked repo, but I can make a diff for you (or make a fork, if it will more suitable for you). But this is useless, you cannot just apply changes.
My modifications: 1. changed list.h, and all places where macros from it was called, but in MSD and main sources. Changes can be applied directly, but it is needed to change same way sources for rest of drivers.
2. alignment and defining buffers. was changed by adding #pragma data_alignment and removing GCC macro, so this cannot be applied as is, checking for compiler needed. Also, I'm not sure that I did it right way (yes, it works, but may this is my luck?)
3. packed structures. Defining structs was changed in many places, and again, it is needed to add compiler checks there.
Sorry, but my patches is just a test now, not ready-to-repo sources, and I do not know how to make it right to be included in repo. Some checking and changed are needed..
I will try to make all I can with sources, and then I will fork repo and will make push request. But I do not know if I will able to get it roght way.
I took fresh repo and made my changes one more time, to get more accurate results. Then I made pull request to main repo: - changed list.h to eliminate using of typeof(), changed all calls in sources - removed aligning in IAR due to automatic align(4) in IAR (except one place where aligning was added by two-bytes variable) - changed GCC's atrribute packed to ChibiOS's PACKED_VAR - now TEST UNIT READY placed before READ CAPACITY as dismirlian suggested