[SOLVED] Up Square USB Gadget g_serial and g_mass_storage problems

Black_G3Black_G3 New Member Posts: 3
edited May 28 in USB

Hello,

We are having issues with Up Square g_serail and g_mass_storage

BIOS version is 2.1 in our Up2 and we have Ubuntu 16.04.5 with Kernel 4.15.0-38-generic. We did not touch BIOS; default is loaded.

On the other end of USB OTG cable, we have a generic laptop running Windows 8.1

g_serial problem:
After loading g_serial we saw a new ttyUSB0 is registered in /dev folder and in PC, we see a PI serial 2.4 device is registered at COM 3
Open a minicom session in Up2/Ubuntu and a putty session in Windows

Whatever we type on PC shows up on Up2 minicom; this is good.
However we don't see output on PC putty screen when we type on minicom. Only after we hit "enter" key on PC then the message shows up on putty. We try disable flow control on both minicom and putty but it does not help.

g_mass_stroage problem:
"sudo modprobe g_mass_storage" gives us following error
modprobe: ERROR: could not insert 'g_mass_storage': invalid argument

in kernel log
Mass Storage Function, version 2009/09/11
LUN: removable file: (no medium)
no file given for LUN0
g_mass_storage dwc3.0.auto:failed to satrt g_mass_storage: -22

Nothing shows up on Windows; no new device in device manager or in my computer.

We appreciate any input to solve g_serial and g_mass_storage problems.

Thanks
Black G3

Comments

  • Black_G3Black_G3 New Member Posts: 3

    a quick update on g_mass_storage
    we forgot to attach a drive after create a file - up2storage.bin and format as fat32
    we then load g_mass_storage file=up2storage.bin. Now we can see this storage from another Linux machine. However in Windows although we are having issue to access this drive. Windows say it is RAW and ask to format. It crashes when we try to format it.

    Suggestion is welcomed.

  • ccaldeccalde Administrator, Moderator, Emutex Posts: 331 admin
    edited January 9

    Hi @Black_G3 ,

    I am trying to reproduce the issue here and I would like to know the steps you followed to get your UP2 board as storage device available in a Linux machine.

    Thank you!

  • ccaldeccalde Administrator, Moderator, Emutex Posts: 331 admin

    Hi @Black_G3 ,

    So, I got my UP2 OTG working as storage device for Linux using the next command on my UP2 to enable the g_mass_storage module:

    sudo dd if=/dev/zero of=/up2.img bs=1M count=400

    sudo mkdosfs -F 32 /up2.img

    sudo modprobe g_mass_storage file=/up2.img stall=0

    Connecting to my Linux host machine the partition memory jumped automatically.

    On Windows 10, I connected to my Windows host and I only saw the device as "mass storage device".
    Then, I formatted my memory disk using diskpart tool:
    Run CMD in Windows as an Administrator
    Type: diskpart
    Type: list disk
    Note the number assigned to your disk and replace X in the next command with that number
    Type: select disk X
    Type: clean all
    Type: create partition primary
    Type: active
    Type: format fs=fat32 label="UP2"
    The above command may take some time depending on the capacity of your drive
    Type: assign
    Type: exit

    Then, you will see your UP2 device on Windows automatically.

  • rameshramesh New Member Posts: 1

    Hi I got up2 board from aaeon.It has come with pre loaded ubunt 16.04 and 4.14 kernel software.
    I have updated ublinux kernrl of 4.15.
    I have a problem of g_mass_storage is not getting loaded
    sudo dd if=/dev/zero of=/up2.img bs=1M count=400

    sudo mkdosfs -F 32 /up2.img

    sudo modprobe g_mass_storage file=/up2.img stall=0

    I am getting below error
    udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers

    kernel version is:
    uname -srv
    Linux 4.15.0-37-generic #40~upboard03-Ubuntu SMP Wed Dec 12 16:21:24 UTC 2018

    bios version
    sudo dmidecode -s bios-version
    UPA1AM40

    Please suggest how could i fix the problem

    Thanks & Regards,
    Ramesh Mudunuri

  • vini_gajjarvini_gajjar New Member Posts: 11

    Hi, @ccalde
    Installed kernel version on my upsquared board is linux 4.15
    I followed the same steps as you did.
    But when I mount the device to a windows 10 host machine ,
    it shows "Device not recognized " and the device is not even listed in device manager

  • ccaldeccalde Administrator, Moderator, Emutex Posts: 331 admin

    Hi @vini_gajjar

    I think your issue is with the format for Windows.

    Please, try the next instructions to reformat your UP2 device as mass storage to be detected by Windows:
    https://wiki.up-community.org/Serial_console#Storage_device

  • jwesseljwessel New Member Posts: 11

    @ccalde the instructions at the URL you mentioned will work, but you could have made it so you didn't have to use diskpart in the first place if you put a partition table into the file before you formatted it.

    It should really look like below if you want to use the volume directly from windows, or even use it to flash the bios on another board when used as an EFI volume where you copy all the files in.

    dd if=/dev/zero of=img bs=1M count=400
    parted -s img mklabel msdos 
    parted -s img mkpart primary fat32 0 100%
    # Optionally enable it for EFI
    parted -s img set 1 boot on 
    parted -s img set 1 esp on 
    
    dev=`sudo losetup -f --show img`
    sudo partprobe ${dev}
    sudo mkdosfs ${dev}p1
    
    # Optionally mount and play with your new file system
    mkdir -p tmpmnt
    sudo mount ${dev}p1 tmpmnt
    
    # add things here
    
    # Unmount
    sudo umount tmpmnt
    
    # Cleanup
    sudo losetup -d ${dev}
    

    You don't have to run the dd or the parted commands as root, and it would be idea if the wiki could get fixed with proper instructions.

  • ccaldeccalde Administrator, Moderator, Emutex Posts: 331 admin

    Hi @jwessel ,

    That's awesome!! I will try your script and update the Wiki if needed.

    Cheers!

Sign In or Register to comment.