Sending more Data with usbSetInterrupt

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
schwa226
Rank 1
Rank 1
Posts: 20
Joined: Thu Feb 11, 2010 9:20 am

Sending more Data with usbSetInterrupt

Post by schwa226 » Thu Dec 22, 2011 3:18 pm

Hi,

i want to send more usbSetInterrupt in a row.

Code: Select all

void log_usb (unsigned char ch)
{
   while (!usbInterruptIsReady())                                    // check if USB int is ready
   {
      wdt_reset();
      usbPoll();
   }
   
   memcpy(&replyBuf[0], &NewLogCharAvailable, sizeof(uchar));            // copy report id to replybuffer
   memcpy(&replyBuf[1], &ch, sizeof(uchar));                                     // copy data to replybuffer      
   usbSetInterrupt(&replyBuf[0], sizeof(uchar) + sizeof(uchar));         // send ReportID + data         
}


If I now use the log_usb like this:

Code: Select all

for (i == 0; i < LOG_LENGTH; i++)
{
  log_usb (MyLOG[i]);
}


With only LOG_LENGTH = 1 it is working. If LOG_LENGTH >= 2 then the device will be reseted!?
The LOG_LENGTH is unknown so I have to send each byte seperate.

EDIT:
Is it possible to send ~704 Bytes to the host in 8 Byte pakets?

Like:

Code: Select all

    0x85, 0x0B,                    //   REPORT_ID (11)
    0x96, 0xC0, 0x02,                    //   REPORT_COUNT (704)
    0x09, 0x00,                    //   USAGE (Undefined)
    0x82, 0x00, 0x01,              //   INPUT (Data,Ary,Abs,Buf)


And than like:

Code: Select all

i = 0;

   while (!usbInterruptIsReady())                                    // check if USB int is ready
   {
      wdt_reset();
      usbPoll();
   }
  usbSetInterrupt(&NewLOGReportID, 1);

while (i < 704)
{
   while (!usbInterruptIsReady())                                    // check if USB int is ready
   {
      wdt_reset();
      usbPoll();
   }
  usbSetInterrupt(&buffer, 8);
  i += 8;
}

Post Reply