HID USB on 18F87J50 - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 57 of 57
  1. #41
    Join Date
    Sep 2009
    Posts
    737

    Default Re: HID USB on 18F87J50

    Maybe is screwy, but it have everything I need for this project, and it's cheep. Thank you

  2. #42
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default Re: HID USB on 18F87J50

    Quote Originally Posted by tumbleweed View Post
    How is this chip different than the others?
    I am sure Darrel will share more.

    But one way it is a bit odd, is it shares addresses for SFR's. See: 5.3.5.1 Shared Address SFRs . You have to set the ADSHR bit in the WDTCON register to access the alternate locations.

  3. #43
    Join Date
    Aug 2011
    Posts
    412

    Default Re: HID USB on 18F87J50

    But one way it is a bit odd, is it shares addresses for SFR's. See: 5.3.5.1 Shared Address SFRs
    Yeh, I've seen that "feature" in a number of the J series parts, not just the J50.

    It doesn't seem to have anything to do with USB register access, though.

  4. #44
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default Re: HID USB on 18F87J50

    Darrel talks about it in post 19 of this thread:

    There is something seriously messed up with these chips. And it's all Microchip.

    The SFR's from address F40h to F5Fh cannot be accessed with either the MOVFF opcode or indirectly through the FSR's.
    They can only be accessed by setting BSR to bank15 and using "banked" opcodes like movf, movwf, bcf etc.

    I realize that those SFR's are outside of the ACCESS bank, but that should not affect MOVFF or indirect addressing thru FSR's.

    That range of SFR's contains many of the USB modules registers.
    Other USB module registers such as UCON USTAT etc that reside in the access bank can be written/read with all 3 methods FSR, MOVFF and banked. So it's not related to the USB module itself.

    The USB libraries rely heavily on MOVFF and FSR's.

    I have found nothing in the errata or datasheet that mentions this behavior.
    And in due time, we will see his work around!

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

    Default Re: HID USB on 18F87J50

    WOW, I've been chasing my tail, and apparently for not.

    The MPASM that comes with MPLAB 8.73a was generating incorrect opcodes for the banked instructions.
    This was making me think things were happening in the chip that should not have been happening.

    The actual silicon in the xxJ50's is not the problem.

    There is a new version MPLAB 8.76 which has fixed the errors.
    Compile your USB programs using the new assembler, and walla, working USB.

    There are other chips that will be affected by the problem, and it's not only USB that will be affected, so it is recommended that everyone with PBP 2.60 or later upgrade MPLAB to a version higher than 8.73a.
    DT

  6. #46
    Join Date
    Sep 2009
    Posts
    737

    Thumbs up Re: HID USB on 18F87J50

    I'll give it try tomorrow.
    Thanks Darrell

  7. #47
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: HID USB on 18F87J50

    And obviously, it doesn't seems Microchip have documented that bug... or again, I'm blind
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #48
    Join Date
    Sep 2009
    Posts
    737

    Default Re: HID USB on 18F87J50

    I just recompile CDC from last attempt and it is working. Now just to try HID with VB6.
    You save my butt, again

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

    Default Re: HID USB on 18F87J50

    I think it's time to retire one of my signature quotes ...

    Name:  Tellit.gif
Views: 853
Size:  901 Bytes

    They don't always do what you tell them.

    But I'm definitely keeping this one ...

    Name:  Upgrade.gif
Views: 863
Size:  497 Bytes
    DT

  10. #50
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default Re: HID USB on 18F87J50

    I have installed MPLAB8,76. Now I get CDC to work on 2.60C, but I don't get the same file to work with PBP3.

    But I am wondering where PBP3 is looking for MPLAB or MPASM? 2.60 allowed you to select the location for PBP, and it also allowed you to show it where the assembler was located. In PBP3 I get this option:

    Name:  pbp3.PNG
Views: 1193
Size:  28.8 KB

    How am I supposed to enter them both? Or are they really supposed to be in the same place??

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

    Default Re: HID USB on 18F87J50

    In the Start menu, go to All Programs > PBP3 from melabs > MPASM-MPLAB setup.
    It allows you to set the path to MPASM.
    DT

  12. #52
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default Re: HID USB on 18F87J50

    Thanks Darrel. I had some weird behavior in my computer. PBP3 kept defaulting to MPASMX, no mater how I set it, I'd check back, and it was set to MPASMX. So after removing the Microchip directory, and re-installing MPLAB 8.76, I was able to get PBP to settle on C:\Program Files\Microchip\MPASM Suite . Now CDC and HID work for the 18F67J50 with PBP3.0! Thanks for routing that out for us!
    Last edited by ScaleRobotics; - 24th August 2011 at 03:46.

  13. #53
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: HID USB on 18F87J50

    I have to say I'm glad for Melabs it's not another Microchip twist who had to implement another .HWLIB thing.

    Finger crossed for the next USB pic though... BTW, it's about time Microchip release USB3 AND/OR Thunderbolt.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #54
    Join Date
    Sep 2009
    Posts
    737

    Default Re: HID USB on 18F87J50

    Darrel,
    I try your DT_HID260, and it work on first attempt. It's very simple to use.
    But I have question.
    If I want to use 64 byte, #define USB_EP0_BUFF_SIZE should be 64, is that correct?
    Thanks

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

    Default Re: HID USB on 18F87J50

    No, endpoint 0 is for setup and control transfers. You should not change that.
    And you should not change anything inside the DT_HID260.pbp file.

    Set the report sizes with the defines...

    Code:
    ;--- Setup USB -------------------------------------------------------------
    INCLUDE "DT_HID260.pbp"
    DEFINE USB_VENDORID    6017
    DEFINE USB_PRODUCTID   2000
    DEFINE USB_VERSION     1
    DEFINE USB_VENDORNAME  "Darrel Taylor"
    DEFINE USB_PRODUCTNAME "DT_HID"
    DEFINE USB_SERIAL      "001"
    DEFINE USB_INSIZE      64   ;  IN report is PIC to PC (8,16,32,64)
    DEFINE USB_OUTSIZE     16   ; OUT report is PC to PIC
    DEFINE USB_POLLIN      10   ; Polling times in mS, MIN=1 MAX=10
    DEFINE USB_POLLOUT     10
    DT

  16. #56
    Join Date
    Sep 2009
    Posts
    737

    Default Re: HID USB on 18F87J50

    Ok. Everything working fine.
    Thanks again.

  17. #57
    Join Date
    Sep 2009
    Posts
    737

    Default Re: HID USB on 18F87J50

    Here is my template. Maybe it will be useful for someone.
    Application for PC is done in VB6. Screen shot:
    Name:  Screen Shoot.JPG
Views: 1077
Size:  71.3 KB
    PBP & VB6 files:
    DT_HID260 Template.zip
    If knobs doesn't appear in vbForm, you need to add it in components.

Members who have read this thread : 1

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