Hi Lengcallrobot and welcome to the forums!
This is taken from the EasyHID help file contained in the EasyHID folder:
"What is a HID Device?
...... One of the major advantages of HID is that you do not need to supply a custom driver, as one is already supplied with the operating system. A limitation of HID is that its data transfer rate is limited to a maximum of 64KB per second. However, this is still significantly faster than RS-232 (115200 baud is approximately 12KB per second)......"
You should be able to send 64kBytes/sec in Full-speed mode as shown above.
It looks to me as though you are sending data in Low-speed mode 64kbits/sec (or 8kBytes/sec) from what you have shown.
Are you using a 48MHz clock source for the USB and have you set bit 2 of the UCFG register to enable Full-speed?
I could be leading you up the garden path about the speeds but this is my understanding
Hope this helps
Rob
Last edited by Rob; - 15th July 2008 at 09:09. Reason: Really should proof read before posting!
Thank Rob, however, I cannot set UCFG.2=1 or FSEN=1 in my program. When I do this, I get error message . the below is my source code in pbp
================================================== =================
DEFINE OSC 48
DEFINE LOADER_USED 1
USBBufferSizeMax con 64 ' maximum buffer size
USBBufferSizeTX con 64
USBBufferSizeRX con 64
' the USB buffer...
USBBuffer Var Byte[USBBufferSizeMax]
USBBufferCount Var Byte
'Variables -----------------
I var byte
Ana var word
' Define ports
SP1 VAR PORTC.0
' ************************************************** **********
' * main program loop - remember, you must keep the USB *
' * connection alive with a call to USBService every couple *
' * of milliseconds or so... *
' ************************************************** **********
TRISD = %11110000 'Set PORTD 0-3 to output, 4-7 to input
'UCFG.2 = 1
usbinit ' initialise USB...
ProgramStart: 'Just want to test the USB speed
high sp1
gosub DoUSBIn
low sp1
gosub DoUSBOut
goto ProgramStart
' ************************************************** **********
' * receive data from the USB bus *
' ************************************************** **********
DoUSBIn:
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive (executed at least every 10ms)
USBIn 1, USBBuffer, USBBufferCount, DoNext ' read data, if available
PORTD = usbbuffer[2]
Ana = (usbbuffer[0] << 7) | usbbuffer[1]
freqout sp1,500,ana
DoNext:
return
' ************************************************** **********
' * wait for USB interface to attach *
' ************************************************** **********
DoUSBOut:
USBBufferCount = USBBufferSizeTX ' TX buffer size
USBService ' keep connection alive (executed at least every 10ms)
USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
return
================================================== =================
Do you know other way to get Full-Speed mode with pbp ?
Thank you in advance.
I think you're using PBP 2.47 or older so the UCFG register is not included. Try this:Thank Rob, however, I cannot set UCFG.2=1 or FSEN=1 in my program. When I do this, I get error message
UCFG var byte EXT
UCFG.2 = 1
Cheers
Rob
Unless you're using descriptors you found somewhere else, you shouldn't need to mess with
UCFG. Your PBP USB template descriptor file should have this already in place.
#define UCFG_VAL _PUEN|_TRINT|_FS|MODE_PP ; Full-speed
Arguments for the define are listed in the USB18.inc include file under UCFG Initialization
Parameters.
Bookmarks