• AVR Freaks

using the USB framework with a linux host

Author
gbkjs
Starting Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2009/12/14 10:31:23
  • Location: 0
  • Status: offline
2009/12/15 08:41:12 (permalink)
0

using the USB framework with a linux host

Hi,

I have managed to program the low pin count USB development kit (PIC18F14K560) with various demo code from the USB Framework (Microchip solutions) such as the mouse and keyboard demos and they work fine when plugged into a Windows PC.

The reason for me getting this board is that I need to build a keypad that will interface with an embedded device which is running Linux. The only I/O I have available is USB, so I figured I would use the PIC18F14K560 as a HID device and emulate a keyboard that way. I only need 12 keys so I am going to use a 74C922 keypad decode chip in conjunction with the PIC - Simples!

The problem I am having is although everything works fine with Windows, it does not work with Linux (I am testing this using a Ubuntu desktop PC) . When I plug in the development kit running the keyboard demo software I get the following errors in the system log.

[ 6278.693795] usb 4-1: new full speed USB device using uhci_hcd and address 3
[ 6278.880036] usb 4-1: device descriptor read/64, error -71
[ 6279.111305] usb 4-1: device descriptor read/64, error -71
[ 6279.340489] usb 4-1: new full speed USB device using uhci_hcd and address 4
[ 6279.473777] usb 4-1: device descriptor read/64, error -71
[ 6279.712526] usb 4-1: device descriptor read/64, error -71
[ 6279.940039] usb 4-1: new full speed USB device using uhci_hcd and address 5
[ 6280.360023] usb 4-1: device not accepting address 5, error -71
[ 6280.483777] usb 4-1: new full speed USB device using uhci_hcd and address 6
[ 6280.900037] usb 4-1: device not accepting address 6, error -71
[ 6280.900051] hub 4-0:1.0: unable to enumerate USB device on port 1


I am guessing that the kernel does not recognise the device although I am no expert on Linux USB or its messages.

Has anyone got any tips on what I need to do to get this working. Do I need to create a special Linux driver or is it just a case of getting the descriptors right? If the latter is the case, any pointer would be much appreciated.

I am very new to USB so please keep it as simple as possible to start with, If you assume I know nothing you will not be far off the mark ;-)

Regards


Tim
post edited by gbkjs - 2009/12/15 09:34:13
#1

6 Replies Related Threads

    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: using the USB framework with a linux host 2009/12/15 20:02:07 (permalink)
    0
    -71 often means hardware related problems. Please check your schematics and the USB cable. You can post your schematics as well.

      USB_Links and libusb
    #2
    gbkjs
    Starting Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2009/12/14 10:31:23
    • Location: 0
    • Status: offline
    RE: using the USB framework with a linux host 2009/12/16 00:34:13 (permalink)
    +2 (1)
    Thanks for the reply

    I am using the Microchip Low Pin Count USB Development board unmodified and the USB cable is the one which comes with the microchip PICKit 2 Programmer. This is the document I am working from - Low Pin Count USB Development Kit users guide - it includes the schematic for the board in section A2.

    I have tried using a different cable and plugging into a different port, unfortunately I get the same problem. The cable I used this time was the one supplied with the kit as opposed to the one supplied by the programmer, both were supplied by Microchip so I would have thought they were up to spec.





    Second output from dmesg....

    [ 1048.710037] usb 5-2: new full speed USB device using uhci_hcd and address 2
    [ 1048.840037] usb 5-2: device descriptor read/64, error -71
    [ 1049.080041] usb 5-2: device descriptor read/64, error -71
    [ 1049.310033] usb 5-2: new full speed USB device using uhci_hcd and address 3
    [ 1049.441273] usb 5-2: device descriptor read/64, error -71
    [ 1049.680033] usb 5-2: device descriptor read/64, error -71
    [ 1049.910032] usb 5-2: new full speed USB device using uhci_hcd and address 4
    [ 1050.330034] usb 5-2: device not accepting address 4, error -71
    [ 1050.450037] usb 5-2: new full speed USB device using uhci_hcd and address 5
    [ 1050.871299] usb 5-2: device not accepting address 5, error -71
    [ 1050.871311] hub 5-0:1.0: unable to enumerate USB device on port 2


    Regards


    Tim
    post edited by gbkjs - 2009/12/16 00:40:41
    #3
    gbkjs
    Starting Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2009/12/14 10:31:23
    • Location: 0
    • Status: offline
    RE: using the USB framework with a linux host 2009/12/16 05:24:29 (permalink)
    +2 (1)
    I have solved the problem!!!

    The development board has a jumper (J12) that effectively connects the VUSB pin to VDD and that jumper was connected on my board which meant that I was pulling VUSB up to 5 volts - Wrong!

    Somehow I missed the instruction to disconnect it, which, to be fair, is clearly stated in the instructions! [sm=rolleyes.gif]

    Regards


    Tim
    #4
    fumblus
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2010/02/21 15:49:41
    • Location: 0
    • Status: offline
    RE: using the USB framework with a linux host 2010/02/21 15:56:42 (permalink)
    0
    Thank you for posting this Tim.

    I had exactly the same problem - The LPC (18f14k50) demo circuit I breadboarded connected without problems to my PC in both Windows XP and Ubuntu, but got the "device descriptor read error" on my laptop (ubuntu).  Removing that stupid J12 connection fixed it.  The schematic even shows other jumpers with a little closed connection, but with J12 open.  DOH!

    It seems the USB hardware on some computers is more forgiving of out-of-spec USB devices than others.

    Thanks again.

    Mark
    post edited by fumblus - 2010/02/21 16:01:36
    #5
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: using the USB framework with a linux host 2010/02/21 16:25:17 (permalink)

      USB_Links and libusb
    #6
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    RE: using the USB framework with a linux host 2010/02/22 01:38:56 (permalink)
    0
    On the LPC user's guide, there is an instruction to take J12 jumper plug off
    But, who would read it wink, because it is hidden at the middle of the document.
    The warning should be written at the top of the user's guide.
    Low Pin Count USB Development Kit - User’s Guide
    http://ww1.microchip.com/downloads/en/DeviceDoc/41356B.pdf

    Testing The Application (p17)
    22. Configure the Low Pin Count USB Development Board so that the J14 jumper is
    on the two right-most pins. This application will use power supplied by VBUS off
    of the USB cable.

    23. Disconnect the J12 jumper.


    When the LPC board has arrived to me, J14 was inserted on the right place, but J12 is also connected by a jumper - i.e. wrong setting.

    J14 and J12 are mounted for PIC18LF14K, 3V3 driven without on-chip LDO.
    But LPC board comes with a PIC18F14K, Microchip should release the kit with the right setting for the chip.

    Tsuneo
    #7
    Jump to:
    © 2020 APG vNext Commercial Version 4.5