Easy HID Command -Response application


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Well, it's a Total guess but ...

    Try adding a USBIN statement to the loop.
    If anything comes in, and the SIE doesn't get released, everything locks up (including the PC application).

    The reason I say it's a guess is because it requires recieved data.
    If you are using HyperTerminal then you would need to type something to have it happen.

    DT

  2. #2

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Well, it's a Total guess but ...

    I dopnt know whats going on TBH, I watched it fail after about 30 mins, twice, I saw it fail after ten, I gave up hitting my head and posted the above, and then left it running, 2hrs later it was still running, I went to bed, got up this morning, still running, I went out for a few hours, come back, still running....

    I can only guess something upset the pic at an hardware level because i have changed nothing at the software level. (I have even glued the crystal to the crystal socket!)

    Anyhow.... these nuggets..

    Plugged indicates when the device is fully connected to the PC.
    RX_READY indicates when a report has been received.
    TX_READY indicates when it's OK to Send. The device is Plugged and the SIE is ready to accept data.
    Do you an an example line for those?

    Once upon a time getting data into the pic was fairly easy, now I have to keep the pic doing some monitoring of its io pins but at same time accepting commands from the fake comport, so seeing if any data was waiting, as it seems to have very little in the way of flow control would be useful. (what happened to the wonderful buffers and fifo's on real hardware!)

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Gremlins, or maybe the cats (if you have any).

    Make sure you have plenty of capicitance on the VUSB pin. (.22uF to .47uF)
    And have both a 10uF and 0.1uF capacitors on the Power Rails (VSS-VDD).

    Plugged, RX_READY and TX_READY are just normal "Bits".

    RX_READY indicates that data has been received. It should be cleared after use.
    Code:
    Main:
        IF RX_READY THEN        ; USB data has been rcvd
            RX_READY = 0        ; clear the Ready flag
            USBIN 1, Buffer, Cnt, Main
            LCDOUT $FE,1,STR Buffer
        ENDIF
    TX_READY indicates that the device is plugged in and the SIE is ready to accept data to send.
    Code:
        IF TX_READY THEN         ; USB is Ready to transmit
            TX_READY = 0         ; clear the Ready flag
            ADCIN 0, ADval
            ARRAYWRITE Buffer,[DEC4 ADval," "]
            USBOUT 1, Buffer, Cnt, TXfail
          TXfail:
        ENDIF
    GOTO Main
    DT

  4. #4

    Default

    Thanks for that i'll have a play with them tonight, shame i am away form home for tomorrow as i know this will be on my mind all day, issue is having two incoming serial data streams, and an outgoing serial + the usb out....

    Neither of the incoming streams seem to wait, so i have to write code that will be quick enough to read a command and react according ly before waiting for the next serial command or change of IO state, which would also require a serial out for status.... Oh and a RTC would be nice so i can say what time things happened.

    Its all so simple when i explain it real life....

  5. #5

    Default

    Hallo Darrel
    a question i have used your code and it work 100% with a array of 8 values, if i would like to transfer more values do i need to edit your file as well as in the main program

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    No, there's nothing in the USB_ASM_Service.pbp file to change.
    But you'll need to edit the report size in the Descriptor file, and the arrays in your program.

    If you were using DT_HID, you could do it all in your main program.
    DT

  7. #7

    Default

    Mabe i mis understand something i have a file in my project called DESCUSBProject witch acording to me is the file i need to change but i i understand corectly it is already setted to use 64 bytes but as soon as i try to send more than 8 my device shows a conection but no data comes through below a part of the descriptor file
    Code:
    #define	EP0_BUFF_SIZE		64	; 8, 16, 32, or 64
    #define	MAX_NUM_INT		1	; For tracking Alternate Setting
    #define	MAX_EP_NUMBER		1	; UEP1
    #define	NUM_CONFIGURATIONS	1
    #define	NUM_INTERFACES		1
    
    #define	MODE_PP			    _PPBM0
    #define	UCFG_VAL		    _PUEN|_TRINT|_FS|MODE_PP	; Full-speed
    
    ; DEVICE CLASS USAGE
    #define USB_USE_HID
    
    ; HID
    ; Endpoints Allocation
    #define	HID_INTF_ID		  0x00
    #define	HID_UEP			  UEP1
    #define	HID_BD_OUT		  ep1Bo
    #define	HID_INT_OUT_EP_SIZE	  64
    #define	HID_BD_IN		  ep1Bi
    #define	HID_INT_IN_EP_SIZE	  64
    #define	HID_NUM_OF_DSC		  1

Similar Threads

  1. USB hid maker help please.
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2013, 14:49
  2. i cant get 18f2550 work as HID
    By Ahmadabuomar in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 13th October 2009, 16:39
  3. Unusual Interrupts Application Problem
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th May 2009, 11:55
  4. Hid Maker FS Problems
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th April 2009, 21:27
  5. Making your own HID descriptor file
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th April 2005, 12:35

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts