پاسخ : obdev USB ** آموزش اتصال avr به پورت usb بدون آی سی واسط
درایور 64 بیتی libusb رو سرچ کن و دانلود کن
درایور 64 بیتی libusb رو سرچ کن و دانلود کن
how to use interrupt out transfer in vusb how to use interrupt out transfer in vusb by dagakshay » Wed Feb 16, 2011 7:56 am I HAD UNDERSTOOD THE INTERRUPT IN TRANSFER IN VUSB... PLEASE TELL ME HOW TO USE HOW TO USE INTERRUPT OUT TRANSFER IN VUSB... ANY EXAMPLE OR LINK FOR THAT... HOW TO DECLARE INTERRUPT OUT ENDPOINT I HAD WENT THROUGH THE LINK: http://vusb.wikidot.com/driver-api BUT HERE THEY HAD NOT SHOWN HOW TO DECLARE INTERRUPT OUT ENDPOINT.... Re: how to use interrupt out transfer in vusb by Augend » Sat Feb 26, 2011 10:13 am first you need to declare in usb configuration . follow these steps: 1- go to usbdrv.c 2- find this line: PROGMEM char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 3- add seven bites to the length of descriptor as followed in this line: 18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff) +7, 0, //I added las +7 4-now you need to add one ondpoint . find this line and add 1: USB_CFG_HAVE_INTRIN_ENDPOINT + 1 , /* endpoints excl 0: number of endpoint descriptors to follow */ // I added last +1 5-now at the end of descriptor add these codes to make a new OUT endpoint: 7, /* sizeof(usbDescrEndpoint) */ USBDESCR_ENDPOINT, /* descriptor type = endpoint */ (char)0x01, /* OUT endpoint number 1 */ //instead of 81 0x03, /* attrib: Interrupt endpoint */ 8, 0, /* maximum packet size */ USB_CFG_INTR_POLL_INTERVAL, /* in ms */ You need also to configure your driver to use this interrupt-OUT no-1 6- now go to usbconfig.h and set USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 7- find this line: #if USB_CFG_IMPLEMENT_FN_WRITEOUT if(usbRxToken < 0x10){ /* endpoint number in usbRxToken */ and change it to this: if(usbRxToken == USBPID_OUT){ /* endpoint number in usbRxToken *///* 8-every time device receives Interrupt-out, goes into usbFunctionWriteOut() tell me if it works for you
#include <AVR/io.h> #include "usbdrv.h" uchar usbFunctionSetup(uchar data[8]) { usbRequest_t *req; req = (usbRequest_t*)data; if(req->bmRequestType == 0xac) { return USB_NO_MSG; } return 0; } uchar usbFunctionRead(uchar *data, uchar len) { data[0] = PINB; data[1] = PINC; data[2] = PIND; return 3; } int main() { usbInit(); while(1) { usbPoll(); } }
#include <AVR/io.h> #include "usbdrv.h" uchar usbFunctionSetup(uchar data[8]) { usbRequest_t *req; req = (usbRequest_t*)data; if(req->bmRequestType == 0xac)//PC need PINC registers { return USB_NO_MSG; } if(req->bmRequestType == 0xaf)//PC need to set PORTC and DDRC registers { return USB_NO_MSG; } return 0; } uchar usbFunctionRead(uchar *data, uchar len) { data[0] = PINC; return 1; //lemght of data stored in array } uchar usbFunctionWrite(uchar *data, uchar len) { PORTC = data[0]; DDRC = data[1]; return 1; // ok } int main() { usbInit(); while(1) { usbPoll(); } }
دیدگاه