This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Developing USB device. Where to start

Hello!

I have a beagleboard reference board. Now I'm starting to research this device. At first I want to develop simple USB device, for example simple HID keyboard or mouse. I have few different Linux kernels for my board like TI DVSDK, Argo and Angstrom. But unfortunately I'm a novice in Linux. What kernel should I choose for my target? Can somebody describe my future steps to configure Linux kernel to support HID device for my task? And what should I do to get data from host and process this data? As I understand I should use something like gadget API.

Thanks!

  • Alexey,

    For beagleboard as reference board you should be using Angstrom kernel. You should select USB support in kernel including Inventra controller and a gadget driver.

    Ajay

  • Ajay, thanks for your answer!

    I have downloaded the kernel from usb_sniffer project and load it to the beagleboard. Then I have tried to load musb_hdrc module, but the result was unpredictable:

    root@beagleboard:/#  modprobe musb_hdrc
    FATAL: Error inserting musb_hdrc (/lib/modules/2.6.34-usbsniffer/kernel/drivers/
    usb/musb/musb_hdrc.ko): Invalid module format
    root@beagleboard:/#

    Information about the module is correct as I understand:

    root@beagleboard:/# modinfo musb_hdrc
    filename:       /lib/modules/2.6.34-usbsniffer/kernel/drivers/usb/musb/musb_hdrc.ko
    alias:          platform:musb_hdrc
    license:        GPL
    author:         Mentor Graphics, Texas Instruments, Nokia
    description:    Inventra Dual-Role USB Controller Driver, v6.0
    srcversion:     5C0C25A5145B29584FE5773
    depends:
    vermagic:       2.6.34-usbsniffer preempt mod_unload ARMv7
    parm:           debug:Debug message level. Default = 0 (int)
    parm:           fifo_mode:initial endpoint configuration mode (ushort)
    parm:           fifo_config:initial endpoint configuration (array of charp)
    parm:           use_dma:enable/disable use of DMA (bool)

    The same situation with usb gadget module g_zero. What can be the reason of problem?

  • Akexey,

    I would suggest to rebuild the kernel source with modules. It seems modules and kernel are not built same time.

    ajay

  • Hi,

    I am also working on USB sniffer project and downloaded kernel source  from

    http://gitorious.org/beagleboard-usbsniffer/beagleboard-usbsniffer-kernel/commits/stable-20100726

    The detailed steps are given in sequence :


    1. Get USB sniffer kernel from
    http://gitorious.org/beagleboard-usbsniffer/beagleboard-usbsniffer-kernel/commits/stable-20100726

    2. To cross compile kernel :
    I have not changed .config file, means using the same .config came
    with above repository so that my USB sniffer would work.

    make ARCH=arm CROSS_COMPILE=arm-angstrom-

    linux-gnueabi- distclean
    make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi-
    omap3_beagle_defconfig
    make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- uImage
    make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi- modules
    $ mkdir modules
    $ make ARCH=arm CROSS_COMPILE=arm-angstrom-linux-gnueabi-
    INSTALL_MOD_PATH=./modules modules_install

    3. Using mkcard.sh to format my microSD card ( this make 2 partitions,
    FAT32 primary  and ext3 secondary).
    They will be mounted as /media/boot and /media/Amstrong respectively.

    4. Copying stuff :
    Here except uImage rest of the components came with the board. I am
    still using those components only uImage is changed.

    #copy to BOOT
    echo "Copy MLO"
    cp /home/barun/BARUN-CODE/beagleboard-backup/boot/MLO /media/boot
    sync
    echo "Copy U-BOOT.BIN"
    cp /home/barun/BARUN-CODE/beagleboard-backup/boot/U-BOOT.BIN /media/
    boot
    sync
    echo "Copy uEnv.txt"
    cp /home/barun/BARUN-CODE/beagleboard-backup/boot/uEnv.txt /media/boot
    sync
    echo "Copy uImage"
    cp /home/barun/BARUN-CODE/beagleboard-backup/boot/uImage /media/boot
    sync
    #copy to Angstrom
    echo "Copy file system"
    cp -r /home/barun/BARUN-CODE/beagleboard-backup/linux-fs/* /media/
    Angstrom/
    sync
    #unmount volumes
    echo "Unmounting boot"
    umount /media/boot
    sync
    echo "Unmounting Angstrom"
    umount /media/Angstrom
    sync


    After that I am putting this microSD card with kernel and file system
    to beagleboard, the machine boots up and I am getting the login prompt
    through my minicom.
    But none of the USB devices are recognized.
    Since you have already worked on this project, you might be the right person to tell where I am wrong. I am on beagleboard-XM (Amstrong Linux).
    Planning for make menuconfig, dont know what extra to select.
    With Thanks,
    Barun Parichha
  • At first check that your linux kernel includes support for Inventra HDRC.

    After that check configuration of USB gadgets. If your gadget is included into kernel your USB device should appear after linux booting. If your gadget is configured as module you should load it after linux booting. For example if you wand to use Gadget FS type the following commnd:

    modprobe gadgetfs