Jump to content

Recommended Posts

Posted

I am trtying to keep my pcduino 3 nano alive. It has been working perfectly under a debian bullseye distro from Johan Gunarsson for 4 years and now I can't get the OTG to work under any release (bullseye, bookworm or trixie) I have explored many avenues, but even a plain manual setup of g_mass_storage doesn't work in a workable way. The drive appears in Windows Explorer after several minutes, and any copy or delete to that gadget drive takes ages (3+ minutes for a 12kb file) before it fails or succeeds silently.

 

I am looking for a forum where pcduino users can help each other.

 

Thank you,

Gaetano.

Posted
13 hours ago, Gaetano said:

under any release


Userspace has nothing to do with hardware features. I don't know what is the case for A20, but for many others, OTG functionality is driven with overlays. If there are no overlays, you need to edit device tree and change its role. If that doesn't help, it is more complex problem.

 

13 hours ago, Gaetano said:

The drive appears in Windows Explorer after several minutes

 

More complex, perhaps days / weeks to debug and fix. Most of (Armbian) kernel developers are long gone from this 10+ years old platform :( and users can't help.

Also look into previous builds. Finding out when this broke is half of the solution https://fi.mirror.armbian.de/oldarchive/

or by finding a kernel that works https://docs.armbian.com/User-Guide_Armbian-Config/System/#alternative-kernels With any userspace (trixie/noble/jammy ...)

 

13 hours ago, Gaetano said:

I am looking for a forum where pcduino users can help each other.

 

Probably all A10 and A20 boards share this problem.

Posted

Hi Gaetano,

 

Maybe the issue is with g_mass_storage rather than OTG USB? "The "dr_mode" property controls whether OTG acts a peripheral or host. By default this is set to OTG mode so you shouldn't need to change anything. In my case I prefer to have OTG set as host for which I have this simple overlay:

dts-v1/;
/plugin/;

/{
    compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20";

    fragment@0{

        target = <&usb_otg>;

        __overlay__{

            dr_mode = "host";

        };

    };

};

 

 I find it works ok for reading a USB stick. It could be that you have to instead change dr_mode = "peripheral" but seeing as it shows up as a drive this may not be necessary.

 

What kernel version are you currently?

 

Are there any errors that show up in the logs? sudo dmesg | tail -n 20

 

There is also usb_f_mass_storage however this would need to be manually added as it is not currently included by default within the list of installed modules (Well at least was not on the last build I ran)

 

 

Best of luck

 

Ryzer

 

Posted

Ryzer, Thank you for your suggestions. I will try the update for the device tree, but with otg as value, the board will be a storage device for my dashcam.

 

I am trying to get a Buster release with kernel 6.6.75 to compile under armbian build, but so far, the compilation fails because there is no availale package for base-files. I did put the file in the cache/sources folder (which worked for a bullseye version), but nothing works for the buster version.

 

So far, the biggest progress was achieved by commenting out or adding the following in armbianEnv.txt (no updates in modules.conf, config.txt or cdmline.txt). With those updates, the drive and folders show up instantly upon activating hte gadget, I can navigate the folders, but writing is a hit and miss (using libcomposite, not g_mass_storage)

 

#overlay_prefix=sun7i-a20

param_usb_device_mode=otg

overlays=dwc2 (instead of the usual dtoverlays)

 

With those parameters, Windows file explorer and Windows Explorer no longer crash.

 

The top command shows 13% CPU usage for a kworker process related to power. A google search found that this may be due to a device/driver continuously requesting a power state change (conflict between drivers?).

 

No errors in dmesg regarding dwc2. Here are the final line:

 

[   75.627225] loop0: detected capacity change from 0 to 83886080
[   75.628674]  loop0: p1
[   76.067022] loop0: detected capacity change from 0 to 83884032
[   76.519886] FS-Cache: Loaded
[   76.784125] Key type cifs.spnego registered
[   76.784185] Key type cifs.idmap registered
[   76.787080] CIFS: Attempting to mount //192.168.0.1/Tesladrive
[   76.893017] CIFS: decode_ntlmssp_challenge: authentication has been weakened as server does not support key exchange
[   78.023297] loop0: detected capacity change from 0 to 83886080
[   78.023757]  loop0: p1
[   78.568262] loop0: detected capacity change from 0 to 83884032
[   79.642716] Mass Storage Function, version: 2009/09/11
[   79.642755] LUN: removable file: (no medium)
 

 

and usb related lines:

 

[    4.097675] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    4.097739] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 5
[    4.115390] usb usb5: Manufacturer: Linux 6.6.75-legacy-sunxi musb-hcd
[    4.115403] usb usb5: SerialNumber: musb-hdrc.1.auto
 

[   20.084995] systemd[1]: Reached target usb-gadget.target - Hardware activated USB gadget.
 

Posted

Dear Ryzer,

 

Alas, the device tree updsate didn't change anything. Here is the process that uses a lot of CPU:

 

 13.0   0.0   0:05.51 kworker/0:14+events_freezable_power_

 

Google says it is related to power state changes, and from kernel 6, power saving settings have been more aggressive in Linux, so that's why I am trying to set up a Buster-based system.

Posted (edited)

I do get multiple warnings while compiling the DTS file, about 50-100 warnings similar to this:

 

ttt.dts:1752.3-32: Warning (gpios_property): /usb0-vbus:gpio: cell 0 is not a phandle reference
ttt.dts:1764.3-32: Warning (gpios_property): /usb1-vbus:gpio: cell 0 is not a phandle reference
ttt.dts:1776.3-32: Warning (gpios_property): /usb2-vbus:gpio: cell 0 is not a phandle reference
ttt.dts:1823.4-34: Warning (gpios_property): /leds/led-3:gpios: cell 0 is not a phandle reference
ttt.dts:1828.4-34: Warning (gpios_property): /leds/led-4:gpios: cell 0 is not a phandle reference
 

The phandles are in this kind of format on the dts file:

 phandle = <0x20>;
                phandle = <0xc2>;
                phandle = <0x1c>;
                phandle = <0xc3>;
                phandle = <0xc4>;
                phandle = <0x16>;
                phandle = <0xc5>;
 

example:

 

Note: the usb0 vbus was originally disabled but I enabled it as the pcduino3 nano has a single regulator for all ports and it is attached to usb0 apparently. In the closing section of __symbols__, I have redirected all 3 regulators to usb0. I believe that the fact it is disabled is because they don't recommend powering the board through the OTG port as it can cause voltage drops when connecting devices as host. My setup will be a gadget with a wifi dongle in a USB A port, so voltage drops should not be a concern, this is just my assumption...

 

usb0-vbus {
                compatible = "regulator-fixed";
                regulator-name = "usb0-vbus";
                regulator-min-microvolt = <0x4c4b40>;
                regulator-max-microvolt = <0x4c4b40>;
                enable-active-high;
                gpio = <0x17 0x01 0x09 0x00>;
                status = "okay";
                phandle = <0xc2>;
 

Edited by Gaetano

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines