USB Bulk using HID

Post your requests and ideas on the future development of mikroC.
Post Reply
Author
Message
PICCmania
Posts: 4
Joined: 01 Oct 2007 04:54
Location: India

USB Bulk using HID

#1 Post by PICCmania » 04 Oct 2007 14:08

mikroC does not have generic USB library. Insted it provides HiD library. When I used it for simple data aquisition project I found that it is impossible to obtain data transfer speed more that 32KB/s(even though USB complete says it is possible at 64KB/s, that i think , might be for bothways 32KB IN, 32KB OUT).

So my question/idea is...IS IT POSSIBLE to simply change the HiD descriptor to BULK descriptor and use HiD functions for bulk transfers, so that we can actually take advantage of USB ?

32KB/s is nothing as compared to the capacity of the on-chip USB of 18F4455 (upto 1MB/s). So i request you to please make a note of this and help developers.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: USB Bulk using HID

#2 Post by zristic » 04 Oct 2007 14:24

HID example is compiled with HID_INPUT_REPORT_BYTES set to 1. If you change this to 8 or to 64, then you will be able to transfer larger packets in one burst.

There are other variations of HID descriptor here on the forum, use the search option (specifically those posts made by xor).

PICCmania
Posts: 4
Joined: 01 Oct 2007 04:54
Location: India

#3 Post by PICCmania » 04 Oct 2007 14:42

Yes, i had already made necessary changes and trying with maximum packet size of 64Bytes and i get 32KB/s with that setting.

Main objective is, can we change the descriptor and use it as a BULK device, still using HiD library functions ?Because I think, interrupt latency(which is 1ms in HiD mode and thus causes limitation of 64Bytes packets per millisecond) is governed by the descriptor(and hence USB controller on chip) and not by HiD library routines. I think HiD routines simply puts data into USB registers and set/resets appropriate bits to start transfer of data.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 04 Oct 2007 15:07

Of course, you can change the descriptor to suit your needs. We tried to make the HID library in such a way that it influenced the transfer speed as little as possible.

wakeup12
Posts: 5
Joined: 15 Dec 2011 19:34

Re: USB Bulk using HID

#5 Post by wakeup12 » 15 Dec 2011 19:43

Hello,

Is it possible to send a interrupt or bulk transfer (e.g. for a hid mouse) using hid functions or should I find another libraries? If it is possible, how can I modify this code?


Init_Main();

HID_Enable(&userWR_buffer, &userWR_buffer);

Delay_ms(1000);
Delay_ms(1000);
while(1) {
Delay_ms(1000);
i=0;
while(i<8) {
if(!HID_Write(&userWR_buffer, 1)) PORTA.B1=1;
else PORTA.B0=1;
}
}

Delay_ms(1000);
HID_Disable();
}

Thank you...

Post Reply

Return to “mikroC Wish List”