Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 01 Mar 2017 12:13 PM by  Eric B
MUSB Peripheral with Mainstream Linux
 9 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Eric B
New Member
New Member
Posts:19


--
17 Feb 2017 04:29 PM

    I'm using a 4.8.6 kernel with my DM3730 SOM and am trying to use it as a USB peripheral. I am able to successfully load the module, connect the USB cable, and load the driver on a Windows 7 host. The device functions perfectly for a while but about a minute after connecting to the host the USB gadget driver seems to go into a suspended state which causes the device to become unrecognized by the host. I have tried this with the g_serial and g_mass_storage gadgets and they both produce similar behavior. I have been unable to find a way to prevent this or recover from it without rebooting. A log of the behavior is below (the last message repeats ~100 times). Do you have any ideas on how to fix this or debug it further?

     

    Welcome to Buildroot
    evt login: root
    # uname -a
    Linux evt 4.8.6 #3 SMP Wed Dec 14 14:54:14 EST 2016 armv7l GNU/Linux
    # modprobe g_serial
    [   23.828521] udc musb-hdrc.0.auto: registering UDC driver [g_serial]
    [   23.920959] userial_init: registered 4 ttyGS* devices
    [   23.960021] g_serial gadget: adding 'acm'/de6b1800 to config 'CDC ACM config'/bf3d3450
    [   23.968811] g_serial gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
    [   23.977142] g_serial gadget: Gadget Serial v2.4
    [   23.982025] g_serial gadget: g_serial ready
    [   23.987426] musb-hdrc musb-hdrc.0.auto: power state already 0
    # [   61.578552] g_serial gadget: high-speed config #2: CDC ACM config
    [   61.585754] g_serial gadget: reset acm ttyGS0
    [   61.590393] g_serial gadget: activate acm ttyGS0
    [   61.596466] g_serial gadget: acm ttyGS0 serial state 0000
    [   61.628662] g_serial gadget: acm ttyGS0 reqa1.21 v0000 i0000 l7
    [   61.635253] g_serial gadget: acm ttyGS0 req21.22 v0000 i0000 l0
    [  122.251007] g_serial gadget: suspend
    [  122.383758] g_serial gadget: reset config
    [  122.388031] g_serial gadget: acm ttyGS0 deactivated
    [  122.440765] g_serial gadget: suspend
    [  122.612976] g_serial gadget: suspend
    [  123.372650] g_serial gadget: suspend
    [  125.920776] g_serial gadget: suspend
    [  125.929229] g_serial gadget: suspend

    Eric B
    New Member
    New Member
    Posts:19


    --
    19 Feb 2017 06:29 PM

    Just an update on this issue. I updated my kernel to 4.9.10 in hopes this would fix the issue. It did resolve an issue with unloading USB gadget modules but this suspend issue is still present.

    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    20 Feb 2017 06:41 AM
    I'll do some testing to see if I can reproduce the issue. I did some testing with a customer using the 4.4 kernel using the mass storage gadget and they didn't report any issues, but I haven't done anything with testing the serial gadget.

    The code base comes straight from the mainline community, so I may have to engage some of those developers to see if we can resolve this. I'm going to also look into some of the Linux mailing lists to see if others have observed this behavior as well.

    adam
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    20 Feb 2017 06:49 AM
    Can you send me a dump from 'dmesg' that shows a just before the loading of the module and everythign until the module suspends?

    I want to see if there is anything going on that might explain why the gadget would suspend.

    adam
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    20 Feb 2017 08:47 AM
    I grabbed the latest 4.9.y kernel from kernel stable and tested the serial gadget.

    After 300 seconds, I was still able to communicate over the serial gadget.

    [ 4.637969] wlcore: loaded
    [ 7.358825] g_serial gadget: Gadget Serial v2.4
    [ 7.358856] g_serial gadget: g_serial ready
    [ 10.029724] g_serial gadget: high-speed config #2: CDC ACM config
    [ 115.061004] random: crng init done
    [ 299.299041] wlcore: loaded
    # echo "Hello World2" > /dev/ttyGS0
    # uname -a
    Linux omap3logic 4.9.11-00005-g8866902-dirty #4 Mon Feb 20 08:30:14 CST 2017 armv7l GNU/Linux
    #

    I got similar results with the 4.10 kernel released yesterday.

    I put the kit to sleep on purpose which disables the USB. On wakeup, I had to restore the connection on Windows, but it works without rebooting.

    Can you give me some more background on what you're doing?

    adam

    Eric B
    New Member
    New Member
    Posts:19


    --
    21 Feb 2017 09:44 PM
    Adam,

    Thanks for the reply. I'll try to get you the dmesg output tomorrow. Out of curiosity, do you have the MUSB configured for dual-role support or do you have it set up as a dedicated peripheral? I noticed in the 2.4-4 BSP User Manual there was mention that the MUSB didn't work well in OTG mode and the suggestion was to use a dedicated mode. Hopefully, that's no longer relevant.

    Basically, I want to go into peripheral mode and load a composite (serial and mass storage) module when a regular USB cable is connected. When no cable is present or an OTG cable is connected the device should go into host mode. There isn't really any need for HNP/SRP support. I am able to get the device to function correctly as a host by loading the g_zero module and then connecting a peripheral. Trying to connect it to my laptop as a peripheral instead does work, but eventually suspends and I can't seem to revive the connection.

    Just so you know, I'm traveling this week so I can't test this out on the devkit, I'm just using our custom hardware. I've checked the schematics and don't see anything with the hardware that would cause this issue.

    Thanks!
    Eric
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    22 Feb 2017 06:45 AM
    Eric,

    The way it works (as I understand it) is that the Host mode will only operate when the ID pin is pulled low unless you configure it for host-only. The testing that I did ran the nearly 20 hours and it was configured at OTG. The stability and reliability stated the in BSP user guide refers to some quirks in the DM3730. I know the open source community has attempted to address them, but I also know the MUSB driver has been in a state of change for a while. The entire kernel is evolving.

    We did some host testing for a customer and we didn't find any issues, but we did not do extensive device/OTG testing for that customer because it wasn't part of their scope.

    We are reviewing our internal product roadmap and software roadmap to determine what needs to be done to release an updated BSP, but until that happens, the release will remain in 'beta' If you'd like us to do some explicit testing of a certain peripherals / features, we can do that with a services contract. Those types of testing can either be done against our development kit, or if you like we can do it with your hardware and customizations unique to your application, but there are costs associated with that. If you want, I can have one of our account managers contact you.

    adam
    Eric B
    New Member
    New Member
    Posts:19


    --
    27 Feb 2017 10:54 PM
    Adam,

    Thank you for your feedback on this. I was able to diagnose this as a hardware problem. We had a USB switch in the design that wasn't being powered. Once I fixed that it worked as expected.

    Eric
    Adam Ford
    Advanced Member
    Advanced Member
    Posts:794


    --
    28 Feb 2017 06:48 AM
    I am glad you were able to get it working. My superiors are having various meetings to discuss the future product roadmap. We have some renewed interest in updating/growing our lineup, so we should have some updates for you soon.

    adam
    Eric B
    New Member
    New Member
    Posts:19


    --
    01 Mar 2017 12:13 PM
    Sounds great. I'll be looking forward to them!
    You are not authorized to post a reply.