usbFunctionRead problem
Posted: Tue Oct 05, 2010 1:22 pm
I'm using USB_CFG_IMPLEMENT_FN_READ feature,descriptor data stored in flash are decompressed by usbFunctionRead on the fly,but it can't be recognized by host.
code like this:
If I do not use compression it can do work,like this:
I checked decompress function,stack,can't figure out.Is there some transmit manager limit in V-USB interrupt service ?
code like this:
Code: Select all
uchar buffer[256];
uchar usbFunctionRead(uchar *data, uchar len)
{
uchar *r = usbMsgPtr; //compressed data ptr in flash
if(firstrun) mydepack(r,buffer); //decompress needs about 5ms execute time
memcpy(data,buffer+pos,len);
pos+=len;
return len;
}
If I do not use compression it can do work,like this:
Code: Select all
uchar buffer[256];
uchar usbFunctionRead(uchar *data, uchar len)
{
uchar *r = usbMsgPtr; //uncompressed data ptr in flash
if(firstrun){
memcpy_P(buffer,r,256);
_delay_ms(5); //to ensure it's not some timing problem.
}
memcpy(data,buffer+pos,len);
pos+=len;
return len;
}
I checked decompress function,stack,can't figure out.Is there some transmit manager limit in V-USB interrupt service ?