Bulk Transfer

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
MrMehdi+

Bulk Transfer

Post by MrMehdi+ » Fri Aug 20, 2010 5:39 pm

Hello
Friends who can give answers to the following questions:
1 - Maximum speed at which the microcontroller sends data to the computer how much?
2 - How can an array of data transfer from computer to our microcontroller.
3 - How to use a transfer is interrupted?
4 - Thank you

MrMehdi+

Re: Bulk Transfer

Post by MrMehdi+ » Fri Aug 27, 2010 11:01 pm

Hi
no anybody can't help me?
thanks.

Valeron
Posts: 7
Joined: Wed Aug 11, 2010 6:04 am
Contact:

Re: Bulk Transfer

Post by Valeron » Fri Sep 03, 2010 6:00 am

Make a your Report Descriptor, for example (my working project):
PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] =
{
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x02, // COLLECTION (Logical)
0x85, 0x01, // REPORT_ID (0x01)
0x09, 0x01, // USAGE (Pointer)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x05, // REPORT_COUNT (5)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x01, // USAGE (Pointer)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x07, // REPORT_COUNT 7 байт принимаем . на самом деле 6, +ReportID
0x91, 0x02, // OUTPUT (Data,Var,Abs)

0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};

to send from MCU to PC 5 bytes by usbSetInterrupt():
...
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x05, // REPORT_COUNT (5)
0x81, 0x02, INPUT (Data,Var,Abs)
...

...
to recieve from PC to MCU 7 bytes by usbFunctionWriteOut:
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x07, // REPORT_COUNT 7
0x91, 0x02, // OUTPUT (Data,Var,Abs)
....
on PC you use WriteFile and ReadFile, it is possible to do without libusb


to send and recieve data by USB control message:
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)

see example "hid-custom-rq". I transfer 48 bytes by this method.

Post Reply