• AVR Freaks

USB HID talking to GPS Module

Author
Novolec
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2011/02/13 18:35:12
  • Location: 0
  • Status: offline
2011/10/09 04:11:44 (permalink)
0

USB HID talking to GPS Module

I am trying to communicate with a GPS module from the UART port on a PIC24 and relay the info back to a PC via the USB port. I would like to use a HID class device, but would consider a CDC. The issue I face is that some of the data strings from the GPS are around 150 bytes long, while the maximum length of data in a HID packet is 64 bytes. Do I need to create a second buffer and feed data from this into the HID buffer, or can someone suggest a better way of doing this?
 
Thanks
 
#1

7 Replies Related Threads

    Antipodean
    Super Member
    • Total Posts : 1761
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 04:59:29 (permalink)
    0
    Novolec

    I am trying to communicate with a GPS module from the UART port on a PIC24 and relay the info back to a PC via the USB port. I would like to use a HID class device, but would consider a CDC. The issue I face is that some of the data strings from the GPS are around 150 bytes long, while the maximum length of data in a HID packet is 64 bytes. Do I need to create a second buffer and feed data from this into the HID buffer, or can someone suggest a better way of doing this?
     
    Thanks
     


    The CDC class as programmed by Microchip will handle 255 bytes - but you have to be careful. If you start sending characters before the device has finished enumerating the host (especially if a Windows host) will enumerate the port as a mouse. If this happens the cursor will continously jump all over the screen as the host treats the GPS data as mouse data. To stop this you need to wait for the charaters the host sends to attempt to recognise a mouse, and wait several seconds before allowing any data to be transmitted.
     
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #2
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 07:19:56 (permalink)
    0
    I use HID and reserve the first 2-3 bytes out of 64 as indicators of the type of message (say, GPRMC etc) and when the message is longer I use another counter to tell the Host which is the 1st, which the 2nd in the string...

    GENOVA :D :D ! GODO
    #3
    Ian.M
    Super Member
    • Total Posts : 13263
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 07:56:39 (permalink)
    0
    A CDC device will work with existing GPS software. But as Ant!podean points out: Beware of detection as a P&P serial mouse.

    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 09:23:25 (permalink)
    0

    Beware of detection as a P&P serial mouse.

    I believe this problem occurs just when serenem.sys is applied as a upper filter driver, but I may be wrong.

    INF files of FTDI, SiLabs and Prolific install serenem.sys (or equivalent).
    Legacy COM ports do.
    But the INFs of Microchip CDC examples and MCP2200 don't.

    Have you seen this problem on Microchip's CDC / MCP2200 ?

    Tsuneo


    typo: serenem.sys --> serenum.sys
    post edited by chinzei - 2011/10/09 16:56:47
    #5
    Antipodean
    Super Member
    • Total Posts : 1761
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 14:08:23 (permalink)
    0
    chinzei

    Beware of detection as a P&P serial mouse.

    I believe this problem occurs just when serenem.sys is applied as a upper filter driver, but I may be wrong.

    INF files of FTDI, SiLabs and Prolific install serenem.sys (or equivalent).
    Legacy COM ports do.
    But the INFs of Microchip CDC examples and MCP2200 don't.

    Have you seen this problem on Microchip's CDC / MCP2200 ?

    Tsuneo


    I haven't tried it with Microchips INF, but I had the impression it was a function of the windows mouse driver that when a new coms port is declared it tries it for a mouse. I know this has been a problem in the past for UPS devices on a hardware serial port, so don't beleive it is a specific function of serenem.sys.
     
    I have had it happen with FTDI USB COM ports, but haven't had occaision to connect a serial GPS through a USB-serial adapter of any other type.
     
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #6
    Novolec
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2011/02/13 18:35:12
    • Location: 0
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/09 15:45:55 (permalink)
    0
    Thanks for the responses to this. One reason I was inclined to go with HID rather than CDC was that I had read in various forums that CDC was more susceptible to some weird problems showing up. I will do a bit of experimenting with this and see how it goes.
     
    Thanks again.
    #7
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:USB HID talking to GPS Module 2011/10/10 02:46:00 (permalink)
    0
    Yes, that thing about noise hanging CDC is also true. I again strongly enforce the HID Smile

    GENOVA :D :D ! GODO
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5