CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Proper use of usb_put_packet and usb_puts

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Squintz



Joined: 08 Dec 2009
Posts: 11

View user's profile Send private message

Proper use of usb_put_packet and usb_puts
PostPosted: Thu Jul 01, 2010 1:19 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 02, 2010 11:35 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 02, 2010 12:43 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 30, 2010 11:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 30, 2010 1:43 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group