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 CCS Technical Support

Question about USB HID example

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



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

Question about USB HID example
PostPosted: Wed Mar 09, 2016 9:16 am     Reply with quote

Greetings! I'm using PIC18F45K50. So I make my own program based on ex_usb_hid.c.
I'm experiencing some problems with
Code:

#define USB_CONFIG_HID_TX_SIZE   2
#define USB_CONFIG_HID_RX_SIZE   2


In the example these values are used in usb_get_packet() and usb_put_packet() as max values. The problem is I can't set them to bigger values. For example
Code:

#define USB_CONFIG_HID_TX_SIZE   50
#define USB_CONFIG_HID_RX_SIZE  50

doesn't work.
The datasheet says the input buffer has at least 255 bytes. The usb_get_packet() demands int16 max. So I suppose it's made to pass larger data strings, but I just can't do it.
What am I doing wrong?!
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Wed Mar 09, 2016 3:41 pm     Reply with quote

Remember you must do the defines _before_ you load the USB code.
So:
Code:

//Processor setup, fuses, clock etc here

#define USB_CONFIG_HID_TX_SIZE   64
#define USB_CONFIG_HID_RX_SIZE  64
#include <pic18_usb.h>
#include <usb_desc_hid.h>
#include <usb.c>


It defaults if a value is not seen, but will accept larger sizes. You should use 64, not 50. The maximum size for an HID single transaction is 64 bytes (for USB2). The report size can be much bigger.
Your PC application has to send the entire lump as one report. Are you sure your PC code is correctly handling this?.
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Fri Mar 11, 2016 12:37 am     Reply with quote

It`s working with 64! Thanks!
Can I ask one more thing?! How can I set eeprom values in PIC18F25K50?
I`ve used
Code:

#ROM int 0x7FFC00= {

for other controllers, but here I just can`t find the eeprom address.
Any suggestions?
Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Fri Mar 11, 2016 3:11 am     Reply with quote

Always use:

#ROM int8 getenv("EEPROM_ADDRESS") = {.......

Much easier.
The location is in the programming specification sheet, and is 0xF00000.

0x7ffC00, implies a PIC30 (or similar).
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