EmbeddedRelated.com
Forums
Memfault Beyond the Launch

PDIUSBD12 returns Buffer Overrun

Started by Ganesh Okade October 10, 2004
Dear Experts,
    I am using PDIUSBD12 from Philips in my embedded device. I am able
to successfully enumerate the device from a Windows driver. I am using
end point 1 IN/OUT for my data communication.
    I have successfully been able to write data from the device to
Windows. But this was only one bytes at a time i.e. I write one byte
to the end point buffer and issue the Validate Buffer command (0xFA) -
work fine. Now in order to improve the throughput, I started writing 2
bytes at a time - works fine. But the moment I start writing 3 bytes
in one shot, the communication stops and the Windows driver reports
that the device responded with a BUFFER OVERRUN error (I get the
following error code in the Windows driver - USBD status = C000000C
(USBD_STATUS_BUFFER_OVERRUN). I understand that the buffer size in
PDIUSBD12 is 16 bytes in size. Then why this buffer overrun?
    For your information I have a circular buffer into which the
application software on my embedded device puts data. The the USB
firmware pics data from this buffer and transmits it. Most of the data
transmission happens from within the EP1 transmit ISR with the first
byte being forcibly written by the application software to trigger a
chain of interrupts causing the rest of the data bytes in the buffer
to be transmitted.
    I want one more information - when a EP1 transmit ISR fires does
it mean all the data bytes in its buffer have been transmitted or only
one byte has been transmitted.
Regards,
Ganesh Okade
Sunlux Technologies Ltd.
www.sunlux-india.com
Dear Experts,
     I happened to resolve this problem and so thought I should post
the solution. It was so happening that in the PDIUSBD12 firmware I was
writing to the EP1 buffer 8 bytes at a time but on Windows side I was
reading at the rate of 1 byte in one URB/request. This was causing the
buffer overrun on the firmware.
     I also found that EP1 interrupt fires after ALL the bytes in its
buffer are transmitted.
     Thanks.

Ganesh Okade
Sunlux Technologies Ltd.
www.sunlux-india.com

Memfault Beyond the Launch