raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.02k stars 4.95k forks source link

Rasperry pi zero - g_mass_storage transfer problem #2657

Closed pawe213 closed 4 years ago

pawe213 commented 6 years ago

Hi, I'm using raspberry pi zero in the otg mode. When I connect the pi to PC (windows) everythings work fine. 1)When conntected to embeded device there is problem with downloading files bigger than > 100 KB Device inform me that the amount of data recieved is smaller then requested. - Everything works fine with standard pendrive connected instead Pi. 2) Durings some test occoured that connection is less stable than with normal USB pendrive - when downloading many files from Pi the connection was "broken"

I have tried to change stall to 1, also I played a little with dwc_otg parameters, but nothing chagned.

1) Do you have some idea, how to solve the problem with transfering to less data? 2) Is there a way to make connection more stable?

Host device for emulated mass storage - Aurix microchip, problably with AUTOSAR on board.

About Pi configuration: 1) The newest RASPBIAN STRETCH is installed (the update was also done) 2) The loaded driver is dwc2 - I couldn't find any other for OTG mass storage 3) The partition image was made with command: sudo dd bs=1M if=/dev/zero of=/piusb.bin count=400 sudo mkdosfs /piusb.bin -F 32 -I and modprobe is done with command: sudo modprobe g_mass_storage file=/piusb.bin stall=0 ro=1 removable=1

lategoodbye commented 6 years ago

Does it means both issues only occur with the Aurix microchip? What exactly happend when the connection "break" (kernel warning on raspberry pi)? How many are many files?

Changing dwc_otg parameter doesn't have any affected because dwc2 is a different driver. Please test rpi-4.18 because since 4.14 there has been a lot of improvements to dwc2.

pawe213 commented 6 years ago

Hi,

Thanks and sorry for late respons.

I didn't notice any information about transfer on Pi about g_mass_storage. On Aurix I can see that the downloading was interrupted and only in one case on two I get the information why (data recieved is smaller then requested).

The number of filles is different (from 3 to 30).

Is there a way to check the logs from g_mass_storage on Pi?

lategoodbye commented 6 years ago

I myself use a USB to serial adapter connected to the debug UART on the GPIO header.

pawe213 commented 6 years ago

After tough attemps, I finnaly installed rpi-4.18, but the error is the same. During downloading files there is error that received package was smaller than requested 20480/32768 bytes. Is there a way to change the packets/transfer size?

pawe213 commented 6 years ago

In the :rpi-linux\linux-rpi-4.18.y\drivers\usb\dwc2\params.c there is variable p->max_transfer_size = 65535; But the value seems to be proper. Someone know how it works? Is the transfer size related to host request?

lategoodbye commented 6 years ago

May you can try usbmon to capture the traffic and report it to linux-usb upstream mailing list.

JamesH65 commented 5 years ago

Please try the latest kernel.

This issue will be closed within 30 days unless further interactions are posted. If you wish this issue to remain open, please add a comment. A closed issue may be reopened if requested.

JamesH65 commented 4 years ago

Closing due to lack of activity. Please request to be reopened if you feel this issue is still relevant.