View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
Question about USB HID example |
Posted: Wed Mar 09, 2016 9:16 am |
|
|
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
|
|
Posted: Wed Mar 09, 2016 3:41 pm |
|
|
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
|
|
Posted: Fri Mar 11, 2016 12:37 am |
|
|
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
|
|
Posted: Fri Mar 11, 2016 3:11 am |
|
|
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). |
|
|
|