View previous topic :: View next topic |
Author |
Message |
Squintz
Joined: 08 Dec 2009 Posts: 11
|
Proper use of usb_put_packet and usb_puts |
Posted: Thu Jul 01, 2010 1:19 pm |
|
|
usb_put_packet (endpoint, data, len, tgl)
usb_puts(endpoint, data, len, timeout)
I'm trying to understand how to properly use the above two functions. What exactly is an endpoint? In the ex_usb_kbmouse.c example I see it is set to 1 and 2. Does this correspond to the USB Ports? I'm using a PIC 18F4550 which I think only has one USB port. Does that mean endpoint would always be set to 1?
I'm basically trying to create a version of ex_serial.c which uses buffers instead of sending one character at a time. Is there a good example of this already done? |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Jul 02, 2010 11:35 am |
|
|
Quote: |
I'm trying to understand how to properly use the above two functions.
|
usb_put_packet (endpoint, data, len, tgl); // Sends one packet to the host.
usb_puts(endpoint, data, len, timeout); // Sends a multiple packet message to the host.
Quote: |
What exactly is an endpoint?
|
The USB specification defines a device endpoint as “a uniquely addressable portion of a USB
device that is the source or sink of information in a communication flow between the host and device”.
Data stored in a device endpoint -block of data memory- may be a received data packet (IN) or data
packet waiting to be transmited (OUT)
Quote: |
In the ex_usb_kbmouse.c example I see it is set to 1 and 2. Does this correspond to the USB Ports?
I'm using a PIC 18F4550 which I think only has one USB port. Does that mean endpoint would always be set to 1?
|
No. This parameter define the memory segment reserved to allocate endpoint.
Endpoint 0 define an endpoint OUT/SETUP buffer space at 0x1B8:0x1BF
Endpoint 1 define an endpoint IN buffer space at 0x1C0:0x1C7
Endpoint 2 define an endpoint buffer space at 0x1C8:0x1DF that will be used for endpoints 1 and 2.
Humberto |
|
|
Squintz
Joined: 08 Dec 2009 Posts: 11
|
|
Posted: Fri Jul 02, 2010 12:43 pm |
|
|
Thanks for the reply. Unfortunately I'm still confused about what I need to set the endpoint to for my particular application. What you said was a bit over my head right now. |
|
|
Squintz
Joined: 08 Dec 2009 Posts: 11
|
|
Posted: Fri Jul 30, 2010 11:49 am |
|
|
Is usb_put_packet only available for HID devices? Is there not an equivalent CDC function?
I want to buffer some data from the UART and transmit it in chunks over USB. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 30, 2010 1:43 pm |
|
|
Look in the USB CDC driver file to see what functions are available.
Here's the file location:
Quote: |
c:\program files\picc\drivers\usb_cdc.h
|
|
|
|
|