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 ?