[Programmation] Problème USB PIC 18F4550
Répondre à la discussion
Affichage des résultats 1 à 12 sur 12

Problème USB PIC 18F4550



  1. #1
    HarryCover02

    Problème USB PIC 18F4550


    ------

    Bonjour à Tous,

    Je viens demander votre aide sur mon problème de paramétrage de l'USB sur le PIC 18F4550.

    Voila j'ai regarder sur pas mal de forum étant donné que le sujet à été abordé plusieurs fois, mais hélas je ne trouve pas de solution.

    donc, lorsque je connect Mon PIC au PC j'ai le message unknown device. j'ai suivi les branchement des pins selon le schémas ci joint Nom : USB test.PNG
Affichages : 101
Taille : 54,6 Ko

    j'utilise un quartz externe de 4Mhz avec 2 condo de 22pF un condo de 470nF sur VUSB et le Firmware de démo de Microchip

    pour le moment je cherche à faire reconnaître le drivers

    d'avance merci pour votre aide

    PS je suis novice

    Cordialement

    Harry

    -----

  2. #2
    PIXEL

    Re : Problème USB PIC 18F4550

    hello,
    as-tu chargé "au moins" le bootlader ?

  3. #3
    HarryCover02

    Re : Problème USB PIC 18F4550

    Bonjour,

    merci de votre aide, si par bootlader vous entendez le programme *hex , oui

    mais je veux bien que vous m'expliquer plus en détail pour etre sur que l'on parle du même fichier

  4. #4
    satinas

    Re : Problème USB PIC 18F4550

    Bonsoir, est-ce que le firmware utilisé est compatible avec le quartz de 4 MHz ?

  5. A voir en vidéo sur Futura
  6. #5
    HarryCover02

    Re : Problème USB PIC 18F4550

    Bonsoir,

    comment je peux le vérifier SVP?

    Harry

  7. #6
    satinas

    Re : Problème USB PIC 18F4550

    Un lien pour ce firmware ?

  8. #7
    HarryCover02

    Re : Problème USB PIC 18F4550

    Pas de soucis je mettrais le lien dès demain

    cordialement

    Harry

  9. #8
    HarryCover02

    Re : Problème USB PIC 18F4550

    Bonjour a tous,

    En PJ les Fichiers au format TXT

    Fichiers générés avec Easy HID USB Wizard ( Micro code studio )

    Pour le moment je n'est fait aucune modification

    Cordialement

    Harry

    Contenu de USBProject2.txt :
    Code:
    ' ************************************************************
    ' * Auto generated EasyHID file. PBP 2.60 and above          *
    ' ************************************************************
    
    ' include the HID descriptor
    include	"DESCUSBProject2.bas"
    
    DEFINE OSC 48
    DEFINE LOADER_USED 1
    
    USBBufferSizeMax   con 8  ' maximum buffer size
    USBBufferSizeTX    con 8  ' input
    USBBufferSizeRX    con 8  ' output
    
    ' the USB buffer...
    USBBuffer        Var Byte[USBBufferSizeMax] 
    USBBufferCount   Var Byte 
    
    ' ************************************************************
    ' * main program loop - remember, you must keep the USB      *
    ' * connection alive with a call to USBService every couple  *
    ' * of milliseconds or so...                                 *
    ' ************************************************************
    usbinit ' initialise USB...
    ProgramStart: 
       gosub DoUSBIn
       gosub DoUSBOut
       goto ProgramStart  
    
    ' ************************************************************
    ' * receive data from the USB bus                            *
    ' ************************************************************
    DoUSBIn:
       USBBufferCount = USBBufferSizeRX              ' RX buffer size
       USBService                                    ' keep connection alive
       USBIn 1, USBBuffer, USBBufferCount, DoUSBIn   ' read data, if available
       return
        
    ' ************************************************************
    ' * wait for USB interface to attach                         *
    ' ************************************************************
    DoUSBOut:
       USBBufferCount = USBBufferSizeTX              ' TX buffer size
       USBService                                    ' keep connection alive
       USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
       return
    Contenu de DESCUSBProject2.txt :
    Code:
    ' USB descriptors for a HID device
    'USBMEMORYADDRESS Con	$400	' USB RAM starts here (set in device header file)
    USBMEMORYSIZE	Con	256	' USB RAM size in bytes
    USBReservedMemory Var Byte[USBMEMORYSIZE] USBMEMORYADDRESS	' Reserve memory used by USB assembler code
    
    goto	hid_desc_end	' Skip over all of the USB assembler code
    asm
    
    #define	USB_EP0_BUFF_SIZE 	64	; 8, 16, 32, or 64
    #define	USB_MAX_NUM_INT		1	; For tracking Alternate Setting
    #define	USB_MAX_EP_NUMBER  	1	; UEP1
    #define	NUM_CONFIGURATIONS	1
    #define	NUM_INTERFACES		1
    
    #define UCFG_VAL	USB_PULLUP_ENABLE|USB_INTERNAL_TRANSCEIVER|USB_FULL_SPEED|USB_PING_PONG__NO_PING_PONG
    ;#define UCFG_VAL	USB_PULLUP_ENABLE|USB_INTERNAL_TRANSCEIVER|USB_LOW_SPEED|USB_PING_PONG__NO_PING_PONG
    
    ;#define USE_SELF_POWER_SENSE_IO
    ;#define USE_USB_BUS_SENSE_IO
    
    #define USB_POLLING
    
    ; HID
    ; Endpoints Allocation
    #define	HID_INTF_ID		  0x00
    #define	HID_EP			  1
    #define	HID_INT_OUT_EP_SIZE	  64
    #define	HID_INT_IN_EP_SIZE	  64
    #define	HID_NUM_OF_DSC		  1
    
       include	"usb_hid.asm"	; Include rest of USB files, starting with HID class code
    
    ; ******************************************************************
    ; This table is polled by the host immediately after USB Reset has been released.
    ; This table defines the maximum packet size EP0 can take.
    ; See section 9.6.1 of the Rev 1.0 USB specification.
    ; These fields are application DEPENDENT. Modify these to meet
    ; your specifications.
    ; ******************************************************************
    DeviceDescriptor
    	retlw	(EndDeviceDescriptor-DeviceDescriptor)/2	; bLength Length of this descriptor
    	retlw	USB_DESCRIPTOR_DEVICE ; bDescType This is a DEVICE descriptor
    	retlw	0x10		; bcdUSBUSB Revision 1.10 (low byte)
    	retlw	0x01		; high byte
    	retlw	0x00		; bDeviceClass zero means each interface operates independently
    	retlw	0x00		; bDeviceSubClass
    	retlw	0x00		; bDeviceProtocol
    	retlw	USB_EP0_BUFF_SIZE ; bMaxPacketSize for EP0
    
            ; idVendor (low byte, high byte)
    	retlw	0xD8
    	retlw	0x04
    
            ; idProduct (low byte, high byte)
    	retlw	0x0B
    	retlw	0x00
    
            retlw	0x00		; bcdDevice (low byte)
    	retlw	0x00		; (high byte)
    	retlw	0x01		; iManufacturer (string index)
    	retlw	0x02		; iProduct      (string index)
    
            ; iSerialNumber (string index)
    	retlw	0x00
    	retlw	NUM_CONFIGURATIONS ; bNumConfigurations
    EndDeviceDescriptor
    
    ; ******************************************************************
    ; This table is retrieved by the host after the address has been set.
    ; This table defines the configurations available for the device.
    ; See section 9.6.2 of the Rev 1.0 USB specification (page 184).
    ; These fields are application DEPENDENT. 
    ; Modify these to meet your specifications.
    ; ******************************************************************
    ; Configuration pointer table
    USB_CD_Ptr
    Configs
    	db	low Config1, high Config1
    	db	upper Config1, 0
    
    ; Configuration Descriptor
    Config1
    	retlw	(Interface1-Config1)/2	; bLength Length of this descriptor
    	retlw	USB_DESCRIPTOR_CONFIGURATION ; bDescType 2=CONFIGURATION
    Config1Len
    	retlw	low ((EndConfig1 - Config1)/2)	; Length of this configuration
    	retlw	high ((EndConfig1 - Config1)/2)
    	retlw	0x01		; bNumInterfaces Number of interfaces
    	retlw	0x01		; bConfigValue Configuration Value
    	retlw	0x00		; iConfig (string index)
    	retlw	_DEFAULT|_SELF	; bmAttributes attributes - bus powered
    
            ; Max power consumption (2X mA)
    	retlw	0x32
    Interface1
    	retlw	(HIDDescriptor1-Interface1)/2	; length of descriptor
    	retlw	USB_DESCRIPTOR_INTERFACE
    	retlw	0x00		; number of interface, 0 based array
    	retlw	0x00		; alternate setting
    	retlw	0x02		; number of endpoints used in this interface
    	retlw	0x03		; interface class - assigned by the USB
    	retlw	0x00		; boot device
    	retlw	0x00		; interface protocol
    	retlw 	0x00		; index to string descriptor that describes this interface
    HIDDescriptor1
    	retlw	(Endpoint1In-HIDDescriptor1)/2	; descriptor size (9 bytes)
            retlw	DSC_HID		; descriptor type (HID)
    	retlw	0x11		; HID class release number (1.11)
    	retlw	0x01
            retlw	0x00		; Localized country code (none)
            retlw	0x01		; # of HID class descriptor to follow (1)
            retlw	0x22		; Report descriptor type (HID)
    ReportDescriptor1Len
    	retlw	low ((EndReportDescriptor1-ReportDescriptor1)/2)
    	retlw	high ((EndReportDescriptor1-ReportDescriptor1)/2)
    Endpoint1In
    	retlw	(EndPoint1Out-Endpoint1In)/2	; length of descriptor
    	retlw	USB_DESCRIPTOR_ENDPOINT
    	retlw	HID_EP|_EP_IN		; EP1, In
    	retlw	_INT		; Interrupt
    	retlw	low (HID_INT_IN_EP_SIZE)		; This should be the size of the endpoint buffer
    	retlw	high (HID_INT_IN_EP_SIZE)
    	retlw	0x0A                        ; Polling interval
    EndPoint1Out
    	retlw	(EndConfig1-EndPoint1Out)/2	; Length of this Endpoint Descriptor
    	retlw	USB_DESCRIPTOR_ENDPOINT		; bDescriptorType = 5 for Endpoint Descriptor
    	retlw	HID_EP|_EP_OUT		; Endpoint number & direction
    	retlw	_INT		; Transfer type supported by this Endpoint
    	retlw	low (HID_INT_OUT_EP_SIZE)		; This should be the size of the endpoint buffer
    	retlw	high (HID_INT_OUT_EP_SIZE)
    	retlw	0x0A                        ; Polling interval
    EndConfig1
    
    ReportDescriptor1
        ; vendor defined usage page
        retlw	0x06		
        retlw	0x00
        retlw	0xFF
    
        ; vendor defined usage
        retlw	0x09
        retlw	0x00
    
        ; collection(application)
        retlw	0xA1
        retlw	0x01
    
        ; *** INPUT REPORT ***
    
        ; vendor defined usage
        retlw	0x09
        retlw	0x01
    
        retlw	0x15 	; logical minimum (-128)
        retlw	0x80    ;
        retlw	0x25 	; logical maximum (127)
        retlw	0x7F    ;
        retlw	0x35 	; Physical Minimum (0)
        retlw	0x00    ;
        retlw	0x45 	; Physical Maximum (255)
        retlw	0xFF    ;
    
        ; report size in bits
        retlw	0x75
        retlw	0x08
    
        ; report count (number of fields)
        retlw	0x95
        retlw	0x08
    
        ; Input (Data, Variable, Absolute)
        retlw	0x81
        retlw	0x02
    
        ; *** OUTPUT REPORT ***
    
        ; vendor defined usage
        retlw	0x09	    ; usage (Vendor Defined)
        retlw	0x02        ;
    
        retlw	0x15	    ; logical minimum (-128)
        retlw	0x80        ;
        retlw	0x25	    ; logical maximum (127)
        retlw	0x7F        ;
        retlw	0x35	    ; Physical Minimum (0)
        retlw	0x00        ;
        retlw	0x45	    ; Physical Maximum (255)
        retlw	0xFF        ;
    
        ; report size in bits
        retlw	0x75
        retlw	0x08
    
        ; report count (number of fields)
        retlw	0x95
        retlw	0x08
    
        ; Output (Data, Variable, Absolute)
        retlw	0x91
        retlw	0x02
    
        retlw   0xC0       	   ; end collection
    
    EndReportDescriptor1
    
    ; String pointer table
    USB_SD_Ptr
    Strings
    	db	low String0, high String0
            db	upper String0, 0
    	db	low String1, high String1
            db	upper String1, 0
    	db	low String2, high String2
           	db	upper String2, 0
    	db	low String3, high String3
    	db	upper String3, 0
    
    String0
    	retlw	(String1-String0)/2	; Length of string
    	retlw	USB_DESCRIPTOR_STRING   ; Descriptor type 3
    	retlw	0x09		        ; Language ID (as defined by MS 0x0409)
    	retlw	0x04
    
    ; company name
    String1
    	retlw	(String2-String1)/2
    	retlw	USB_DESCRIPTOR_STRING
    	
            retlw   'M'
            retlw   0x00
            retlw   'i'
            retlw   0x00
            retlw   'c'
            retlw   0x00
            retlw   'r'
            retlw   0x00
            retlw   'o'
            retlw   0x00
            retlw   'c'
            retlw   0x00
            retlw   'h'
            retlw   0x00
            retlw   'i'
            retlw   0x00
            retlw   'p'
            retlw   0x00
    
    	
    ; product name	
    String2
    	retlw	(String3-String2)/2
    	retlw	USB_DESCRIPTOR_STRING
    	
            retlw   '1'
            retlw   0x00
            retlw   '8'
            retlw   0x00
            retlw   'F'
            retlw   0x00
            retlw   '4'
            retlw   0x00
            retlw   '5'
            retlw   0x00
            retlw   '5'
            retlw   0x00
            retlw   '0'
            retlw   0x00
    
    
    ; serial number
    String3
    	retlw	(String4-String3)/2
    	retlw	USB_DESCRIPTOR_STRING
    	
    
    String4
    
    
    endasm
    hid_desc_end
    Fichiers attachés Fichiers attachés
    Dernière modification par Antoane ; 25/09/2016 à 10h49. Motif: INtégration du code au corps du message

  10. #9
    satinas

    Re : Problème USB PIC 18F4550

    Bonjour,
    EasyHid préconise un cablâge du pic, il faut aller vérifier si votre schéma est conforme, notamment au niveau du quartz ...

  11. #10
    HarryCover02

    Re : Problème USB PIC 18F4550

    Bonjour,

    Par avance merci pour votre aide, qu'entendez vous par câblage,

    pour ce qui est du quartz j'ai la possibilité de mettre un 20Mhz , 6 Mhz ou 4 Mhz

    je suis en train de tester avec un 20Mhz et toujours Unknow Device

    Cordialement

    Harry

  12. #11
    satinas

    Re : Problème USB PIC 18F4550

    Vous avez utilisé un logiciel, il faut lire la doc
    Un firmware doit être implanté sur un matériel déterminé.
    Le logiciel dans le pic s'attend à avoir un quartz d'une certaine valeur, il faut la respecter pour avoir des timings précis sur le port usb.
    A moins que ce soit paramétable dans le logiciel EasyHid, ce que ne sais pas.

  13. #12
    HarryCover02

    Re : Problème USB PIC 18F4550

    Bonsoir à Tous,

    Je vous donne quelques nouvelles,

    J'ai réussi à faire reconnaître le Drivers USB mais en changeant de programme, je suis passé par MicroPascal et la ca fonctionne, je ferais des test de communication le Week-end Prochain pour voir si la "Com" fonctionne

    Cordialement

    Harry

Discussions similaires

  1. Problème 18F4550 usb (hid)
    Par ferfech dans le forum Électronique
    Réponses: 1
    Dernier message: 15/06/2014, 00h15
  2. Probleme EEPROM 18f4550
    Par invite69c9340e dans le forum Électronique
    Réponses: 2
    Dernier message: 22/03/2012, 09h37
  3. probleme 2 interruptions pull up sur 18F4550
    Par inviteac751535 dans le forum Électronique
    Réponses: 1
    Dernier message: 13/02/2012, 23h04
  4. probleme driver pic 18f4550
    Par invite0201cc99 dans le forum Électronique
    Réponses: 8
    Dernier message: 27/08/2011, 21h07
  5. probleme 2 interruption pic 18f4550 pic ->plante
    Par invite4ec38ea0 dans le forum Électronique
    Réponses: 5
    Dernier message: 28/08/2010, 07h51
Découvrez nos comparatifs produits sur l'informatique et les technologies.