• AVR Freaks

PIC24 in USB Host mode

Author
TroubleShoot
Starting Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2014/02/21 07:18:26
  • Location: 0
  • Status: offline
2014/03/04 03:28:19 (permalink)
0

PIC24 in USB Host mode

Hello everyone,
 
I have a sensor (UTM-30LX), a CDC device, that I want to connect with PIC24 with USB HOST/ OTG Capabilities.
Before buying this PIC24, I want to know how I am going to connect my device ,and more than that, the code to implement in the MCU (Driver, ..etc).
 Please if anyone have tried this, share a link that describe all of that.
 
Best regards.
#1

17 Replies Related Threads

    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/04 07:51:18 (permalink)
    0
    TroubleShoot
    I have a sensor (UTM-30LX), a CDC device, that I want to connect with PIC24 with USB HOST/ OTG Capabilities.
    Before buying this PIC24, I want to know how I am going to connect my device ,and more than that, the code to implement in the MCU (Driver, ..etc).
    Please if anyone have tried this, share a link that describe all of that.

    Please see the Host examples in the MLA. The hardware does support host mode.
     
    #2
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/05 01:49:41 (permalink)
    0
    Hi Alan_O,
    I already installed the latest MLA, but all I see there is some .c files, What file to choose? how to implement these files in a project?
    Thanks in advance.
    #3
    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/05 08:51:11 (permalink)
    0 (2)
    Use one of the projects which already exists.
    #4
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/06 05:37:30 (permalink)
    0
    Sorry about that Alan_0 but it seems that you have never tried to connect PIC24 as a USB host pink ... If anyone know how to make the drivers, ... please share your knowledges!!
    With respects. 
    #5
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/06 08:43:40 (permalink)
    0
    I did use it as a Host to a Mouse, and I got the code from the MAL apart from some little changes Smile

    GENOVA :D :D ! GODO
    #6
    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/06 09:11:47 (permalink)
    0
    Exact Steps:
    1. Download the MLA from:
         http://www.microchip.com/mla
    2. Make sure you install the USB programs when you install it.
    3. In the MLA source, have a look at:
       USB/Host - CDC - Serial Demo/Firmware
    Inside there, there is a directory called MPLAB.X. That's the project.
    4. Open the project mentioned in step three using MPLAB X.
     
     
    #7
    maxruben
    Super Member
    • Total Posts : 3371
    • Reward points : 0
    • Joined: 2011/02/22 03:35:11
    • Location: Sweden
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/06 14:20:30 (permalink)
    0
    There is also quite an extensive windows help file for the USB stack when you install the MLA (MAL). It can be found under the start menu.
     
    /Ruben
     
    #8
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/07 01:04:15 (permalink)
    0
    Thanks a lot for the help Alan_O, it's more clean right now because I used to program with MikroC for dsPic and not familiar with MPLABX.
    I'm going to try my best for this software and tell you if it worked (I hope so) or no.
     
     
    #9
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/07 01:08:55 (permalink)
    0
    I read some pages from help_mla_driver.pdf ... it describes differents fonctionnalities of the methods applied in the drivers, I will took a long look when I could recognize my device with the PIC24F!!
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 18041
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re:PIC24 in USB Host mode 2014/03/07 17:43:33 (permalink)
    0
    " I am going to connect my device"
    is it Top Secret? What is it?
    if it a some secial PC USB device with a custom driver.
    You can not just hook it up to a PIC24 (or a Mac, or  LINUX for that matter)
    You would need the details from the Manufacturer.
    Or Reverse enginner it.
    #11
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/08 01:52:46 (permalink)
    0
    I did say what is my device: it a sensor called "UTM-30LX" from Hokuyo and it's a CDC device.. I think that's not a Top secret device Smile
    post edited by TroubleShoot - 2014/03/08 01:56:25
    #12
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/11 05:30:32 (permalink)
    0
    Here is the update : I bought the PIC24FJ64GB002 and installed the MLA... I tried to do all the modifications to the code of the USB Host projects (because the original ones suited to PIC24FJ64GB004 and not my Pic). 
    Could someone tell me WHICH files from the MLA>> framework >> USB should I use in MPLAB X project (Compiler: XC16), and the modifications in the code, to communicate with the CDC device (UTM-30LX).
     
    Thanks in advance.
    #13
    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/11 07:16:51 (permalink)
    +2 (1)
    TroubleShoot
    Could someone tell me WHICH files from the MLA>> framework >> USB should I use in MPLAB X project (Compiler: XC16), and the modifications in the code, to communicate with the CDC device (UTM-30LX).

     
    Refer to my previous post where I gave you exact steps on what to do. Use the example project which already exists and modify it for your processor. The 002 and the 004 are almost exactly the same. All you should have to do is change the MCU in the project properties.
     
    #14
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/13 00:37:28 (permalink)
    0
    Indeed it was helpful your steps, but the thing is that projects were made for Explorer 16, boards... so they use UART, LCD, Leds, (even thermal sensors I think) So there is a loooot of things to modify (millions of lines to remove) And for me I'm developping this only in a Bread Board, So I'm searching how to build a project manually!! And Thanks guys for the support!!
    #15
    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/13 06:05:29 (permalink)
    +1 (1)
    TroubleShoot
    Indeed it was helpful your steps, but the thing is that projects were made for Explorer 16, boards... so they use UART, LCD, Leds, (even thermal sensors I think) So there is a loooot of things to modify (millions of lines to remove)

     
    It'll be much easier to start with a project that already exists and take out the code you don't need. It can't take more than half an hour. I've done it lots of times. There aren't "millions" of lines anywhere.
     

    And for me I'm developping this only in a Bread Board, So I'm searching how to build a project manually!! And Thanks guys for the support!!

     
    If you insist on making your own project, why don't you have a look at the projects that already exist and model a new project after one of those? That's not hard either.
     
    I'm not sure what it is you think you're looking for. It's all right in front of you. Full source code for working projects is about all one can expect.
     
    #16
    TroubleShoot
    Starting Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2014/02/21 07:18:26
    • Location: 0
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/13 14:19:24 (permalink)
    +1 (1)
    Thanks a lot guys for the help,
         It worked finally (Connecting a Generic USB to the pic24FJ64GB002)... Indeed all the project to make the Pic24F hosting a device was in the MLA but worked with Explorer16, Picdem... So like you said I have to re-configure all the project adding some instructions (like the new bit configuration of pic24FJ64GB002) and removing a looooot of methods and files that implement LCD, UART, Thermal sensor,...etc. 
     
      If it worked with the generic devices, I thing I should be able do that with the project of CDC devices (with again a loooot of changes ) 
     
    #17
    Alan_O
    Super Member
    • Total Posts : 268
    • Reward points : 0
    • Joined: 2013/09/23 13:16:02
    • Location: Orlando, FL United States of America
    • Status: offline
    Re:PIC24 in USB Host mode 2014/03/13 20:14:47 (permalink)
    +4 (2)
    TroubleShoot
         It worked finally (Connecting a Generic USB to the pic24FJ64GB002)... Indeed all the project to make the Pic24F hosting a device was in the MLA but worked with Explorer16, Picdem... So like you said I have to re-configure all the project adding some instructions (like the new bit configuration of pic24FJ64GB002) and removing a looooot of methods and files that implement LCD, UART, Thermal sensor,...etc. 


    Great! Sometimes you have to do a bit of engineering. It's good for you ;)
     

      If it worked with the generic devices, I thing I should be able do that with the project of CDC devices (with again a loooot of changes ) 
     

     
    Yes. Most of the changes should be the same as the generic one.
     
    Alan.
     
    #18
    Jump to:
    © 2019 APG vNext Commercial Version 4.5